CVS commit: src/sys/arch/amd64/stand/prekern

2017-12-22 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat Dec 23 06:48:30 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: Makefile

Log Message:
Use ldscript from src to fix build.sh build


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/Makefile

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/stand/prekern/Makefile
diff -u src/sys/arch/amd64/stand/prekern/Makefile:1.5 src/sys/arch/amd64/stand/prekern/Makefile:1.6
--- src/sys/arch/amd64/stand/prekern/Makefile:1.5	Sun Nov 26 11:01:09 2017
+++ src/sys/arch/amd64/stand/prekern/Makefile	Sat Dec 23 06:48:30 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2017/11/26 11:01:09 maxv Exp $
+#	$NetBSD: Makefile,v 1.6 2017/12/23 06:48:30 ryoon Exp $
 
 PROG=		prekern
 SRCS=		locore.S trap.S prekern.c mm.c console.c elf.c prng.c
@@ -25,7 +25,8 @@ CPPFLAGS+=	-DKERNEL -D__x86_64__
 CFLAGS+=	-Wall -Werror -Wstrict-prototypes
 CFLAGS+=	-mno-red-zone -mno-mmx -mno-sse -mno-avx -ffreestanding
 STRIPFLAG=
-LINKFLAGS=	-X -z max-page-size=0x10 -Ttext 0x10 -T prekern.ldscript
+LINKFLAGS=	-X -z max-page-size=0x10 -Ttext 0x10 \
+		-T ${S}/arch/amd64/stand/prekern/prekern.ldscript
 
 KERN_AS=	library
 .include	"${S}/lib/libkern/Makefile.inc"



CVS commit: src/sys/arch/amd64/stand/prekern

2017-12-22 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Sat Dec 23 06:48:30 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: Makefile

Log Message:
Use ldscript from src to fix build.sh build


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/Makefile

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



CVS commit: src/sys/arch/mips/mips

2017-12-22 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Dec 22 22:59:26 UTC 2017

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
Don't handle emulations overriding e_fault.

No existing emulations do this.
(COMPAT_IRIX did, but was removed)


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.244 src/sys/arch/mips/mips/trap.c:1.245
--- src/sys/arch/mips/mips/trap.c:1.244	Fri Jul 14 20:32:32 2017
+++ src/sys/arch/mips/mips/trap.c	Fri Dec 22 22:59:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $	*/
+/*	$NetBSD: trap.c,v 1.245 2017/12/22 22:59:25 maya Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.244 2017/07/14 20:32:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.245 2017/12/22 22:59:25 maya Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -391,11 +391,7 @@ trap(uint32_t status, uint32_t cause, va
 
 		onfault = pcb->pcb_onfault;
 		pcb->pcb_onfault = NULL;
-		if (p->p_emul->e_fault) {
-			rv = (*p->p_emul->e_fault)(p, va, ftype);
-		} else {
-			rv = uvm_fault(map, va, ftype);
-		}
+		rv = uvm_fault(map, va, ftype);
 		pcb->pcb_onfault = onfault;
 
 #if defined(VMFAULT_TRACE)



CVS commit: src/sys/arch/mips/mips

2017-12-22 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Dec 22 22:59:26 UTC 2017

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
Don't handle emulations overriding e_fault.

No existing emulations do this.
(COMPAT_IRIX did, but was removed)


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/arch/mips/mips/trap.c

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



CVS commit: [netbsd-7-1] src

2017-12-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec 22 19:13:18 UTC 2017

Modified Files:
src/distrib/notes/common [netbsd-7-1]: main
src/doc [netbsd-7-1]: CHANGES-7.1.1 LAST_MINUTE
src/gnu/usr.bin/groff/tmac [netbsd-7-1]: mdoc.local
src/sys/sys [netbsd-7-1]: param.h

Log Message:
7.1.1


To generate a diff of this commit:
cvs rdiff -u -r1.510.4.8 -r1.510.4.8.2.1 src/distrib/notes/common/main
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-7.1.1
cvs rdiff -u -r1.2.52.2 -r1.2.52.2.2.1 src/doc/LAST_MINUTE
cvs rdiff -u -r1.75.4.5.2.1 -r1.75.4.5.2.2 \
src/gnu/usr.bin/groff/tmac/mdoc.local
cvs rdiff -u -r1.459.2.10.2.1 -r1.459.2.10.2.2 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/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.510.4.8 src/distrib/notes/common/main:1.510.4.8.2.1
--- src/distrib/notes/common/main:1.510.4.8	Sat Mar 11 08:48:42 2017
+++ src/distrib/notes/common/main	Fri Dec 22 19:13:18 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.510.4.8 2017/03/11 08:48:42 snj Exp $
+.\"	$NetBSD: main,v 1.510.4.8.2.1 2017/12/22 19:13:18 snj Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -50,7 +50,7 @@
 .as MACHINE_LIST " sgimips shark sparc sparc64 sun2 sun3 vax x68k xen zaurus .
 .so \*[.CURDIR]/../common/macros
 .
-.Dd March 11, 2017
+.Dd December 22, 2017
 .Dt INSTALL 8
 .Os NetBSD
 .Sh NAME
@@ -480,25 +480,22 @@ possible,
 would not exist.
 .
 .if \n[FOR_RELEASE] \{\
-.Ss Changes Between The NetBSD 7.0 and 7.1 Releases
+.Ss Changes Between The NetBSD 7.1 and 7.1.1 Releases
 .Pp
-The
 .Nx
-\*V release
-brings support for new devices, the integration of many bug fixes,
-and many userland improvements.
-The result of these improvements is a stable operating system fit for
-production use that rivals most commercially available systems.
+\*V
+is the first security/critical update of the NetBSD 7.1 release branch.
+It represents a selected subset of fixes deemed important for security
+or stability reasons.
+.Pp
+The complete list of changes can be found in the
+CHANGES-7.1.1 file in the top level directory of the NetBSD 7.1.1
+release tree:
+.Lk http://ftp.NetBSD.org/pub/NetBSD/NetBSD-7.1.1/CHANGES-7.1.1
 .Pp
 See
-.Lk http://www.NetBSD.org/releases/formal-7/NetBSD-7.1.html
+.Lk http://www.NetBSD.org/releases/formal-7/NetBSD-7.1.1.html
 for some of the more noteworthy changes in this release.
-.Pp
-A more extensive list of changes can be found in the
-CHANGES-7.1:
-.Lk http://ftp.NetBSD.org/pub/NetBSD/NetBSD-7.1/CHANGES-7.1
-file in the top level directory of the NetBSD 7.1 release tree.
-.Pp
 .\} \" \n[FOR_RELEASE]
 .
 .Ss "Features to be removed in a later release"
@@ -567,6 +564,8 @@ Changes between the 6.0 and 7.0 releases
 Changes between the initial 7.0 branch and the final release of 7.0.
 .It Li CHANGES-7.1
 Changes between the final release of 7.0 and the final release of 7.1.
+.It Li CHANGES-7.1.1
+Changes between the final release of 7.1 and the final release of 7.1.1.
 .It Li CHANGES.prev
 Changes in previous
 .Nx
@@ -846,6 +845,12 @@ _gpio
 _rtadvd
 .bullet)
 .
+.if \n[i386] \{\
+.Ss2 Issues affecting an upgrade from NetBSD 7.1
+.Pp
+The VM86 option has been disabled by default in the GENERIC kernel.
+.
+\}
 .Ss "Using online NetBSD documentation"
 .Pp
 Documentation is available if you installed the manual

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.40 src/doc/CHANGES-7.1.1:1.1.2.41
--- src/doc/CHANGES-7.1.1:1.1.2.40	Tue Dec 12 09:14:41 2017
+++ src/doc/CHANGES-7.1.1	Fri Dec 22 19:13:18 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.40 2017/12/12 09:14:41 snj Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.41 2017/12/22 19:13:18 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -3825,3 +3825,11 @@ sys/arch/x86/x86/fpu.c1.19 via patch
 	Properly mask mxcsr to prevent faults.
 	[maxv, ticket #1540]
 
+distrib/notes/common/main			patched by hand
+doc/LAST_MINUTE	patched by hand
+gnu/usr.bin/groff/tmac/mdoc.local		patched by hand
+sys/sys/param.h	patched by hand
+
+	Welcome to 7.1.1.
+	[snj]
+

Index: src/doc/LAST_MINUTE
diff -u src/doc/LAST_MINUTE:1.2.52.2 src/doc/LAST_MINUTE:1.2.52.2.2.1
--- src/doc/LAST_MINUTE:1.2.52.2	Fri Jan  6 06:10:37 2017
+++ src/doc/LAST_MINUTE	Fri Dec 22 19:13:18 2017
@@ -1,6 +1,6 @@
-#	$NetBSD: LAST_MINUTE,v 1.2.52.2 2017/01/06 06:10:37 snj Exp $
+#	$NetBSD: LAST_MINUTE,v 1.2.52.2.2.1 2017/12/22 19:13:18 snj Exp $
 
-This file contains important information on the NetBSD 7.1 release that
+This file contains important information on the NetBSD 7.1.1 release that
 did not make it into the main documentation.
 
 [all]

Index: src/gnu/usr.bin/groff/tmac/mdoc.local
diff -u src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.5.2.1 

CVS commit: [netbsd-7-1] src

2017-12-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec 22 19:13:18 UTC 2017

Modified Files:
src/distrib/notes/common [netbsd-7-1]: main
src/doc [netbsd-7-1]: CHANGES-7.1.1 LAST_MINUTE
src/gnu/usr.bin/groff/tmac [netbsd-7-1]: mdoc.local
src/sys/sys [netbsd-7-1]: param.h

Log Message:
7.1.1


To generate a diff of this commit:
cvs rdiff -u -r1.510.4.8 -r1.510.4.8.2.1 src/distrib/notes/common/main
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/doc/CHANGES-7.1.1
cvs rdiff -u -r1.2.52.2 -r1.2.52.2.2.1 src/doc/LAST_MINUTE
cvs rdiff -u -r1.75.4.5.2.1 -r1.75.4.5.2.2 \
src/gnu/usr.bin/groff/tmac/mdoc.local
cvs rdiff -u -r1.459.2.10.2.1 -r1.459.2.10.2.2 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/tests/lib/libc/sys

2017-12-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Dec 22 17:35:14 UTC 2017

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

Log Message:
ptrace atf: Clanup reports of failures

Mark resume* suspend* tests as expected failure and link with PR 51995.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.16 src/tests/lib/libc/sys/t_ptrace_wait.c:1.17
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.16	Thu Dec 21 09:56:47 2017
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Dec 22 17:35:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.16 2017/12/21 09:56:47 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.17 2017/12/22 17:35:14 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.16 2017/12/21 09:56:47 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.17 2017/12/22 17:35:14 kamil Exp $");
 
 #include 
 #include 
@@ -7063,6 +7063,9 @@ ATF_TC_BODY(suspend1, tc)
 	struct ptrace_siginfo psi;
 	volatile int go = 0;
 
+	// Feature pending for refactoring
+	atf_tc_expect_fail("PR kern/51995");
+
 	// Hangs with qemu
 	ATF_REQUIRE(0 && "In order to get reliable failure, abort");
 
@@ -7187,6 +7190,9 @@ ATF_TC_BODY(suspend2, tc)
 #endif
 	struct ptrace_siginfo psi;
 
+	// Feature pending for refactoring
+	atf_tc_expect_fail("PR kern/51995");
+
 	// Hangs with qemu
 	ATF_REQUIRE(0 && "In order to get reliable failure, abort");
 
@@ -7264,8 +7270,9 @@ ATF_TC_BODY(resume1, tc)
 	struct ptrace_lwpinfo pl;
 	struct ptrace_siginfo psi;
 
-	// Times out
-	atf_tc_expect_timeout("PR kern/51995");
+	// Feature pending for refactoring
+	atf_tc_expect_fail("PR kern/51995");
+
 	// Hangs with qemu
 	ATF_REQUIRE(0 && "In order to get reliable failure, abort");
 



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

2017-12-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Dec 22 17:35:14 UTC 2017

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

Log Message:
ptrace atf: Clanup reports of failures

Mark resume* suspend* tests as expected failure and link with PR 51995.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 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.



Re: CVS commit: src/sys/kern

2017-12-22 Thread Kamil Rytarowski
On 22.12.2017 17:58, Robert Elz wrote:
> Date:Fri, 22 Dec 2017 23:35:12 +0700
> From:Robert Elz 
> Message-ID:  <19521.1513960...@andromeda.noi.kre.to>
> 
>   | The EFAULT that is returned there is probably the one Kamil mentioned.
> 
> And of course it is, as in the test ...
> 
>   if ((p != curproc && (p->p_sflag & PS_WEXIT) != 0) ||
> 
> (the || alternative is irrelevant, even though it is XXX'd) as
> we know p != curproc (this is ptrace I/O - the process whose addr
> space is being written is not the process doing the sys call
> "What never?   Well, hardly ever...")  and nor is that process usually
> exiting (too late to modify it then) - so for ptrace() that test
> is more or less guaranteed true - which leads to the EFAULT.
> 
> kre
> 

Thank you for the investigation!

I'm cleaning up now the status of the existing tests and be back to to
proper fix for PT_READ/WRITE_I/D.



signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/sys/kern

2017-12-22 Thread Robert Elz
Date:Fri, 22 Dec 2017 23:35:12 +0700
From:Robert Elz 
Message-ID:  <19521.1513960...@andromeda.noi.kre.to>

  | The EFAULT that is returned there is probably the one Kamil mentioned.

And of course it is, as in the test ...

if ((p != curproc && (p->p_sflag & PS_WEXIT) != 0) ||

(the || alternative is irrelevant, even though it is XXX'd) as
we know p != curproc (this is ptrace I/O - the process whose addr
space is being written is not the process doing the sys call
"What never?   Well, hardly ever...")  and nor is that process usually
exiting (too late to modify it then) - so for ptrace() that test
is more or less guaranteed true - which leads to the EFAULT.

kre



Re: CVS commit: src/sys/kern

2017-12-22 Thread Robert Elz
Date:Fri, 22 Dec 2017 23:22:37 +0700
From:Robert Elz 
Message-ID:  <1080.1513959...@andromeda.noi.kre.to>

  | where vm was declared as
  | 
  | struct vmspace *vm;
  | 
  | but is not otherwise initialised

Well, not quite, I missed this call in ptrce_doio()

error = proc_vmspace_getref(l->l_proc, vm);

where proc_vmspace_getref() is ...

if ((p != curproc && (p->p_sflag & PS_WEXIT) != 0) ||
(p->p_vmspace->vm_refcnt < 1)) { /* XXX */
return EFAULT;
}

uvmspace_addref(p->p_vmspace);
*vm = p->p_vmspace;

which is much more complex than the old (and now current way) which
more or less boils down to

*vm = proc0.p_vmspace;

(except there is no vm to * ... bt for easier comparison.)

The EFAULT that is returned there is probably the one Kamil mentioned.

kre




Re: CVS commit: src/sys/kern

2017-12-22 Thread Robert Elz
Date:Fri, 22 Dec 2017 15:02:57 +
From:"Kamil Rytarowski" 
Message-ID:  <20171222150257.8e519f...@cvs.netbsd.org>

  | ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands
  | 
  | The refactored code did not work and was generating EFAULT.

The only difference I see between the two (aside from an
#if defined(__HAVE_RAS)
which exists in the current version and is missing in the previous)
is that the earlier one is missing

UIO_SETUP_SYSSPACE();

and consequently is not initialising uio->uio_vmspace (or not
the same way, or properly) - the refactored code does

uio.uio_vmspace = *vm;

where vm is the final (6th) param to ptrace_doic() which it calls as

if ((error = ptrace_doio(l, t, lt, , addr, )) != 0)

where vm was declared as

struct vmspace *vm;

but is not otherwise initialised - fix this and the refactored code
would probably work.

kre



CVS commit: src/sys/kern

2017-12-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Dec 22 15:02:57 UTC 2017

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

Log Message:
ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/sys_ptrace_common.c

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



CVS commit: src/sys/kern

2017-12-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Dec 22 15:02:57 UTC 2017

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

Log Message:
ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/kern/sys_ptrace_common.c

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

Modified files:

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.29 src/sys/kern/sys_ptrace_common.c:1.30
--- src/sys/kern/sys_ptrace_common.c:1.29	Sun Dec 17 20:59:27 2017
+++ src/sys/kern/sys_ptrace_common.c	Fri Dec 22 15:02:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.29 2017/12/17 20:59:27 christos Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.30 2017/12/22 15:02:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.29 2017/12/17 20:59:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.30 2017/12/22 15:02:57 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -972,6 +972,8 @@ do_ptrace(struct ptrace_methods *ptm, st
 	struct lwp *lt = NULL;
 	struct lwp *lt2;
 	struct proc *t;/* target process */
+	struct uio uio;
+	struct iovec iov;
 	struct ptrace_io_desc piod;
 	struct vmspace *vm;
 	int error, write, tmp, pheld;
@@ -1032,20 +1034,34 @@ do_ptrace(struct ptrace_methods *ptm, st
 
 	case PT_WRITE_I:		/* XXX no separate I and D spaces */
 	case PT_WRITE_D:
+#if defined(__HAVE_RAS)
+		/*
+		 * Can't write to a RAS
+		 */
+		if (ras_lookup(t, addr) != (void *)-1) {
+			error = EACCES;
+			break;
+		}
+#endif
 		write = 1;
 		tmp = data;
 		/* FALLTHROUGH */
 	case PT_READ_I:			/* XXX no separate I and D spaces */
 	case PT_READ_D:
-		piod.piod_addr = 
-		piod.piod_len = sizeof(tmp);
-		piod.piod_offs = addr;
-		piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D;
-		if ((error = ptrace_doio(l, t, lt, , addr, )) != 0)
-			break;
+		/* write = 0 done above. */
+		iov.iov_base = (void *)
+		iov.iov_len = sizeof(tmp);
+		uio.uio_iov = 
+		uio.uio_iovcnt = 1;
+		uio.uio_offset = (off_t)(unsigned long)addr;
+		uio.uio_resid = sizeof(tmp);
+		uio.uio_rw = write ? UIO_WRITE : UIO_READ;
+		UIO_SETUP_SYSSPACE();
+
+		error = process_domem(l, lt, );
+
 		if (!write)
 			*retval = tmp;
-		uvmspace_free(vm);
 		break;
 
 	case PT_IO:



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:41:55 UTC 2017

Modified Files:
src/sys/dev/usb: uslsa.c

Log Message:
missing comma 


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/uslsa.c

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



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:41:55 UTC 2017

Modified Files:
src/sys/dev/usb: uslsa.c

Log Message:
missing comma 


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/usb/uslsa.c

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

Modified files:

Index: src/sys/dev/usb/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.24 src/sys/dev/usb/uslsa.c:1.25
--- src/sys/dev/usb/uslsa.c:1.24	Fri Dec 22 14:13:55 2017
+++ src/sys/dev/usb/uslsa.c	Fri Dec 22 14:41:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.24 2017/12/22 14:13:55 jakllsch Exp $ */
+/* $NetBSD: uslsa.c,v 1.25 2017/12/22 14:41:55 jakllsch Exp $ */
 
 /* from ugensa.c */
 
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.24 2017/12/22 14:13:55 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.25 2017/12/22 14:41:55 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -143,7 +143,7 @@ static const struct usb_devno uslsa_devs
 { USB_VENDOR_SILABS,USB_PRODUCT_SILABS_CP210X_2 },
 { USB_VENDOR_SILABS,USB_PRODUCT_SILABS_SUNNTO },
 { USB_VENDOR_SILABS2,   USB_PRODUCT_SILABS2_DCU11CLONE },
-{ USB_VENDOR_USI,   USB_PRODUCT_USI_MC60 }
+{ USB_VENDOR_USI,   USB_PRODUCT_USI_MC60 },
 	{ USB_VENDOR_WMR,		USB_PRODUCT_WMR_RIGBLASTER },
 };
 



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:18:30 UTC 2017

Modified Files:
src/sys/dev/usb: uftdi.c

Log Message:
Add RT Systems RTS-03


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/uftdi.c

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



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:18:30 UTC 2017

Modified Files:
src/sys/dev/usb: uftdi.c

Log Message:
Add RT Systems RTS-03


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/uftdi.c

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

Modified files:

Index: src/sys/dev/usb/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.65 src/sys/dev/usb/uftdi.c:1.66
--- src/sys/dev/usb/uftdi.c:1.65	Tue May 30 20:26:26 2017
+++ src/sys/dev/usb/uftdi.c	Fri Dec 22 14:18:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.65 2017/05/30 20:26:26 jnemeth Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.66 2017/12/22 14:18:29 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.65 2017/05/30 20:26:26 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.66 2017/12/22 14:18:29 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -166,6 +166,7 @@ static const struct usb_devno uftdi_devs
 	{ USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1 },
 	{ USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60F },
 	{ USB_VENDOR_RTSYS, USB_PRODUCT_RTSYS_CT57A },
+	{ USB_VENDOR_RTSYS, USB_PRODUCT_RTSYS_RTS03 },
 	{ USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_USBSERIAL },
 	{ USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_SEAPORT4P1 },
 	{ USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_SEAPORT4P2 },



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:13:55 UTC 2017

Modified Files:
src/sys/dev/usb: uslsa.c

Log Message:
Add West Mountain Radio RIGblaster.  From OpenBSD uslcom(4).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/uslsa.c

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

Modified files:

Index: src/sys/dev/usb/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.23 src/sys/dev/usb/uslsa.c:1.24
--- src/sys/dev/usb/uslsa.c:1.23	Fri Dec 16 14:56:34 2016
+++ src/sys/dev/usb/uslsa.c	Fri Dec 22 14:13:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.23 2016/12/16 14:56:34 maya Exp $ */
+/* $NetBSD: uslsa.c,v 1.24 2017/12/22 14:13:55 jakllsch Exp $ */
 
 /* from ugensa.c */
 
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.23 2016/12/16 14:56:34 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.24 2017/12/22 14:13:55 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -144,6 +144,7 @@ static const struct usb_devno uslsa_devs
 { USB_VENDOR_SILABS,USB_PRODUCT_SILABS_SUNNTO },
 { USB_VENDOR_SILABS2,   USB_PRODUCT_SILABS2_DCU11CLONE },
 { USB_VENDOR_USI,   USB_PRODUCT_USI_MC60 }
+	{ USB_VENDOR_WMR,		USB_PRODUCT_WMR_RIGBLASTER },
 };
 
 static int uslsa_match(device_t, cfdata_t, void *);



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:13:55 UTC 2017

Modified Files:
src/sys/dev/usb: uslsa.c

Log Message:
Add West Mountain Radio RIGblaster.  From OpenBSD uslcom(4).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/usb/uslsa.c

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



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:06:40 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.736 -r1.737 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/usb/usbdevs_data.h

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



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:03:39 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add West Mountain Radio IDs from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.744 -r1.745 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 14:03:39 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add West Mountain Radio IDs from OpenBSD


To generate a diff of this commit:
cvs rdiff -u -r1.744 -r1.745 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.744 src/sys/dev/usb/usbdevs:1.745
--- src/sys/dev/usb/usbdevs:1.744	Fri Dec 22 13:59:32 2017
+++ src/sys/dev/usb/usbdevs	Fri Dec 22 14:03:39 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.744 2017/12/22 13:59:32 jakllsch Exp $
+$NetBSD: usbdevs,v 1.745 2017/12/22 14:03:39 jakllsch Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -562,6 +562,7 @@ vendor MOTOROLA2	0x22b8	Motorola
 vendor PINNACLE		0x2304	Pinnacle Systems
 vendor ARDUINO		0x2341	Arduino SA
 vendor TPLINK		0x2357	TP-Link
+vendor WMR		0x2405	West Mountain Radio
 vendor TRIPPLITE	0x2478	Tripp-Lite
 vendor HIROSE		0x2631	Hirose Electric
 vendor NHJ		0x2770	NHJ
@@ -3413,6 +3414,9 @@ product WACOM CTH690K0		0x033e	Intuos Ar
 /* Weltrend Semiconductor */
 product WELTREND HID		0x2201	HID Device
 
+/* West Mountain Radio products */
+product WMR RIGBLASTER		0x0003	RIGblaster
+
 /* Western Digital products */
 product WESTERN EXTHDD		0x0400	External HDD
 



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 13:59:32 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add RT Systems RTS-03 USB to Serial Adapter


To generate a diff of this commit:
cvs rdiff -u -r1.743 -r1.744 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.743 src/sys/dev/usb/usbdevs:1.744
--- src/sys/dev/usb/usbdevs:1.743	Tue Oct 31 00:20:51 2017
+++ src/sys/dev/usb/usbdevs	Fri Dec 22 13:59:32 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.743 2017/10/31 00:20:51 khorben Exp $
+$NetBSD: usbdevs,v 1.744 2017/12/22 13:59:32 jakllsch Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -2840,6 +2840,7 @@ product ROLAND UMONE		0x012a	UM-ONE MIDI
 product ROLAND QUADCAPTURE	0x012f	QUAD-CAPTURE
 
 /* RT Systems products */
+product RTSYS RTS03		0x9100	RTS-03
 product RTSYS CT57A		0x9e51	CT57A Radio Cable
 
 /* Sagem products */



CVS commit: src/sys/dev/usb

2017-12-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Fri Dec 22 13:59:32 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add RT Systems RTS-03 USB to Serial Adapter


To generate a diff of this commit:
cvs rdiff -u -r1.743 -r1.744 src/sys/dev/usb/usbdevs

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



CVS commit: src/sys/dev/pci

2017-12-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 22 13:58:12 UTC 2017

Modified Files:
src/sys/dev/pci: pcscp.c

Log Message:
Update a URL of Am53c974A technical manual.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/pcscp.c

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

Modified files:

Index: src/sys/dev/pci/pcscp.c
diff -u src/sys/dev/pci/pcscp.c:1.47 src/sys/dev/pci/pcscp.c:1.48
--- src/sys/dev/pci/pcscp.c:1.47	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/pcscp.c	Fri Dec 22 13:58:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcscp.c,v 1.47 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: pcscp.c,v 1.48 2017/12/22 13:58:11 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -35,11 +35,11 @@
  * written by Izumi Tsutsui 
  *
  * Technical manual available at
- * http://www.amd.com/files/connectivitysolutions/networking/archivednetworking/19113.pdf
+ * http://support.amd.com/TechDocs/19113.pdf
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcscp.c,v 1.47 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcscp.c,v 1.48 2017/12/22 13:58:11 tsutsui Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/pci

2017-12-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 22 13:58:12 UTC 2017

Modified Files:
src/sys/dev/pci: pcscp.c

Log Message:
Update a URL of Am53c974A technical manual.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/pcscp.c

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



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

2017-12-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 22 13:39:57 UTC 2017

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

Log Message:
Fix typo in phy-handle property name


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_emac.c

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



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

2017-12-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 22 13:39:57 UTC 2017

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

Log Message:
Fix typo in phy-handle property name


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/sunxi/sunxi_emac.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.11 src/sys/arch/arm/sunxi/sunxi_emac.c:1.12
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.11	Fri Dec  1 17:47:51 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Fri Dec 22 13:39:57 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.11 2017/12/01 17:47:51 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.12 2017/12/22 13:39:57 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.11 2017/12/01 17:47:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.12 2017/12/22 13:39:57 jmcneill Exp $");
 
 #include 
 #include 
@@ -1327,7 +1327,7 @@ sunxi_emac_get_resources(struct sunxi_em
 	}
 	sc->rst_ephy = fdtbus_reset_get(phandle, "ephy");
 	if (sc->rst_ephy == NULL) {
-		int phy_phandle = fdtbus_get_phandle(phandle, "phy-phandle");
+		int phy_phandle = fdtbus_get_phandle(phandle, "phy-handle");
 		if (phy_phandle != -1)
 			sc->rst_ephy = fdtbus_reset_get_index(phy_phandle, 0);
 	}



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

2017-12-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 22 13:27:29 UTC 2017

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-m1.dts

Log Message:
Enable emac for NanoPi M1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts

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/dts/sun8i-h3-nanopi-m1.dts
diff -u src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts:1.1 src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts:1.2
--- src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts:1.1	Fri Dec 22 00:56:44 2017
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts	Fri Dec 22 13:27:29 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3-nanopi-m1.dts,v 1.1 2017/12/22 00:56:44 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3-nanopi-m1.dts,v 1.2 2017/12/22 13:27:29 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,3 +28,10 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h3-nanopi-m1.dts"
 #include "sun8i-h3.dtsi"
+
+ {
+	phy-handle = <_mii_phy>;
+	phy-mode = "mii";
+	allwinner,leds-active-low;
+	status = "okay";
+};



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

2017-12-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Dec 22 13:27:29 UTC 2017

Modified Files:
src/sys/arch/arm/dts: sun8i-h3-nanopi-m1.dts

Log Message:
Enable emac for NanoPi M1


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-m1.dts

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



CVS commit: src/sys/netinet

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 11:22:37 UTC 2017

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

Log Message:
Fix usage of curlwp_bind in ip_output

curlwp_bindx must be called in LIFO order, i.e., we can't call curlwp_bind
and curlwp_bindx like this:
  bound1 = curlwp_bind();
  bound2 = curlwp_bind();
  curlwp_bindx(bound1);
  curlwp_bindx(bound2);

ip_outout did so if NET_MPSAFE. Fix it.


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/ip_output.c

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

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.287 src/sys/netinet/ip_output.c:1.288
--- src/sys/netinet/ip_output.c:1.287	Fri Dec 15 04:03:46 2017
+++ src/sys/netinet/ip_output.c	Fri Dec 22 11:22:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.287 2017/12/15 04:03:46 ozaki-r Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.288 2017/12/22 11:22:37 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.287 2017/12/15 04:03:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.288 2017/12/22 11:22:37 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -303,6 +303,10 @@ ip_output(struct mbuf *m0, struct mbuf *
 	!in_hosteq(dst->sin_addr, ip->ip_dst)))
 		rtcache_free(ro);
 
+	/* XXX must be before rtcache operations */
+	bound = curlwp_bind();
+	bind_need_restore = true;
+
 	if ((rt = rtcache_validate(ro)) == NULL &&
 	(rt = rtcache_update(ro, 1)) == NULL) {
 		dst = 
@@ -311,8 +315,6 @@ ip_output(struct mbuf *m0, struct mbuf *
 			goto bad;
 	}
 
-	bound = curlwp_bind();
-	bind_need_restore = true;
 	/*
 	 * If routing to interface only, short circuit routing lookup.
 	 */



CVS commit: src/sys/netinet

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 11:22:37 UTC 2017

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

Log Message:
Fix usage of curlwp_bind in ip_output

curlwp_bindx must be called in LIFO order, i.e., we can't call curlwp_bind
and curlwp_bindx like this:
  bound1 = curlwp_bind();
  bound2 = curlwp_bind();
  curlwp_bindx(bound1);
  curlwp_bindx(bound2);

ip_outout did so if NET_MPSAFE. Fix it.


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/sys/netinet/ip_output.c

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



CVS commit: src/sys/sys

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 10:24:49 UTC 2017

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

Log Message:
Check LP_BOUND is surely set in curlwp_bindx

This may find an extra call of curlwp_bindx.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 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/sys

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 10:24:49 UTC 2017

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

Log Message:
Check LP_BOUND is surely set in curlwp_bindx

This may find an extra call of curlwp_bindx.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 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.175 src/sys/sys/lwp.h:1.176
--- src/sys/sys/lwp.h:1.175	Thu Jun  8 01:09:52 2017
+++ src/sys/sys/lwp.h	Fri Dec 22 10:24:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.175 2017/06/08 01:09:52 chs Exp $	*/
+/*	$NetBSD: lwp.h,v 1.176 2017/12/22 10:24:49 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -543,6 +543,8 @@ curlwp_bind(void)
 static inline void
 curlwp_bindx(int bound)
 {
+
+	KASSERT(curlwp->l_pflag & LP_BOUND);
 	curlwp->l_pflag ^= bound ^ LP_BOUND;
 }
 



CVS commit: src/sys/netinet6

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 09:53:06 UTC 2017

Modified Files:
src/sys/netinet6: in6_pcb.c

Log Message:
Add missing curlwp_bindx


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet6/in6_pcb.c

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



CVS commit: src/sys/netinet6

2017-12-22 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec 22 09:53:06 UTC 2017

Modified Files:
src/sys/netinet6: in6_pcb.c

Log Message:
Add missing curlwp_bindx


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/netinet6/in6_pcb.c

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

Modified files:

Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.162 src/sys/netinet6/in6_pcb.c:1.163
--- src/sys/netinet6/in6_pcb.c:1.162	Fri Dec 15 04:03:46 2017
+++ src/sys/netinet6/in6_pcb.c	Fri Dec 22 09:53:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_pcb.c,v 1.162 2017/12/15 04:03:46 ozaki-r Exp $	*/
+/*	$NetBSD: in6_pcb.c,v 1.163 2017/12/22 09:53:06 ozaki-r Exp $	*/
 /*	$KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.162 2017/12/15 04:03:46 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.163 2017/12/22 09:53:06 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -512,6 +512,7 @@ in6_pcbconnect(void *v, struct sockaddr_
 		if (ia4 == NULL) {
 			if (error == 0)
 error = EADDRNOTAVAIL;
+			curlwp_bindx(bound);
 			return (error);
 		}
 		memset(, 0, sizeof(mapped));
@@ -521,6 +522,7 @@ in6_pcbconnect(void *v, struct sockaddr_
 		ia4_release(ia4, &_psref);
 		in6a = 
 #else
+		curlwp_bindx(bound);
 		return EADDRNOTAVAIL;
 #endif
 	} else {