CVS commit: src/sys/dev/isa

2018-01-01 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan  2 00:47:15 UTC 2018

Modified Files:
src/sys/dev/isa: wbsio.c

Log Message:
Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/isa/wbsio.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.20 src/sys/dev/isa/wbsio.c:1.21
--- src/sys/dev/isa/wbsio.c:1.20	Wed Dec 13 00:31:46 2017
+++ src/sys/dev/isa/wbsio.c	Tue Jan  2 00:47:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.20 2017/12/13 00:31:46 knakahara Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.21 2018/01/02 00:47:14 pgoyette Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
@@ -937,7 +937,7 @@ wbsio_wdog_tickle(struct sysmon_wdog *sm
 }
 
 
-MODULE(MODULE_CLASS_DRIVER, wbsio, NULL);
+MODULE(MODULE_CLASS_DRIVER, wbsio, "sysmon_wdog");
 
 #ifdef _MODULE
 #include "ioconf.c"



CVS commit: src/sys/dev/isa

2018-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan  2 00:25:35 UTC 2018

Modified Files:
src/sys/dev/isa: files.isa

Log Message:
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/isa/files.isa

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

Modified files:

Index: src/sys/dev/isa/files.isa
diff -u src/sys/dev/isa/files.isa:1.168 src/sys/dev/isa/files.isa:1.169
--- src/sys/dev/isa/files.isa:1.168	Tue Dec 12 19:26:06 2017
+++ src/sys/dev/isa/files.isa	Mon Jan  1 19:25:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.isa,v 1.168 2017/12/13 00:26:06 knakahara Exp $
+#	$NetBSD: files.isa,v 1.169 2018/01/02 00:25:35 christos Exp $
 #
 # Config file and device description for machine-independent ISA code.
 # Included by ports that need it.  Requires that the SCSI files be
@@ -454,7 +454,7 @@ attach	smsc at isa with smsc
 file	dev/isa/smsc.c			smsc			needs-flag
 
 # Winbond LPC Super I/O
-device	wbsio { }: gpiobus
+device	wbsio { }: gpiobus, sysmon_wdog
 attach	wbsio at isa
 file	dev/isa/wbsio.c			wbsio
 



CVS commit: src/lib/libedit

2018-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  1 22:32:47 UTC 2018

Modified Files:
src/lib/libedit: el.c readline.c tty.c tty.h

Log Message:
Only FLUSH if we are ending libedit; DRAIN if we suspend for readline.
This allows pasting multiline buffers (Gerry Swislow)


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/lib/libedit/el.c
cvs rdiff -u -r1.145 -r1.146 src/lib/libedit/readline.c
cvs rdiff -u -r1.66 -r1.67 src/lib/libedit/tty.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libedit/tty.h

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

Modified files:

Index: src/lib/libedit/el.c
diff -u src/lib/libedit/el.c:1.95 src/lib/libedit/el.c:1.96
--- src/lib/libedit/el.c:1.95	Tue Sep  5 14:07:59 2017
+++ src/lib/libedit/el.c	Mon Jan  1 17:32:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: el.c,v 1.95 2017/09/05 18:07:59 christos Exp $	*/
+/*	$NetBSD: el.c,v 1.96 2018/01/01 22:32:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)el.c	8.2 (Berkeley) 1/3/94";
 #else
-__RCSID("$NetBSD: el.c,v 1.95 2017/09/05 18:07:59 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.96 2018/01/01 22:32:46 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -146,7 +146,7 @@ el_end(EditLine *el)
 	keymacro_end(el);
 	map_end(el);
 	if (!(el->el_flags & NO_TTY))
-		tty_end(el);
+		tty_end(el, TCSAFLUSH);
 	ch_end(el);
 	read_end(el->el_read);
 	search_end(el);

Index: src/lib/libedit/readline.c
diff -u src/lib/libedit/readline.c:1.145 src/lib/libedit/readline.c:1.146
--- src/lib/libedit/readline.c:1.145	Fri Dec  8 11:56:23 2017
+++ src/lib/libedit/readline.c	Mon Jan  1 17:32:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: readline.c,v 1.145 2017/12/08 16:56:23 christos Exp $	*/
+/*	$NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.145 2017/12/08 16:56:23 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.146 2018/01/01 22:32:46 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include 
@@ -388,7 +388,7 @@ rl_initialize(void)
 	_resize_fun(e, _line_buffer);
 	_rl_update_pos();
 
-	tty_end(e);
+	tty_end(e, TCSADRAIN);
 
 	return 0;
 }
@@ -460,7 +460,7 @@ readline(const char *p)
 	history_length = ev.num;
 
 out:
-	tty_end(e);
+	tty_end(e, TCSADRAIN);
 	return buf;
 }
 

Index: src/lib/libedit/tty.c
diff -u src/lib/libedit/tty.c:1.66 src/lib/libedit/tty.c:1.67
--- src/lib/libedit/tty.c:1.66	Tue Sep  5 14:07:59 2017
+++ src/lib/libedit/tty.c	Mon Jan  1 17:32:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.c,v 1.66 2017/09/05 18:07:59 christos Exp $	*/
+/*	$NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)tty.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tty.c,v 1.66 2017/09/05 18:07:59 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.67 2018/01/01 22:32:46 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -586,7 +586,7 @@ tty_init(EditLine *el)
  */
 libedit_private void
 /*ARGSUSED*/
-tty_end(EditLine *el)
+tty_end(EditLine *el, int how)
 {
 	if (el->el_flags & EDIT_DISABLED)
 		return;
@@ -594,7 +594,8 @@ tty_end(EditLine *el)
 	if (!el->el_tty.t_initialized)
 		return;
 
-	if (tty_setty(el, TCSAFLUSH, >el_tty.t_or) == -1) {
+	if (tty_setty(el, how, >el_tty.t_or) == -1)
+	{
 #ifdef DEBUG_TTY
 		(void) fprintf(el->el_errfile,
 		"%s: tty_setty: %s\n", __func__, strerror(errno));

Index: src/lib/libedit/tty.h
diff -u src/lib/libedit/tty.h:1.21 src/lib/libedit/tty.h:1.22
--- src/lib/libedit/tty.h:1.21	Mon May  9 17:46:56 2016
+++ src/lib/libedit/tty.h	Mon Jan  1 17:32:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty.h,v 1.21 2016/05/09 21:46:56 christos Exp $	*/
+/*	$NetBSD: tty.h,v 1.22 2018/01/01 22:32:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -457,7 +457,7 @@ typedef struct {
 typedef unsigned char ttychar_t[NN_IO][C_NCC];
 
 libedit_private int	tty_init(EditLine *);
-libedit_private void	tty_end(EditLine *);
+libedit_private void	tty_end(EditLine *, int);
 libedit_private int	tty_stty(EditLine *, int, const wchar_t **);
 libedit_private int	tty_rawmode(EditLine *);
 libedit_private int	tty_cookedmode(EditLine *);



CVS commit: [netbsd-8] src/doc

2018-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jan  1 19:11:07 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
465, 477


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.96 -r1.1.2.97 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.96 src/doc/CHANGES-8.0:1.1.2.97
--- src/doc/CHANGES-8.0:1.1.2.96	Sat Dec 23 19:56:01 2017
+++ src/doc/CHANGES-8.0	Mon Jan  1 19:11:07 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.96 2017/12/23 19:56:01 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.97 2018/01/01 19:11:07 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -8671,3 +8671,17 @@ sys/dev/pad/pad.c1.44
 	module is built-in to the kernel.
 	[pgoyette, ticket #450]
 
+sys/kern/kern_proc.c1.209
+
+	Fix an easily triggerable kmem_alloc(0).
+	[maxv, ticket #465]
+
+sys/arch/amd64/amd64/machdep.c			1.280
+sys/arch/amd64/include/segments.h		1.34
+sys/arch/i386/i386/machdep.c			1.800
+sys/arch/i386/include/segments.h		1.64 via patch
+sys/arch/x86/x86/vm_machdep.c			1.30
+
+	Xen: Prevent userland from having access to the CPU ports.
+	[maxv, ticket #477]
+



CVS commit: [netbsd-8] src/sys/arch

2018-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jan  1 19:09:04 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: machdep.c
src/sys/arch/amd64/include [netbsd-8]: segments.h
src/sys/arch/i386/i386 [netbsd-8]: machdep.c
src/sys/arch/i386/include [netbsd-8]: segments.h
src/sys/arch/x86/x86 [netbsd-8]: vm_machdep.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #477):
sys/arch/amd64/amd64/machdep.c: revision 1.280
sys/arch/amd64/include/segments.h: revision 1.34
sys/arch/i386/i386/machdep.c: revision 1.800
sys/arch/i386/include/segments.h: revision 1.64 via patch
sys/arch/x86/x86/vm_machdep.c: revision 1.30
Fix a huge privilege separation vulnerability in Xen-amd64.
On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL
equals SEL_UPL. While Xen can make a distinction between usermode and
kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL
in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes
to read and write to the CPU ports.
It is easy, then, to completely escalate privileges; by reprogramming the
PIC, by reading the ATA disks, by intercepting the keyboard interrupts
(keylogger), etc.
Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use
the ports but not userland. I didn't test this change on i386, but it
seems fine enough.


To generate a diff of this commit:
cvs rdiff -u -r1.255.6.2 -r1.255.6.3 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.29 -r1.29.6.1 src/sys/arch/amd64/include/segments.h
cvs rdiff -u -r1.782.6.1 -r1.782.6.2 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.59 -r1.59.6.1 src/sys/arch/i386/include/segments.h
cvs rdiff -u -r1.28 -r1.28.6.1 src/sys/arch/x86/x86/vm_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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.2 src/sys/arch/amd64/amd64/machdep.c:1.255.6.3
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.2	Thu Nov 30 14:03:41 2017
+++ src/sys/arch/amd64/amd64/machdep.c	Mon Jan  1 19:09:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.255.6.2 2017/11/30 14:03:41 martin Exp $	*/
+/*	$NetBSD: machdep.c,v 1.255.6.3 2018/01/01 19:09:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.2 2017/11/30 14:03:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.3 2018/01/01 19:09:03 snj Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -473,7 +473,7 @@ x86_64_proc0_tss_ldt_init(void)
 	pcb->pcb_fs = 0;
 	pcb->pcb_gs = 0;
 	pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + USPACE - 16) & ~0xf;
-	pcb->pcb_iopl = SEL_KPL;
+	pcb->pcb_iopl = IOPL_KPL;
 	pcb->pcb_dbregs = NULL;
 
 	pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL);

Index: src/sys/arch/amd64/include/segments.h
diff -u src/sys/arch/amd64/include/segments.h:1.29 src/sys/arch/amd64/include/segments.h:1.29.6.1
--- src/sys/arch/amd64/include/segments.h:1.29	Sun Feb  5 08:58:39 2017
+++ src/sys/arch/amd64/include/segments.h	Mon Jan  1 19:09:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: segments.h,v 1.29 2017/02/05 08:58:39 maxv Exp $	*/
+/*	$NetBSD: segments.h,v 1.29.6.1 2018/01/01 19:09:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -107,6 +107,12 @@
 #define ISLDT(s)	((s) & SEL_LDT)	/* is it local or global */
 #define SEL_LDT		4		/* local descriptor table */
 
+#ifdef XEN
+#define IOPL_KPL	1
+#else
+#define IOPL_KPL	SEL_KPL
+#endif
+
 /* Dynamically allocated TSSs and LDTs start (byte offset) */
 #define SYSSEL_START	(NGDT_MEM << 3)
 #define DYNSEL_START	(SYSSEL_START + (NGDT_SYS << 4))

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.782.6.1 src/sys/arch/i386/i386/machdep.c:1.782.6.2
--- src/sys/arch/i386/i386/machdep.c:1.782.6.1	Wed Jul  5 19:59:29 2017
+++ src/sys/arch/i386/i386/machdep.c	Mon Jan  1 19:09:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.782.6.1 2017/07/05 19:59:29 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.782.6.2 2018/01/01 19:09:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.782.6.1 2017/07/05 19:59:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.782.6.2 2018/01/01 19:09:03 snj Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -506,7 +506,7 @@ i386_proc0_tss_ldt_init(void)
 	pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL);
 	pcb->pcb_cr0 = rcr0() & ~CR0_TS;
 	pcb->pcb_esp0 = uvm_lwp_getuarea(l) + USPACE - 16;
-	pcb->pcb_iopl = SEL_KPL;
+	pcb->pcb_iopl = IOPL_KPL;
 	l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1;
 	memcpy(>pcb_fsd, [GUDATA_SEL], sizeof(pcb->pcb_fsd));
 	

CVS commit: [netbsd-8] src/sys/kern

2018-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jan  1 18:58:32 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: kern_proc.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #465):
sys/kern/kern_proc.c: revision 1.209
If no auxv is present, don't kmem_alloc(0). Easy to panic the kernel by
typing 'cat /proc/aout_pid/auxv' on whatever a.out binary you're running.
Fortunately, amd64 does not enable EXEC_AOUT by default. Unfortunately,
i386 does enable it by default.


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.206.6.1 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.206 src/sys/kern/kern_proc.c:1.206.6.1
--- src/sys/kern/kern_proc.c:1.206	Thu Mar 30 20:17:11 2017
+++ src/sys/kern/kern_proc.c	Mon Jan  1 18:58:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.206 2017/03/30 20:17:11 christos Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.206.6.1 2018/01/01 18:58:32 snj 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.206 2017/03/30 20:17:11 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.206.6.1 2018/01/01 18:58:32 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2477,16 +2477,19 @@ proc_getauxv(struct proc *p, void **buf,
 	struct ps_strings pss;
 	int error;
 	void *uauxv, *kauxv;
+	size_t size;
 
 	if ((error = copyin_psstrings(p, )) != 0)
 		return error;
-
 	if (pss.ps_envstr == NULL)
 		return EIO;
 
+	size = p->p_execsw->es_arglen;
+	if (size == 0)
+		return EIO;
+
 	size_t ptrsz = PROC_PTRSZ(p);
 	uauxv = (void *)((char *)pss.ps_envstr + (pss.ps_nenvstr + 1) * ptrsz);
-	size_t size = p->p_execsw->es_arglen;
 
 	kauxv = kmem_alloc(size, KM_SLEEP);
 



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

2018-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  1 17:33:23 UTC 2018

Removed Files:
src/sys/arch/evbarm/conf: RPI3

Log Message:
remove this, it was just to compile-test the drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/conf/RPI3

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



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

2018-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  1 17:03:25 UTC 2018

Modified Files:
src/sys/arch/evbarm/rpi: vcprop_subr.c

Log Message:
Remove unnecessary #includE


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/rpi/vcprop_subr.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/evbarm/rpi/vcprop_subr.c
diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.4 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.5
--- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.4	Sun Dec 10 21:38:27 2017
+++ src/sys/arch/evbarm/rpi/vcprop_subr.c	Mon Jan  1 17:03:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vcprop_subr.c,v 1.4 2017/12/10 21:38:27 skrll Exp $	*/
+/*	$NetBSD: vcprop_subr.c,v 1.5 2018/01/01 17:03:25 skrll Exp $	*/
 
 /*
  * Copyright (c) 2014 Michael Lorenz
@@ -35,8 +35,6 @@
 
 #include 
 
-#include 
-
 #include 
 #include 
 #include 



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

2018-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  1 16:28:14 UTC 2018

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

Log Message:
pass the lwp for the register calls.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gdb/dist/gdb/alpha-bsd-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/alpha-bsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.1.1.1 src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.2
--- src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c:1.1.1.1	Tue Nov 28 13:18:23 2017
+++ src/external/gpl3/gdb/dist/gdb/alpha-bsd-nat.c	Mon Jan  1 11:28:14 2018
@@ -92,7 +92,7 @@ alphabsd_fetch_inferior_registers (struc
   struct reg gregs;
 
   if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-		  (PTRACE_TYPE_ARG3) , 0) == -1)
+		  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get registers"));
 
   alphabsd_supply_reg (regcache, (char *) , regno);
@@ -106,7 +106,7 @@ alphabsd_fetch_inferior_registers (struc
   struct fpreg fpregs;
 
   if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-		  (PTRACE_TYPE_ARG3) , 0) == -1)
+		  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
   alphabsd_supply_fpreg (regcache, (char *) , regno);
@@ -124,13 +124,13 @@ alphabsd_store_inferior_registers (struc
 {
   struct reg gregs;
   if (ptrace (PT_GETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-  (PTRACE_TYPE_ARG3) , 0) == -1)
+  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 perror_with_name (_("Couldn't get registers"));
 
   alphabsd_fill_reg (regcache, (char *) , regno);
 
   if (ptrace (PT_SETREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-  (PTRACE_TYPE_ARG3) , 0) == -1)
+  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 perror_with_name (_("Couldn't write registers"));
 
   if (regno != -1)
@@ -143,13 +143,13 @@ alphabsd_store_inferior_registers (struc
   struct fpreg fpregs;
 
   if (ptrace (PT_GETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-		  (PTRACE_TYPE_ARG3) , 0) == -1)
+		  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't get floating point status"));
 
   alphabsd_fill_fpreg (regcache, (char *) , regno);
 
   if (ptrace (PT_SETFPREGS, ptid_get_pid (regcache_get_ptid (regcache)),
-		  (PTRACE_TYPE_ARG3) , 0) == -1)
+		  (PTRACE_TYPE_ARG3) , ptid_get_lwp (inferior_ptid)) == -1)
 	perror_with_name (_("Couldn't write floating point status"));
 }
 }



CVS commit: src/sys/netinet

2018-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  1 16:14:30 UTC 2018

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

Log Message:
Remove comment now that the getsockopt code passes the size.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 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.289 src/sys/netinet/ip_output.c:1.290
--- src/sys/netinet/ip_output.c:1.289	Sun Dec 31 19:51:36 2017
+++ src/sys/netinet/ip_output.c	Mon Jan  1 11:14:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.289 2018/01/01 00:51:36 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.290 2018/01/01 16:14:30 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.289 2018/01/01 00:51:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.290 2018/01/01 16:14:30 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1331,8 +1331,6 @@ ip_ctloutput(int op, struct socket *so, 
 			break;
 
 		case IP_PKTINFO:
-			/* XXX these tests fail until size gets propagated */
-			/* It needs to be passed through from the caller */
 			switch (sopt->sopt_size) {
 			case sizeof(int):
 /* Linux compatibility */



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

2018-01-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jan  1 13:25:22 UTC 2018

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Set and clear IFF_OACTIVE as necessary, and add support for queueing
multiple packets before performing a PKO doorbell write.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/if_cnmac.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/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.8
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.7	Sun Nov 26 18:41:14 2017
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Mon Jan  1 13:25:22 2018
@@ -1,8 +1,8 @@
-/*	$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.8 2018/01/01 13:25:22 jmcneill Exp $	*/
 
 #include 
 #if 0
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.7 2017/11/26 18:41:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.8 2018/01/01 13:25:22 jmcneill Exp $");
 #endif
 
 #include "opt_octeon.h"
@@ -144,7 +144,7 @@ static void	octeon_eth_stop(struct ifnet
 static void	octeon_eth_start(struct ifnet *);
 
 static inline int	octeon_eth_send_cmd(struct octeon_eth_softc *, uint64_t,
-			uint64_t);
+			uint64_t, int *);
 static inline uint64_t	octeon_eth_send_makecmd_w1(int, paddr_t);
 static inline uint64_t 	octeon_eth_send_makecmd_w0(uint64_t, uint64_t, size_t,
 			int);
@@ -153,9 +153,9 @@ static inline int	octeon_eth_send_makecm
 static inline int	octeon_eth_send_makecmd(struct octeon_eth_softc *,
 			struct mbuf *, uint64_t *, uint64_t *, uint64_t *);
 static inline int	octeon_eth_send_buf(struct octeon_eth_softc *,
-			struct mbuf *, uint64_t *);
+			struct mbuf *, uint64_t *, int *);
 static inline int	octeon_eth_send(struct octeon_eth_softc *,
-			struct mbuf *);
+			struct mbuf *, int *);
 
 static int	octeon_eth_reset(struct octeon_eth_softc *);
 static int	octeon_eth_configure(struct octeon_eth_softc *);
@@ -615,6 +615,7 @@ octeon_eth_send_queue_flush_fetch(struct
 static inline void
 octeon_eth_send_queue_flush(struct octeon_eth_softc *sc)
 {
+	struct ifnet *ifp = >sc_ethercom.ec_if;
 	const int64_t sent_count = sc->sc_hard_done_cnt;
 	int i;
 
@@ -631,6 +632,8 @@ octeon_eth_send_queue_flush(struct octeo
 		OCTEON_EVCNT_INC(sc, txbufgbput);
 
 		m_freem(m);
+
+		CLR(ifp->if_flags, IFF_OACTIVE);
 	}
 
 	octeon_fau_op_inc_fetch_8(>sc_fau_done, i);
@@ -972,7 +975,7 @@ done:
 
 static inline int
 octeon_eth_send_cmd(struct octeon_eth_softc *sc, uint64_t pko_cmd_w0,
-uint64_t pko_cmd_w1)
+uint64_t pko_cmd_w1, int *pwdc)
 {
 	uint64_t *cmdptr;
 	int result = 0;
@@ -1011,7 +1014,7 @@ octeon_eth_send_cmd(struct octeon_eth_so
 		sc->sc_cmdptr.cmdptr_idx += 2;
 	}
 
-	octeon_pko_op_doorbell_write(sc->sc_port, sc->sc_port, 2);
+	*pwdc += 2;
 
 done:
 	return result;
@@ -1019,7 +1022,7 @@ done:
 
 static inline int
 octeon_eth_send_buf(struct octeon_eth_softc *sc, struct mbuf *m,
-uint64_t *gbuf)
+uint64_t *gbuf, int *pwdc)
 {
 	int result = 0, error;
 	uint64_t pko_cmd_w0, pko_cmd_w1;
@@ -1032,7 +1035,7 @@ octeon_eth_send_buf(struct octeon_eth_so
 		goto done;
 	}
 
-	error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1);
+	error = octeon_eth_send_cmd(sc, pko_cmd_w0, pko_cmd_w1, pwdc);
 	if (error != 0) {
 		/* already logging */
 		OCTEON_EVCNT_INC(sc, txerrcmd);
@@ -1044,7 +1047,7 @@ done:
 }
 
 static inline int
-octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m)
+octeon_eth_send(struct octeon_eth_softc *sc, struct mbuf *m, int *pwdc)
 {
 	paddr_t gaddr = 0;
 	uint64_t *gbuf = NULL;
@@ -1072,7 +1075,7 @@ octeon_eth_send(struct octeon_eth_softc 
 
 	OCTEON_ETH_KASSERT(gbuf != NULL);
 
-	error = octeon_eth_send_buf(sc, m, gbuf);
+	error = octeon_eth_send_buf(sc, m, gbuf, pwdc);
 	if (error != 0) {
 		/* already logging */
 		octeon_fpa_buf_put_paddr(octeon_eth_fb_sg, gaddr);
@@ -1092,6 +1095,7 @@ octeon_eth_start(struct ifnet *ifp)
 {
 	struct octeon_eth_softc *sc = ifp->if_softc;
 	struct mbuf *m;
+	int wdc = 0;
 
 	/*
 	 * performance tuning
@@ -1130,6 +1134,10 @@ octeon_eth_start(struct ifnet *ifp)
 		 * and bail out.
 		 */
 		if (octeon_eth_send_queue_is_full(sc)) {
+			SET(ifp->if_flags, IFF_OACTIVE);
+			if (wdc > 0)
+octeon_pko_op_doorbell_write(sc->sc_port,
+sc->sc_port, wdc);
 			return;
 		}
 		/* XXX XXX XXX */
@@ -1141,7 +1149,7 @@ octeon_eth_start(struct ifnet *ifp)
 		/* XXX XXX XXX */
 		if (sc->sc_soft_req_cnt > sc->sc_soft_req_thresh)
 			octeon_eth_send_queue_flush(sc);
-		if (octeon_eth_send(sc, m)) {
+		if (octeon_eth_send(sc, m, )) {
 			IF_DROP(>if_snd);
 			m_freem(m);
 			log(LOG_WARNING,
@@ -1161,6 +1169,9 @@ octeon_eth_start(struct ifnet *ifp)
 		octeon_eth_send_queue_flush_prefetch(sc);
 	}
 
+	if (wdc > 0)
+		

CVS commit: src/share/man/man9

2018-01-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan  1 12:46:50 UTC 2018

Modified Files:
src/share/man/man9: mbuf.9

Log Message:
Remove trailing comma from SYNOPSIS.
Try improving markup.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/share/man/man9/mbuf.9

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

Modified files:

Index: src/share/man/man9/mbuf.9
diff -u src/share/man/man9/mbuf.9:1.52 src/share/man/man9/mbuf.9:1.53
--- src/share/man/man9/mbuf.9:1.52	Mon Jan  1 12:36:26 2018
+++ src/share/man/man9/mbuf.9	Mon Jan  1 12:46:49 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mbuf.9,v 1.52 2018/01/01 12:36:26 maxv Exp $
+.\"	$NetBSD: mbuf.9,v 1.53 2018/01/01 12:46:49 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -66,7 +66,7 @@
 .Nm M_LEADINGSPACE ,
 .Nm M_TRAILINGSPACE ,
 .Nm M_PREPEND ,
-.Nm MCHTYPE ,
+.Nm MCHTYPE
 .Nd "functions and macros for managing memory used by networking code"
 .Sh SYNOPSIS
 .In sys/mbuf.h
@@ -303,7 +303,7 @@ from caller.
 .It Fn m_copypacket "struct mbuf *m" "int how"
 Copies an entire packet, including header (which must be present).
 This function is an optimization of the common case
-.Li m_copym(m, 0, Dv M_COPYALL, Fa how ) .
+.Li m_copym ( m , 0 , Dv M_COPYALL , Fa how ) .
 .It Fn m_copydata "struct mbuf *m" "int off" "int len" "void *cp"
 Copies
 .Fa len



CVS commit: src/share/man/man4

2018-01-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jan  1 12:45:07 UTC 2018

Modified Files:
src/share/man/man4: ip.4

Log Message:
Use more markup.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/share/man/man4/ip.4

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

Modified files:

Index: src/share/man/man4/ip.4
diff -u src/share/man/man4/ip.4:1.42 src/share/man/man4/ip.4:1.43
--- src/share/man/man4/ip.4:1.42	Mon Jan  1 01:02:11 2018
+++ src/share/man/man4/ip.4	Mon Jan  1 12:45:07 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ip.4,v 1.42 2018/01/01 01:02:11 christos Exp $
+.\"	$NetBSD: ip.4,v 1.43 2018/01/01 12:45:07 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -126,7 +126,9 @@ or
 socket.
 Setting ipi_ifindex will cause the primary address of that interface
 to be used; setting ipi_addr will directly choose that address.
-The IP_PKTINFO cmsghdr structure from a received message may be
+The
+.Dv IP_PKTINFO
+cmsghdr structure from a received message may be
 used unchanged, in which case the outgoing message will be sent
 from the address the incoming message was received on.
 .Pp
@@ -198,7 +200,9 @@ to the control part of the message on a
 or
 .Dv SOCK_RAW
 socket.
-The IP_RECVDSTADDR cmsghdr structure from a received message may
+The
+.Dv IP_RECVDSTADDR
+cmsghdr structure from a received message may
 be used unchanged, in which case the outgoing message will be sent
 from the address the incoming message was received on.
 .Pp



CVS commit: src/share/man/man9

2018-01-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan  1 12:36:26 UTC 2018

Modified Files:
src/share/man/man9: mbuf.9

Log Message:
Remove MFREE.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/share/man/man9/mbuf.9

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

Modified files:

Index: src/share/man/man9/mbuf.9
diff -u src/share/man/man9/mbuf.9:1.51 src/share/man/man9/mbuf.9:1.52
--- src/share/man/man9/mbuf.9:1.51	Mon Jun 17 09:58:21 2013
+++ src/share/man/man9/mbuf.9	Mon Jan  1 12:36:26 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mbuf.9,v 1.51 2013/06/17 09:58:21 ryo Exp $
+.\"	$NetBSD: mbuf.9,v 1.52 2018/01/01 12:36:26 maxv Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 17, 2013
+.Dd January 1, 2018
 .Dt MBUF 9
 .Os
 .Sh NAME
@@ -67,7 +67,6 @@
 .Nm M_TRAILINGSPACE ,
 .Nm M_PREPEND ,
 .Nm MCHTYPE ,
-.Nm MFREE
 .Nd "functions and macros for managing memory used by networking code"
 .Sh SYNOPSIS
 .In sys/mbuf.h
@@ -141,8 +140,6 @@
 .Fn M_PREPEND "struct mbuf *m" "int plen" "int how"
 .Ft void
 .Fn MCHTYPE "struct mbuf *m" "int type"
-.Ft void
-.Fn MFREE "struct mbuf *m" "struct mbuf *n"
 .Sh DESCRIPTION
 The
 .Nm
@@ -730,12 +727,6 @@ Change mbuf
 to new type
 .Fa type .
 Implemented as a macro.
-.It Fn MFREE "struct mbuf *m" "struct mbuf *n"
-Frees a single mbuf
-.Fa m
-and places the successor, if any, in mbuf
-.Fa n .
-Implemented as a macro.
 .El
 .Sh CODE REFERENCES
 The



CVS commit: src/sys/kern

2018-01-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan  1 12:22:59 UTC 2018

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

Log Message:
Detect use-after-frees on mbufs with external storage, too. This is done
even when the refcount is > 1.

Again, this code is enabled by default, because it is fast and quite
useful.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.175 src/sys/kern/uipc_mbuf.c:1.176
--- src/sys/kern/uipc_mbuf.c:1.175	Mon Jan  1 12:09:56 2018
+++ src/sys/kern/uipc_mbuf.c	Mon Jan  1 12:22:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.175 2018/01/01 12:09:56 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.176 2018/01/01 12:22:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.175 2018/01/01 12:09:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.176 2018/01/01 12:22:59 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1687,6 +1687,10 @@ m_ext_free(struct mbuf *m)
 	KASSERT((m->m_flags & M_EXT_CLUSTER) ==
 	(m->m_ext_ref->m_flags & M_EXT_CLUSTER));
 
+	if (__predict_false(m->m_type == MT_FREE)) {
+		panic("mbuf %p already freed", m);
+	}
+
 	if (__predict_true(m->m_ext.ext_refcnt == 1)) {
 		refcnt = m->m_ext.ext_refcnt = 0;
 	} else {
@@ -1727,6 +1731,7 @@ m_ext_free(struct mbuf *m)
 	}
 	if (dofree) {
 		m->m_type = MT_FREE;
+		m->m_data = NULL;
 		pool_cache_put(mb_cache, m);
 	}
 }



CVS commit: src/sys

2018-01-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan  1 12:09:56 UTC 2018

Modified Files:
src/sys/kern: uipc_mbuf.c
src/sys/sys: mbuf.h

Log Message:
Don't use macros, rather inline, much clearer.

For the record, I was partly mistaken in my previous commit: even though
the macros were local, the function names were still the ones of the real
callers.

However, setting the name in m_data was not a good thing; this was a
valid pointer, and the kernel could execute a long time before figuring
out the mbuf was already freed - therefore making debugging more difficult.
And information on the caller can be obtained via ddb anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/kern/uipc_mbuf.c
cvs rdiff -u -r1.172 -r1.173 src/sys/sys/mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.174 src/sys/kern/uipc_mbuf.c:1.175
--- src/sys/kern/uipc_mbuf.c:1.174	Sun Dec 31 06:57:12 2017
+++ src/sys/kern/uipc_mbuf.c	Mon Jan  1 12:09:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.174 2017/12/31 06:57:12 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.175 2018/01/01 12:09:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.174 2017/12/31 06:57:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.175 2018/01/01 12:09:56 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -1916,66 +1916,42 @@ m_claim(struct mbuf *m, struct mowner *m
 #endif /* defined(MBUFTRACE) */
 
 /*
- * MFREE(struct mbuf *m, struct mbuf *n)
- * Free a single mbuf and associated external storage.
- * Place the successor, if any, in n.
- */
-#define	MFREE(f, l, m, n)		\
-	mowner_revoke((m), 1, (m)->m_flags);\
-	mbstat_type_add((m)->m_type, -1);\
-	if ((m)->m_flags & M_PKTHDR)	\
-		m_tag_delete_chain((m), NULL);\
-	(n) = (m)->m_next;		\
-	if ((m)->m_flags & M_EXT) {	\
-		m_ext_free((m));	\
-	} else {			\
-		MBUFFREE(f, l, m);	\
-	}\
-
-#define MBUFFREE(f, l, m)		\
-	do {\
-		if (__predict_false((m)->m_type == MT_FREE)) {		\
-			panic("mbuf %p already freed", m);		\
-		}			\
-		(m)->m_type = MT_FREE;	\
-		(m)->m_data = NULL;	\
-		pool_cache_put(mb_cache, (m));\
-	} while (/*CONSTCOND*/0)
-
+ * Free a single mbuf and associated external storage. Return the
+ * successor, if any.
+ */
 struct mbuf *
-m__free(const char *f, int l, struct mbuf *m)
+m_free(struct mbuf *m)
 {
 	struct mbuf *n;
 
-	MFREE(f, l, m, n);
-	return (n);
-}
+	mowner_revoke(m, 1, m->m_flags);
+	mbstat_type_add(m->m_type, -1);
 
-void
-m__freem(const char *f, int l, struct mbuf *m)
-{
-	struct mbuf *n;
+	if (m->m_flags & M_PKTHDR)
+		m_tag_delete_chain(m, NULL);
 
-	if (m == NULL)
-		return;
-	do {
-		MFREE(f, l, m, n);
-		m = n;
-	} while (m);
-}
+	n = m->m_next;
 
-#undef m_free
-struct mbuf *m_free(struct mbuf *);
-struct mbuf *
-m_free(struct mbuf *m)
-{
-	return m__free(__func__, __LINE__, m);
+	if (m->m_flags & M_EXT) {
+		m_ext_free(m);
+	} else {
+		if (__predict_false(m->m_type == MT_FREE)) {
+			panic("mbuf %p already freed", m);
+		}
+		m->m_type = MT_FREE;
+		m->m_data = NULL;
+		pool_cache_put(mb_cache, m);
+	}
+
+	return n;
 }
 
-#undef m_freem
-void m_freem(struct mbuf *);
 void
 m_freem(struct mbuf *m)
 {
-	m__freem(__func__, __LINE__, m);
+	if (m == NULL)
+		return;
+	do {
+		m = m_free(m);
+	} while (m);
 }

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.172 src/sys/sys/mbuf.h:1.173
--- src/sys/sys/mbuf.h:1.172	Thu Nov  9 22:34:07 2017
+++ src/sys/sys/mbuf.h	Mon Jan  1 12:09:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.172 2017/11/09 22:34:07 riastradh Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.173 2018/01/01 12:09:56 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -858,15 +858,8 @@ struct	mbuf *m_copyback_cow(struct mbuf 
 int 	m_makewritable(struct mbuf **, int, int, int);
 struct	mbuf *m_getcl(int, int, int);
 void	m_copydata(struct mbuf *, int, int, void *);
-struct	mbuf *m__free(const char *, int, struct mbuf *);
-void	m__freem(const char *, int, struct mbuf *);
-#ifdef DEBUG
-#define m_free(m)	m__free(__func__, __LINE__, m)
-#define m_freem(m)	m__freem(__func__, __LINE__, m)
-#else
 struct	mbuf *m_free(struct mbuf *);
 void	m_freem(struct mbuf *);
-#endif
 void	m_reclaim(void *, int);
 void	mbinit(void);
 void	m_ext_free(struct mbuf *);



CVS commit: src/doc

2018-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jan  1 11:52:45 UTC 2018

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-7.0.0


To generate a diff of this commit:
cvs rdiff -u -r1.1491 -r1.1492 src/doc/3RDPARTY
cvs rdiff -u -r1.2342 -r1.2343 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1491 src/doc/3RDPARTY:1.1492
--- src/doc/3RDPARTY:1.1491	Thu Dec 14 16:49:11 2017
+++ src/doc/3RDPARTY	Mon Jan  1 11:52:45 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1491 2017/12/14 16:49:11 jmcneill Exp $
+#	$NetBSD: 3RDPARTY,v 1.1492 2018/01/01 11:52:45 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -334,8 +334,8 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	7.0.0-rc4
-Current Vers:	7.0.0-rc4
+Version:	7.0.0
+Current Vers:	7.0.0
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2342 src/doc/CHANGES:1.2343
--- src/doc/CHANGES:1.2342	Tue Dec 19 19:58:37 2017
+++ src/doc/CHANGES	Mon Jan  1 11:52:45 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2342 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2343 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -96,3 +96,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	sstk: Remove the "stack section size change" syscall [kamil 20171219]
 	sbrk: Remove the "data section size change" syscall [kamil 20171219]
 	ovadvise: Remove the old vadvise syscall [kamil 20171219]
+	dhcpcd(8): Import dhcpcd-7.0.0 [roy 20180101]



CVS commit: src/external/bsd/dhcpcd/dist/src

2018-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jan  1 11:50:56 UTC 2018

Modified Files:
src/external/bsd/dhcpcd/dist/src: bpf.c dhcp.c dhcpcd.c if-options.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/dhcpcd/dist/src/bpf.c \
src/external/bsd/dhcpcd/dist/src/if-options.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/dhcp.c \
src/external/bsd/dhcpcd/dist/src/dhcpcd.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/src/bpf.c
diff -u src/external/bsd/dhcpcd/dist/src/bpf.c:1.5 src/external/bsd/dhcpcd/dist/src/bpf.c:1.6
--- src/external/bsd/dhcpcd/dist/src/bpf.c:1.5	Wed Dec  6 10:35:05 2017
+++ src/external/bsd/dhcpcd/dist/src/bpf.c	Mon Jan  1 11:50:56 2018
@@ -1,6 +1,6 @@
 /*
  * dhcpcd: BPF arp and bootp filtering
- * Copyright (c) 2006-2017 Roy Marples 
+ * Copyright (c) 2006-2018 Roy Marples 
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
Index: src/external/bsd/dhcpcd/dist/src/if-options.c
diff -u src/external/bsd/dhcpcd/dist/src/if-options.c:1.5 src/external/bsd/dhcpcd/dist/src/if-options.c:1.6
--- src/external/bsd/dhcpcd/dist/src/if-options.c:1.5	Tue Sep 19 19:19:21 2017
+++ src/external/bsd/dhcpcd/dist/src/if-options.c	Mon Jan  1 11:50:56 2018
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples 
+ * Copyright (c) 2006-2018 Roy Marples 
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.6 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.7
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.6	Wed Dec  6 10:35:05 2017
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Mon Jan  1 11:50:56 2018
@@ -1,6 +1,6 @@
 /*
  * dhcpcd - DHCP client daemon
- * Copyright (c) 2006-2017 Roy Marples 
+ * Copyright (c) 2006-2018 Roy Marples 
  * All rights reserved
 
  * Redistribution and use in source and binary forms, with or without
@@ -777,7 +777,8 @@ make_message(struct bootp **bootpm, cons
 	(type == DHCP_INFORM || type == DHCP_RELEASE ||
 	(type == DHCP_REQUEST &&
 	state->addr->mask.s_addr == lease->mask.s_addr &&
-	(state->new == NULL || IS_DHCP(state->new)
+	(state->new == NULL || IS_DHCP(state->new)) &&
+	!(state->added & STATE_FAKE
 		bootp->ciaddr = state->addr->addr.s_addr;
 
 	bootp->op = BOOTREQUEST;
@@ -845,6 +846,7 @@ make_message(struct bootp **bootpm, cons
 		if (type == DHCP_DECLINE ||
 		(type == DHCP_REQUEST &&
 		(state->addr == NULL ||
+		state->added & STATE_FAKE ||
 		lease->addr.s_addr != state->addr->addr.s_addr)))
 		{
 			PUT_ADDR(DHO_IPADDRESS, >addr);
@@ -1587,10 +1589,6 @@ dhcp_openudp(struct interface *ifp)
 	int s;
 	struct sockaddr_in sin;
 	int n;
-	struct dhcp_state *state;
-#ifdef SO_BINDTODEVICE
-	struct ifreq ifr;
-#endif
 
 	if ((s = xsocket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_UDP)) == -1)
 		return -1;
@@ -1598,20 +1596,12 @@ dhcp_openudp(struct interface *ifp)
 	n = 1;
 	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, , sizeof(n)) == -1)
 		goto eexit;
-#ifdef SO_BINDTODEVICE
-	if (ifp) {
-		memset(, 0, sizeof(ifr));
-		strlcpy(ifr.ifr_name, ifp->name, sizeof(ifr.ifr_name));
-		if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE, ,
-		sizeof(ifr)) == -1)
-		goto eexit;
-	}
-#endif
 	memset(, 0, sizeof(sin));
 	sin.sin_family = AF_INET;
 	sin.sin_port = htons(BOOTPC);
 	if (ifp) {
-		state = D_STATE(ifp);
+		struct dhcp_state *state = D_STATE(ifp);
+
 		if (state->addr)
 			sin.sin_addr.s_addr = state->addr->addr.s_addr;
 	}
@@ -1694,6 +1684,63 @@ dhcp_makeudppacket(size_t *sz, const uin
 	return udpp;
 }
 
+static ssize_t
+dhcp_sendudp(struct interface *ifp, struct in_addr *to, void *data, size_t len)
+{
+	int s;
+	struct msghdr msg;
+	struct sockaddr_in sin;
+	struct iovec iov[1];
+	ssize_t r;
+#ifdef IP_PKTINFO
+	uint8_t cmsg[CMSG_SPACE(sizeof(struct in_pktinfo))];
+	struct cmsghdr *cm;
+	struct in_pktinfo ipi;
+#endif
+
+	iov[0].iov_base = data;
+	iov[0].iov_len = len;
+
+	memset(, 0, sizeof(sin));
+	sin.sin_family = AF_INET;
+	sin.sin_addr = *to;
+	sin.sin_port = htons(BOOTPS);
+#ifdef HAVE_SA_LEN
+	sin.sin_len = sizeof(sin);
+#endif
+
+	memset(, 0, sizeof(msg));
+	msg.msg_name = (void *)
+	msg.msg_namelen = sizeof(sin);
+	msg.msg_iov = iov;
+	msg.msg_iovlen = 1;
+
+#ifdef IP_PKTINFO
+	/* Set the outbound interface */
+	msg.msg_control = cmsg;
+	msg.msg_controllen = sizeof(cmsg);
+
+	memset(, 0, sizeof(ipi));
+	ipi.ipi_ifindex = ifp->index;
+	cm = CMSG_FIRSTHDR();
+	if (cm == NULL) {
+		errno = ESRCH;
+		return -1;
+	}
+	cm->cmsg_level = IPPROTO_IP;
+	cm->cmsg_type = IP_PKTINFO;
+	

CVS import: src/external/bsd/dhcpcd/dist

2018-01-01 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jan  1 11:48:52 UTC 2018

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv16362

Log Message:
Import dhcpcd-7.0.0 with the following changes:
  *  dhcp: when unicasting on L3, unicast on L2 as well
  *  dhcp: when rebooting, don't set cidaddr
  *  dhcp6: don't listen on IPv6 addresses when not using DHCPv6
  *  dhcp: only set probe state when probing (fixes REBOOT reason)
  *  ipv6: disable kernel RA if interface is active
  *  hooks: set protocol to link for link layer events


Status:

Vendor Tag: roy
Release Tags:   dhcpcd-7-0-0

U src/external/bsd/dhcpcd/dist/.arcconfig
U src/external/bsd/dhcpcd/dist/.gitignore
U src/external/bsd/dhcpcd/dist/BUILDING.md
U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/Makefile
U src/external/bsd/dhcpcd/dist/Makefile.inc
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/config-null.mk
U src/external/bsd/dhcpcd/dist/configure
U src/external/bsd/dhcpcd/dist/iconfig.mk
U src/external/bsd/dhcpcd/dist/compat/_strtoi.h
U src/external/bsd/dhcpcd/dist/compat/arc4random.c
U src/external/bsd/dhcpcd/dist/compat/arc4random.h
U src/external/bsd/dhcpcd/dist/compat/bitops.h
U src/external/bsd/dhcpcd/dist/compat/queue.h
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.h
U src/external/bsd/dhcpcd/dist/compat/endian.h
U src/external/bsd/dhcpcd/dist/compat/pidfile.c
U src/external/bsd/dhcpcd/dist/compat/pidfile.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.h
U src/external/bsd/dhcpcd/dist/compat/strlcpy.c
U src/external/bsd/dhcpcd/dist/compat/strlcpy.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.c
U src/external/bsd/dhcpcd/dist/compat/strtoi.h
U src/external/bsd/dhcpcd/dist/compat/strtou.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.h
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.c
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.h
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.c
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.h
C src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/GNUmakefile
U src/external/bsd/dhcpcd/dist/src/Makefile
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/auth.h
C src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.c
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/dev.c
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
U src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/src/genembedc
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/if-linux-wext.c
U src/external/bsd/dhcpcd/dist/src/genembedh
U src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/if-linux.c
C src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/if-sun.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6.h
U src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/script.c
U 

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

2018-01-01 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jan  1 11:28:33 UTC 2018

Modified Files:
src/sys/arch/evbarm/rpi: rpi_start.S

Log Message:
Need to map 512MB for some RPIs


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/rpi/rpi_start.S

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

Modified files:

Index: src/sys/arch/evbarm/rpi/rpi_start.S
diff -u src/sys/arch/evbarm/rpi/rpi_start.S:1.15 src/sys/arch/evbarm/rpi/rpi_start.S:1.16
--- src/sys/arch/evbarm/rpi/rpi_start.S:1.15	Sun Dec 10 21:38:27 2017
+++ src/sys/arch/evbarm/rpi/rpi_start.S	Mon Jan  1 11:28:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpi_start.S,v 1.15 2017/12/10 21:38:27 skrll Exp $	*/
+/*	$NetBSD: rpi_start.S,v 1.16 2018/01/01 11:28:33 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003  Genetec Corporation.  All rights reserved.
@@ -95,7 +95,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: rpi_start.S,v 1.15 2017/12/10 21:38:27 skrll Exp $")
+RCSID("$NetBSD: rpi_start.S,v 1.16 2018/01/01 11:28:33 skrll Exp $")
 
 
 #if defined(VERBOSE_INIT_ARM)
@@ -353,10 +353,10 @@ Lctl_ID_dis:
 
 mmu_init_table:
 	/*
-	 * Map 256MB of VA==PA at 0x so we can keep the kernel going
+	 * Map 512MB of VA==PA at 0x so we can keep the kernel going
 	 * and get access to the FDT the firmware loads
 	 */
-	MMU_INIT(0x0, 0x0, 0x1000, L1_S_PROTO | L1_S_APv6_KRW)
+	MMU_INIT(0x0, 0x0, (512 * 1024 * 1204), L1_S_PROTO | L1_S_APv6_KRW)
 
 	MMU_INIT(KERNEL_BASE, 0x0,
 	(_end - KERNEL_BASE + 2 * L1_S_SIZE - 1),



CVS commit: src/sys/dev/pci

2018-01-01 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Mon Jan  1 08:33:28 UTC 2018

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

Log Message:
PR/52885 - Shinichi Doyashiki -- typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.550 -r1.551 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.550 src/sys/dev/pci/if_wm.c:1.551
--- src/sys/dev/pci/if_wm.c:1.550	Thu Dec 28 06:13:50 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jan  1 08:33:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.550 2017/12/28 06:13:50 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.551 2018/01/01 08:33:28 jnemeth Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.550 2017/12/28 06:13:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.551 2018/01/01 08:33:28 jnemeth Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -7870,7 +7870,7 @@ wm_nq_send_common_locked(struct ifnet *i
 		lasttx = nexttx;
 		nexttx = WM_NEXTTX(txq, nexttx);
 		/*
-		 * fill in the next descriptors. legacy or adcanced format
+		 * fill in the next descriptors. legacy or advanced format
 		 * is the same here
 		 */
 		for (seg = 1; seg < dmamap->dm_nsegs;



CVS commit: src/sys/arch/amd64/conf

2018-01-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan  1 08:14:14 UTC 2018

Modified Files:
src/sys/arch/amd64/conf: files.amd64

Log Message:
Compile the prekern entry point only under KASLR.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/amd64/conf/files.amd64

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/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.96 src/sys/arch/amd64/conf/files.amd64:1.97
--- src/sys/arch/amd64/conf/files.amd64:1.96	Thu Dec  7 23:11:50 2017
+++ src/sys/arch/amd64/conf/files.amd64	Mon Jan  1 08:14:13 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.96 2017/12/07 23:11:50 christos Exp $
+#	$NetBSD: files.amd64,v 1.97 2018/01/01 08:14:13 maxv Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -47,7 +47,7 @@ file	arch/amd64/amd64/kobj_machdep.c		mo
 file	kern/subr_disk_mbr.c			disk
 file	arch/amd64/amd64/gdt.c			machdep
 file	arch/amd64/amd64/machdep.c		machdep
-file	arch/amd64/amd64/prekern.c		machdep
+file	arch/amd64/amd64/prekern.c		kaslr
 file	arch/amd64/amd64/process_machdep.c	machdep
 file	arch/amd64/amd64/trap.c			machdep
 file	arch/x86/x86/fpu.c			machdep



CVS commit: src/sys/compat/linux/arch/amd64

2018-01-01 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jan  1 08:03:43 UTC 2018

Modified Files:
src/sys/compat/linux/arch/amd64: linux_machdep.c

Log Message:
Use the default %cs, and mask the other segregs.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/compat/linux/arch/amd64/linux_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/compat/linux/arch/amd64/linux_machdep.c
diff -u src/sys/compat/linux/arch/amd64/linux_machdep.c:1.55 src/sys/compat/linux/arch/amd64/linux_machdep.c:1.56
--- src/sys/compat/linux/arch/amd64/linux_machdep.c:1.55	Sat Oct 21 07:24:26 2017
+++ src/sys/compat/linux/arch/amd64/linux_machdep.c	Mon Jan  1 08:03:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_machdep.c,v 1.55 2017/10/21 07:24:26 maxv Exp $ */
+/*	$NetBSD: linux_machdep.c,v 1.56 2018/01/01 08:03:43 maxv Exp $ */
 
 /*-
  * Copyright (c) 2005 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.55 2017/10/21 07:24:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_machdep.c,v 1.56 2018/01/01 08:03:43 maxv Exp $");
 
 #include 
 #include 
@@ -205,9 +205,9 @@ linux_sendsig(const ksiginfo_t *ksi, con
 	sigframe.uc.luc_mcontext.rsp = tf->tf_rsp;
 	sigframe.uc.luc_mcontext.rip = tf->tf_rip;
 	sigframe.uc.luc_mcontext.eflags = tf->tf_rflags;
-	sigframe.uc.luc_mcontext.cs = tf->tf_cs;
-	sigframe.uc.luc_mcontext.gs = tf->tf_gs;
-	sigframe.uc.luc_mcontext.fs = tf->tf_fs;
+	sigframe.uc.luc_mcontext.cs = GSEL(GUCODE_SEL, SEL_UPL);
+	sigframe.uc.luc_mcontext.gs = tf->tf_gs & 0x;
+	sigframe.uc.luc_mcontext.fs = tf->tf_fs & 0x;
 	sigframe.uc.luc_mcontext.err = tf->tf_err;
 	sigframe.uc.luc_mcontext.trapno = tf->tf_trapno;
 	native_to_linux_sigset(, mask);