CVS commit: [netbsd-9] src/sys/arch/mips/mips

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:56:23 UTC 2019

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: locore.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #199):

sys/arch/mips/mips/locore.S: revision 1.220

Fix a maya fix so that cobalt boots again.

Set MIPS_COP_0_CAUSE to zero before the rest of the initialisation


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.219.4.1 src/sys/arch/mips/mips/locore.S

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



CVS commit: [netbsd-9] src/sys/arch/mips/mips

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:56:23 UTC 2019

Modified Files:
src/sys/arch/mips/mips [netbsd-9]: locore.S

Log Message:
Pull up following revision(s) (requested by skrll in ticket #199):

sys/arch/mips/mips/locore.S: revision 1.220

Fix a maya fix so that cobalt boots again.

Set MIPS_COP_0_CAUSE to zero before the rest of the initialisation


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.219.4.1 src/sys/arch/mips/mips/locore.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/mips/mips/locore.S
diff -u src/sys/arch/mips/mips/locore.S:1.219 src/sys/arch/mips/mips/locore.S:1.219.4.1
--- src/sys/arch/mips/mips/locore.S:1.219	Fri Sep  7 21:14:45 2018
+++ src/sys/arch/mips/mips/locore.S	Fri Sep 13 06:56:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.219 2018/09/07 21:14:45 macallan Exp $	*/
+/*	$NetBSD: locore.S,v 1.219.4.1 2019/09/13 06:56:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: locore.S,v 1.219 2018/09/07 21:14:45 macallan Exp $")
+RCSID("$NetBSD: locore.S,v 1.219.4.1 2019/09/13 06:56:23 martin Exp $")
 
 #include "assym.h"
 
@@ -73,10 +73,10 @@ RCSID("$NetBSD: locore.S,v 1.219 2018/09
 	.globl	_C_LABEL(kernel_text)		# libkvm refers this
 start:
 _C_LABEL(kernel_text):
+	/* First disable the interrupts only, for safety */
 	mfc0	k0, MIPS_COP_0_STATUS
 	MFC0_HAZARD
 
-	/* First disable the interrupts only, for safety */
 	and	k0, ~MIPS_SR_INT_IE
 	mtc0	k0, MIPS_COP_0_STATUS
 	COP0_SYNC
@@ -85,6 +85,7 @@ _C_LABEL(kernel_text):
 	/* Leaving TS | RE alone (for emips) */
 	and	k0, MIPS_SR_TS | MIPS3_SR_RE
 	mtc0	k0, MIPS_COP_0_STATUS
+	mtc0	zero, MIPS_COP_0_CAUSE
 	COP0_SYNC
 
 #if defined(_LP64) 



CVS commit: [netbsd-9] src/lib/libpthread

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:54:09 UTC 2019

Modified Files:
src/lib/libpthread [netbsd-9]: thrd.c threads.h

Log Message:
Pull up following revision(s) (requested by kamil in ticket #198):

lib/libpthread/thrd.c: revision 1.4
lib/libpthread/threads.h: revision 1.3

Switch back _Noreturn to __dead in C11 threads

There is an ongoing discussion to unify unreturn attribute between C and
C++, making a compatible version, shared between languages. Instead of
picking C11-only approach here, switch back to __dead that wraps the
compiler extension for the same purpose.

This change makes this header more compatible with C++ and pre-C11.
Reference:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2410.pdf";>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2410.pdf


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/lib/libpthread/thrd.c
cvs rdiff -u -r1.2 -r1.2.4.1 src/lib/libpthread/threads.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/libpthread/thrd.c
diff -u src/lib/libpthread/thrd.c:1.3 src/lib/libpthread/thrd.c:1.3.4.1
--- src/lib/libpthread/thrd.c:1.3	Mon Apr 29 20:11:43 2019
+++ src/lib/libpthread/thrd.c	Fri Sep 13 06:54:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: thrd.c,v 1.3 2019/04/29 20:11:43 kamil Exp $	*/
+/*	$NetBSD: thrd.c,v 1.3.4.1 2019/09/13 06:54:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: thrd.c,v 1.3 2019/04/29 20:11:43 kamil Exp $");
+__RCSID("$NetBSD: thrd.c,v 1.3.4.1 2019/09/13 06:54:09 martin Exp $");
 
 #include 
 #include 
@@ -122,7 +122,7 @@ thrd_equal(thrd_t t1, thrd_t t2)
 	return pthread_equal(t1, t2);
 }
 
-_Noreturn void
+__dead void
 thrd_exit(int res)
 {
 

Index: src/lib/libpthread/threads.h
diff -u src/lib/libpthread/threads.h:1.2 src/lib/libpthread/threads.h:1.2.4.1
--- src/lib/libpthread/threads.h:1.2	Wed Apr 24 18:47:54 2019
+++ src/lib/libpthread/threads.h	Fri Sep 13 06:54:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: threads.h,v 1.2 2019/04/24 18:47:54 kamil Exp $	*/
+/*	$NetBSD: threads.h,v 1.2.4.1 2019/09/13 06:54:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -106,7 +106,7 @@ int	thrd_create(thrd_t *, thrd_start_t, 
 thrd_t	thrd_current(void);
 int	thrd_detach(thrd_t);
 int	thrd_equal(thrd_t, thrd_t);
-_Noreturn void	thrd_exit(int);
+__dead void	thrd_exit(int);
 int	thrd_join(thrd_t, int *);
 int	thrd_sleep(const struct timespec *, struct timespec *);
 void	thrd_yield(void);



CVS commit: [netbsd-9] src/lib/libpthread

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:54:09 UTC 2019

Modified Files:
src/lib/libpthread [netbsd-9]: thrd.c threads.h

Log Message:
Pull up following revision(s) (requested by kamil in ticket #198):

lib/libpthread/thrd.c: revision 1.4
lib/libpthread/threads.h: revision 1.3

Switch back _Noreturn to __dead in C11 threads

There is an ongoing discussion to unify unreturn attribute between C and
C++, making a compatible version, shared between languages. Instead of
picking C11-only approach here, switch back to __dead that wraps the
compiler extension for the same purpose.

This change makes this header more compatible with C++ and pre-C11.
Reference:

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2410.pdf";>http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2410.pdf


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 src/lib/libpthread/thrd.c
cvs rdiff -u -r1.2 -r1.2.4.1 src/lib/libpthread/threads.h

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



CVS commit: [netbsd-9] src/sys/dev/usb

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:51:59 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c if_url.c if_urndis.c usb_mem.c
usbnet.c usbnet.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #197):

sys/dev/usb/if_url.c: revision 1.71
sys/dev/usb/usbnet.h: revision 1.15
sys/dev/usb/usb_mem.c: revision 1.72
sys/dev/usb/if_urndis.c: revision 1.24
sys/dev/usb/if_upl.c: revision 1.67
sys/dev/usb/usbnet.c: revision 1.25
sys/dev/usb/usbnet.c: revision 1.26
sys/dev/usb/usbnet.c: revision 1.27
sys/dev/usb/usbnet.c: revision 1.28

Teach urndis to handle some REMOTE_NDIS_INDICATE_STATUS_MSG. If the status
is reasonable, don't tell userland we got an error. Stops spurious EIO.
>From openbsd.

Fix bug, remove {0,0} because we switched to usb_lookup().

s/no free/no freelist entry/ in a debug message.

fix a lock hang reported by sc.dying in PR#54495.

remove locking in usbnet_tick().  assume that all locking
needs are handled inside usbnet_tick_task(), which runs in
the usbtask thread.  ensure that usbnet private is valid
before using it.

also check NULL private pointer in usbnet_isdying().
all the other cases should never happen.

don't try to set dying when we haven't usbnet_attach()d yet.
reported by maxv.

- use CALLARGS vs CALLED for better usbhist
- turn off usbnetdebug default
- log for all entry/exit points of usbnet_pipe_intr()
- in usbnet_start_locked() track whether any packet has been
  transmitted for setting the timer.  avoids spurious
  "watchdog timeouts"
- in usbnet_stop() use callout_halt() vs callout_halt, and
  also stop the usb task.  fixes crash of usbtask after the
  phy has detached.
- add a little more defensive checking in the tick task, and
  add some high-log-level logs.
- in usbnet_detach() move the call to usbnet_stop_ifp() above
  the calls to callout/usbtask stopping.
- set ec_mii and unp_pri to NULL when freeing their data

normalise an error message.

document usbnet_private locking.  minor knf.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.21.4.1 -r1.21.4.2 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.70.10.1 -r1.70.10.2 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.25.2.2 -r1.25.2.3 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/usb/usbnet.h

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

Modified files:

Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.64.2.1 src/sys/dev/usb/if_upl.c:1.64.2.2
--- src/sys/dev/usb/if_upl.c:1.64.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_upl.c	Fri Sep 13 06:51:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.64.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -95,8 +95,7 @@ static struct usb_devno sc_devs[] = {
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2302 },
 	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL25A1 },
 	{ USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F5U258 },
-	{ USB_VENDOR_NI, USB_PRODUCT_NI_HTOH_7825 },
-	{ 0, 0 }
+	{ USB_VENDOR_NI, USB_PRODUCT_NI_HTOH_7825 }
 };
 
 int	upl_match(device_t, cfdata_t, void *);

Index: src/sys/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.66.2.1 src/sys/dev/usb/if_url.c:1.66.2.2
--- src/sys/dev/usb/if_url.c:1.66.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_url.c	Fri Sep 13 06:51:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.66.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_url.c,v 1.66.2.2 2019/09/13 06:51:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.66.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.66.2.2 2019/09/13 06:51:58 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -190,7 +190,7 @@ url_attach(device_t parent, device_t sel
 	if (err) {
 		aprint_error_dev(self, "failed to set configuration"
 		", err=%s\n", usbd_errstr(err));
-		goto bad;
+		return;
 	}
 
 	/* get control interface */
@@ -198,7 +198,7 @@ url_attach(device_t parent, device_t sel
 	if (err) {
 		aprint_error_dev(self, "failed to get interface, err=%s\n",
 		   usbd_errstr(err));
-		goto bad;
+		return;
 	}
 
 	un->un_iface = iface;
@@ -221,7 +221,7 @@ url_attach(device_t parent, device_t sel
 		if (ed == NULL) {
 			aprint_error_dev(self,
 			"couldn't get endpoint %d\n", i);
-			goto bad;
+			retu

CVS commit: [netbsd-9] src/sys/dev/usb

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:51:59 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: if_upl.c if_url.c if_urndis.c usb_mem.c
usbnet.c usbnet.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #197):

sys/dev/usb/if_url.c: revision 1.71
sys/dev/usb/usbnet.h: revision 1.15
sys/dev/usb/usb_mem.c: revision 1.72
sys/dev/usb/if_urndis.c: revision 1.24
sys/dev/usb/if_upl.c: revision 1.67
sys/dev/usb/usbnet.c: revision 1.25
sys/dev/usb/usbnet.c: revision 1.26
sys/dev/usb/usbnet.c: revision 1.27
sys/dev/usb/usbnet.c: revision 1.28

Teach urndis to handle some REMOTE_NDIS_INDICATE_STATUS_MSG. If the status
is reasonable, don't tell userland we got an error. Stops spurious EIO.
>From openbsd.

Fix bug, remove {0,0} because we switched to usb_lookup().

s/no free/no freelist entry/ in a debug message.

fix a lock hang reported by sc.dying in PR#54495.

remove locking in usbnet_tick().  assume that all locking
needs are handled inside usbnet_tick_task(), which runs in
the usbtask thread.  ensure that usbnet private is valid
before using it.

also check NULL private pointer in usbnet_isdying().
all the other cases should never happen.

don't try to set dying when we haven't usbnet_attach()d yet.
reported by maxv.

- use CALLARGS vs CALLED for better usbhist
- turn off usbnetdebug default
- log for all entry/exit points of usbnet_pipe_intr()
- in usbnet_start_locked() track whether any packet has been
  transmitted for setting the timer.  avoids spurious
  "watchdog timeouts"
- in usbnet_stop() use callout_halt() vs callout_halt, and
  also stop the usb task.  fixes crash of usbtask after the
  phy has detached.
- add a little more defensive checking in the tick task, and
  add some high-log-level logs.
- in usbnet_detach() move the call to usbnet_stop_ifp() above
  the calls to callout/usbtask stopping.
- set ec_mii and unp_pri to NULL when freeing their data

normalise an error message.

document usbnet_private locking.  minor knf.


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.21.4.1 -r1.21.4.2 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.70.10.1 -r1.70.10.2 src/sys/dev/usb/usb_mem.c
cvs rdiff -u -r1.25.2.2 -r1.25.2.3 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.14.2.2 -r1.14.2.3 src/sys/dev/usb/usbnet.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/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 13 06:50:18 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
- Return EPERM when the interface is not trusted.
- Treat IXGBE_ERR_FEATURE_NOT_SUPPORTED.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.134 src/sys/dev/pci/ixgbe/ixv.c:1.135
--- src/sys/dev/pci/ixgbe/ixv.c:1.134	Thu Sep 12 12:25:46 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Sep 13 06:50:18 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.134 2019/09/12 12:25:46 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.135 2019/09/13 06:50:18 msaitoh Exp $*/
 
 /**
 
@@ -1145,7 +1145,11 @@ ixv_set_multi(struct adapter *adapter)
 		if (error == IXGBE_ERR_NOT_TRUSTED) {
 			device_printf(adapter->dev,
 			"this interface is not trusted\n");
-			error = ENOSPC;
+			error = EPERM;
+		} else if (error == IXGBE_ERR_FEATURE_NOT_SUPPORTED) {
+			device_printf(adapter->dev,
+			"the PF doesn't support allmulti mode\n");
+			error = EOPNOTSUPP;
 		} else if (error) {
 			device_printf(adapter->dev,
 			"number of Ethernet multicast addresses "
@@ -1161,7 +1165,10 @@ ixv_set_multi(struct adapter *adapter)
 	if (!allmulti) {
 		error = hw->mac.ops.update_xcast_mode(hw,
 		IXGBEVF_XCAST_MODE_MULTI);
-		if (error) {
+		if (error == IXGBE_ERR_FEATURE_NOT_SUPPORTED) {
+			/* normal operation */
+			error = 0;
+		} else if (error) {
 			device_printf(adapter->dev,
 			"failed to set Ethernet multicast address "
 			"operation to normal. error = %d\n", error);
@@ -2993,7 +3000,11 @@ ixv_ioctl(struct ifnet *ifp, u_long comm
 			if (error == IXGBE_ERR_NOT_TRUSTED) {
 device_printf(adapter->dev,
 "this interface is not trusted\n");
-error = ENOSPC;
+error = EPERM;
+			} else if (error == IXGBE_ERR_FEATURE_NOT_SUPPORTED) {
+device_printf(adapter->dev,
+"the PF doesn't support allmulti mode\n");
+error = EOPNOTSUPP;
 			} else if (error) {
 device_printf(adapter->dev,
 "number of Ethernet multicast addresses "



CVS commit: src/sys/dev/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 13 06:50:18 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
- Return EPERM when the interface is not trusted.
- Treat IXGBE_ERR_FEATURE_NOT_SUPPORTED.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: src/sys/net

2019-09-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 13 06:39:29 UTC 2019

Modified Files:
src/sys/net: bpf.c

Log Message:
As I suspected, the KASSERT I added yesterday can fire if we try to process
zero-sized packets. Skip them to prevent a type confusion that can trigger
random page faults later.

Reported-by: syzbot+3e447ebdcb2bcfa40...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/net/bpf.c

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

Modified files:

Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.230 src/sys/net/bpf.c:1.231
--- src/sys/net/bpf.c:1.230	Thu Sep 12 07:38:19 2019
+++ src/sys/net/bpf.c	Fri Sep 13 06:39:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $	*/
+/*	$NetBSD: bpf.c,v 1.231 2019/09/13 06:39:29 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.231 2019/09/13 06:39:29 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1676,6 +1676,11 @@ _bpf_mtap(struct bpf_if *bp, struct mbuf
 
 	pktlen = m_length(m);
 
+	/* Skip zero-sized packets. */
+	if (__predict_false(pktlen == 0)) {
+		return;
+	}
+
 	if (pktlen == m->m_len) {
 		cpfn = (void *)memcpy;
 		marg = mtod(m, void *);



CVS commit: src/sys/net

2019-09-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 13 06:39:29 UTC 2019

Modified Files:
src/sys/net: bpf.c

Log Message:
As I suspected, the KASSERT I added yesterday can fire if we try to process
zero-sized packets. Skip them to prevent a type confusion that can trigger
random page faults later.

Reported-by: syzbot+3e447ebdcb2bcfa40...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/net/bpf.c

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



CVS commit: [netbsd-9] src/sys/dev/usb

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:32:11 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #196):

sys/dev/usb/xhci.c: revision 1.111
sys/dev/usb/xhci.c: revision 1.112
sys/dev/usb/xhci.c: revision 1.113
sys/dev/usb/xhci.c: revision 1.114

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".
add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.
from sc.dying

avoid non-debug kernel build issues.


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/xhci.c

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



CVS commit: [netbsd-9] src/sys/dev/usb

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:32:11 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-9]: xhci.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #196):

sys/dev/usb/xhci.c: revision 1.111
sys/dev/usb/xhci.c: revision 1.112
sys/dev/usb/xhci.c: revision 1.113
sys/dev/usb/xhci.c: revision 1.114

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".
add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.
from sc.dying

avoid non-debug kernel build issues.


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107.2.2 src/sys/dev/usb/xhci.c:1.107.2.3
--- src/sys/dev/usb/xhci.c:1.107.2.2	Sun Sep  1 13:00:37 2019
+++ src/sys/dev/usb/xhci.c	Fri Sep 13 06:32:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.2 2019/09/01 13:00:37 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.2 2019/09/01 13:00:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.3 2019/09/13 06:32:11 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -114,9 +114,12 @@ fail:
 #define HEXDUMP(a, b, c)
 #endif
 
-#define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(xhcidebug,N,FMT,A,B,C,D)
-#define XHCIHIST_FUNC() USBHIST_FUNC()
-#define XHCIHIST_CALLED(name) USBHIST_CALLED(xhcidebug)
+#define DPRINTF(FMT,A,B,C,D)	USBHIST_LOG(xhcidebug,FMT,A,B,C,D)
+#define DPRINTFN(N,FMT,A,B,C,D)	USBHIST_LOGN(xhcidebug,N,FMT,A,B,C,D)
+#define XHCIHIST_FUNC()		USBHIST_FUNC()
+#define XHCIHIST_CALLED(name)	USBHIST_CALLED(xhcidebug)
+#define XHCIHIST_CALLARGS(FMT,A,B,C,D) \
+USBHIST_CALLARGS(xhcidebug,FMT,A,B,C,D)
 
 #define XHCI_DCI_SLOT 0
 #define XHCI_DCI_EP_CONTROL 1
@@ -1297,10 +1300,10 @@ xhci_intr1(struct xhci_softc * const sc)
 	uint32_t usbsts;
 	uint32_t iman;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
+	XHCIHIST_FUNC();
 
 	usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
-	DPRINTFN(16, "USBSTS %08jx", usbsts, 0, 0, 0);
+	XHCIHIST_CALLARGS("USBSTS %08jx", usbsts, 0, 0, 0);
 	if ((usbsts & (XHCI_STS_HSE | XHCI_STS_EINT | XHCI_STS_PCD |
 	XHCI_STS_HCE)) == 0) {
 		DPRINTFN(16, "ignored intr not for %s",
@@ -1411,8 +1414,8 @@ xhci_configure_endpoint(struct usbd_pipe
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju epaddr 0x%02jx attr 0x%02jx",
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju epaddr 0x%02jx attr 0x%02jx",
 	xs->xs_idx, dci, pipe->up_endpoint->ue_edesc->bEndpointAddress,
 	pipe->up_endpoint->ue_edesc->bmAttributes);
 
@@ -1450,8 +1453,8 @@ xhci_unconfigure_endpoint(struct usbd_pi
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 #endif
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju", xs->xs_idx, 0, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju", xs->xs_idx, 0, 0, 0);
 
 	return USBD_NORMAL_COMPLETION;
 }
@@ -1467,8 +1470,8 @@ xhci_reset_endpoint_locked(struct usbd_p
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_lock));
 
@@ -1509,8 +1512,8 @@ xhci_stop_endpoint(struct usbd_pipe *pip
 	usbd_status err;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_lock));
 
@@ -1543,8 +1546,8 @@ xhci_set_dequeue_locked(struct usbd_pipe
 	struct xhci_soft_trb trb;
 	usbd_status err;
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(4, "slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("slot %ju dci %ju", xs->xs_idx, dci, 0, 0);
 
 	KASSERT(mutex_owned(&sc->sc_lock));
 
@@ -1587,8 +1590,8 @@ xhci_open(struct usbd_pipe *pipe)
 	usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
 	const uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
 
-	XHCIHIST_FUNC(); XHCIHIST_CALLED();
-	DPRINTFN(1, "addr %jd depth %jd port %jd speed %jd", dev->ud_addr,
+	XHCIHIST_FUNC();
+	XHCIHIST_CALLARGS("ad

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

2019-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 13 06:30:10 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/arm/arm32/cpuswitch.S

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

2019-09-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 13 06:30:10 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.93 src/sys/arch/arm/arm32/cpuswitch.S:1.94
--- src/sys/arch/arm/arm32/cpuswitch.S:1.93	Thu Nov 22 21:28:21 2018
+++ src/sys/arch/arm/arm32/cpuswitch.S	Fri Sep 13 06:30:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.94 2019/09/13 06:30:10 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.94 2019/09/13 06:30:10 skrll Exp $")
 
 /* LINTSTUB: include  */
 
@@ -452,7 +452,7 @@ END(softint_switch)
  * r7 = curcpu()
  */
 ENTRY_NP(softint_tramp)
-	ldr	r3, [r7, #(CI_MTX_COUNT)]	/* readust after mi_switch */
+	ldr	r3, [r7, #(CI_MTX_COUNT)]	/* readjust after mi_switch */
 	add	r3, r3, #1
 	str	r3, [r7, #(CI_MTX_COUNT)]
 



CVS commit: [netbsd-9] src/sys

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:25:26 UTC 2019

Modified Files:
src/sys/compat/linux/arch/amd64 [netbsd-9]: linux_machdep.c
src/sys/compat/linux/common [netbsd-9]: linux_fcntl.h linux_file64.c
linux_ipc.c linux_misc.c linux_signal.c linux_socket.c
linux_socket.h linux_statfs.h linux_termios.c linux_termios.h
src/sys/compat/linux32/common [netbsd-9]: linux32_dirent.c
linux32_ioctl.c linux32_misc.c linux32_signal.c linux32_sysinfo.c
linux32_termios.c linux32_utsname.c
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_compat_43.c
src/sys/compat/ossaudio [netbsd-9]: ossaudio.c
src/sys/kern [netbsd-9]: sysv_shm.c
src/sys/miscfs/procfs [netbsd-9]: procfs_linux.c
src/sys/sys [netbsd-9]: shm.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.

Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.2.1 \
src/sys/compat/linux/arch/amd64/linux_machdep.c
cvs rdiff -u -r1.17 -r1.17.22.1 src/sys/compat/linux/common/linux_fcntl.h
cvs rdiff -u -r1.60 -r1.60.4.1 src/sys/compat/linux/common/linux_file64.c
cvs rdiff -u -r1.56 -r1.56.4.1 src/sys/compat/linux/common/linux_ipc.c
cvs rdiff -u -r1.240 -r1.240.4.1 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.80 -r1.80.8.1 src/sys/compat/linux/common/linux_signal.c
cvs rdiff -u -r1.145 -r1.145.4.1 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.23 -r1.23.18.1 src/sys/compat/linux/common/linux_socket.h
cvs rdiff -u -r1.6 -r1.6.42.1 src/sys/compat/linux/common/linux_statfs.h
cvs rdiff -u -r1.37 -r1.37.34.1 src/sys/compat/linux/common/linux_termios.c
cvs rdiff -u -r1.21 -r1.21.58.1 src/sys/compat/linux/common/linux_termios.h
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/compat/linux32/common/linux32_dirent.c
cvs rdiff -u -r1.13 -r1.13.68.1 src/sys/compat/linux32/common/linux32_ioctl.c
cvs rdiff -u -r1.2

CVS commit: [netbsd-9] src/sys

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 06:25:26 UTC 2019

Modified Files:
src/sys/compat/linux/arch/amd64 [netbsd-9]: linux_machdep.c
src/sys/compat/linux/common [netbsd-9]: linux_fcntl.h linux_file64.c
linux_ipc.c linux_misc.c linux_signal.c linux_socket.c
linux_socket.h linux_statfs.h linux_termios.c linux_termios.h
src/sys/compat/linux32/common [netbsd-9]: linux32_dirent.c
linux32_ioctl.c linux32_misc.c linux32_signal.c linux32_sysinfo.c
linux32_termios.c linux32_utsname.c
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_compat_43.c
src/sys/compat/ossaudio [netbsd-9]: ossaudio.c
src/sys/kern [netbsd-9]: sysv_shm.c
src/sys/miscfs/procfs [netbsd-9]: procfs_linux.c
src/sys/sys [netbsd-9]: shm.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.

Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.2.1 \
src/sys/compat/linux/arch/amd64/linux_machdep.c
cvs rdiff -u -r1.17 -r1.17.22.1 src/sys/compat/linux/common/linux_fcntl.h
cvs rdiff -u -r1.60 -r1.60.4.1 src/sys/compat/linux/common/linux_file64.c
cvs rdiff -u -r1.56 -r1.56.4.1 src/sys/compat/linux/common/linux_ipc.c
cvs rdiff -u -r1.240 -r1.240.4.1 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.80 -r1.80.8.1 src/sys/compat/linux/common/linux_signal.c
cvs rdiff -u -r1.145 -r1.145.4.1 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.23 -r1.23.18.1 src/sys/compat/linux/common/linux_socket.h
cvs rdiff -u -r1.6 -r1.6.42.1 src/sys/compat/linux/common/linux_statfs.h
cvs rdiff -u -r1.37 -r1.37.34.1 src/sys/compat/linux/common/linux_termios.c
cvs rdiff -u -r1.21 -r1.21.58.1 src/sys/compat/linux/common/linux_termios.h
cvs rdiff -u -r1.19 -r1.19.4.1 src/sys/compat/linux32/common/linux32_dirent.c
cvs rdiff -u -r1.13 -r1.13.68.1 src/sys/compat/linux32/common/linux32_ioctl.c
cvs rdiff -u -r1.2

Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Martin Husemann
On Thu, Sep 12, 2019 at 08:21:38PM -0600, Warner Losh wrote:
> When multiple people are doing leak busting, maybe over years, they
> eliminate many false positives so you can focus on the real issues w/o a
> run time penalty. Especially something in the library that comes up
> often... otherwise they get in the way of making progress...

Instead of adding rarely excercised code in the exit path, I would prefer
to mark the allocation with something special so the sanitizer knows
I intend to never free the result and I am fine with "the leak". It could
still report a summary like "10k in 20 objects allocated and intentionaly
not freed", so if this goes up dramatically we may still notice.

Martin


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

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 05:13:54 UTC 2019

Modified Files:
src/distrib/sets/lists/comp: md.amd64 md.i386

Log Message:
Add new multiboot2.h header.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.190 -r1.191 src/distrib/sets/lists/comp/md.i386

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



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

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 13 05:13:54 UTC 2019

Modified Files:
src/distrib/sets/lists/comp: md.amd64 md.i386

Log Message:
Add new multiboot2.h header.


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.190 -r1.191 src/distrib/sets/lists/comp/md.i386

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

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.272 src/distrib/sets/lists/comp/md.amd64:1.273
--- src/distrib/sets/lists/comp/md.amd64:1.272	Mon Aug 26 04:49:45 2019
+++ src/distrib/sets/lists/comp/md.amd64	Fri Sep 13 05:13:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.272 2019/08/26 04:49:45 kamil Exp $
+# $NetBSD: md.amd64,v 1.273 2019/09/13 05:13:54 martin Exp $
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
 ./usr/include/amd64/aout_machdep.h		comp-c-include
@@ -710,6 +710,7 @@
 ./usr/include/i386/mcontext.h			comp-c-include
 ./usr/include/i386/mtrr.h			comp-c-include
 ./usr/include/i386/multiboot.h			comp-c-include
+./usr/include/i386/multiboot2.h			comp-c-include
 ./usr/include/i386/mutex.h			comp-c-include
 ./usr/include/i386/npx.h			comp-obsolete		obsolete
 ./usr/include/i386/param.h			comp-c-include

Index: src/distrib/sets/lists/comp/md.i386
diff -u src/distrib/sets/lists/comp/md.i386:1.190 src/distrib/sets/lists/comp/md.i386:1.191
--- src/distrib/sets/lists/comp/md.i386:1.190	Mon Aug 26 04:49:45 2019
+++ src/distrib/sets/lists/comp/md.i386	Fri Sep 13 05:13:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.190 2019/08/26 04:49:45 kamil Exp $
+# $NetBSD: md.i386,v 1.191 2019/09/13 05:13:54 martin Exp $
 ./usr/include/clang-3.4/__wmmintrin_aes.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/__wmmintrin_pclmul.h	comp-obsolete		obsolete
 ./usr/include/clang-3.4/ammintrin.h		comp-obsolete		obsolete
@@ -637,6 +637,7 @@
 ./usr/include/i386/mouse.h			comp-obsolete		obsolete
 ./usr/include/i386/mtrr.h			comp-c-include
 ./usr/include/i386/multiboot.h			comp-c-include
+./usr/include/i386/multiboot2.h			comp-c-include
 ./usr/include/i386/mutex.h			comp-c-include
 ./usr/include/i386/npx.h			comp-obsolete		obsolete
 ./usr/include/i386/param.h			comp-c-include



Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Warner Losh
On Thu, Sep 12, 2019, 7:24 PM Simon Burge  wrote:

> Kamil Rytarowski wrote:
>
> > I will revert it, but I am looking for a more generic approach.
> >
> > How about adding ifdef __NO_LEAKS like:
> >
> > #ifdef __NO_LEAKS
> > free(3)?
> > #endif
> >
> > And in lsan/asan/valgrind/etc checks use -D__NO_LEAKS.
>
> Sorry if I'm missing something that has been already explained,
> but why (practically) do we care about memory leaks for a utility
> that is about to finish?
>
> If we're doing some ugly #ifdef dance only when running the
> sanitiser(s), then we haven't actually done anything to "fix"
> the leak in the installed binaries so it seems that there was
> no practical problem that we were trying to solve in the first
> place.
>

When multiple people are doing leak busting, maybe over years, they
eliminate many false positives so you can focus on the real issues w/o a
run time penalty. Especially something in the library that comes up
often... otherwise they get in the way of making progress...

Warner

Cheers,
> Simon.
>


CVS commit: src/doc

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 02:23:31 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
boot(8): multiboot 2 support, Xen can now boot from EFI


To generate a diff of this commit:
cvs rdiff -u -r1.2580 -r1.2581 src/doc/CHANGES

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



CVS commit: src/doc

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 02:23:31 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
boot(8): multiboot 2 support, Xen can now boot from EFI


To generate a diff of this commit:
cvs rdiff -u -r1.2580 -r1.2581 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/CHANGES
diff -u src/doc/CHANGES:1.2580 src/doc/CHANGES:1.2581
--- src/doc/CHANGES:1.2580	Sun Sep  8 20:57:16 2019
+++ src/doc/CHANGES	Fri Sep 13 02:23:31 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2580 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2581 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -39,3 +39,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd(8): Import dhcpcd-8.0.4 [roy 20190904]
 	bind: Import version 9.14.5. [christos 20190905]
 	resolvconf(8): Import openresolv-3.9.2 [roy 20190908]
+	boot(8): multiboot 2 support, Xen can now boot from EFI [manu 20190913]



CVS commit: src/sys/arch/i386

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 02:19:46 UTC 2019

Modified Files:
src/sys/arch/i386/include: Makefile
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/dosboot: Makefile
src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c efiboot.c
efiboot.h eficons.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: Makefile efibootia32.c
src/sys/arch/i386/stand/efiboot/bootx64: Makefile efibootx64.c
src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h
bootinfo_memmap.c exec.c libi386.h multiboot.S pread.c
src/sys/arch/i386/stand/netboot: Makefile.netboot
src/sys/arch/i386/stand/pxeboot: Makefile
Added Files:
src/sys/arch/i386/include: multiboot2.h
src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S
src/sys/arch/i386/stand/efiboot/bootx64: multiboot64.S
src/sys/arch/i386/stand/lib: exec_multiboot1.c exec_multiboot2.c

Log Message:
Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/include/multiboot2.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/dosboot/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/stand/efiboot/Makefile.efiboot \
src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/bootia32/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootx64/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootx64/multiboot64.S
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/Makefile
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/biosdisk.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/bootinfo_memmap.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c \
src/sys/arch/i386/stand/lib/exec_multiboot2.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/libi386.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/multiboot.S
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/pread.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/netboot/Makefile.netboot
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/stand/pxeboot/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/i386

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 02:19:46 UTC 2019

Modified Files:
src/sys/arch/i386/include: Makefile
src/sys/arch/i386/stand/boot: Makefile.boot
src/sys/arch/i386/stand/dosboot: Makefile
src/sys/arch/i386/stand/efiboot: Makefile.efiboot boot.c efiboot.c
efiboot.h eficons.c efimemory.c
src/sys/arch/i386/stand/efiboot/bootia32: Makefile efibootia32.c
src/sys/arch/i386/stand/efiboot/bootx64: Makefile efibootx64.c
src/sys/arch/i386/stand/lib: Makefile biosdisk.c biosdisk.h
bootinfo_memmap.c exec.c libi386.h multiboot.S pread.c
src/sys/arch/i386/stand/netboot: Makefile.netboot
src/sys/arch/i386/stand/pxeboot: Makefile
Added Files:
src/sys/arch/i386/include: multiboot2.h
src/sys/arch/i386/stand/efiboot/bootia32: multiboot32.S
src/sys/arch/i386/stand/efiboot/bootx64: multiboot64.S
src/sys/arch/i386/stand/lib: exec_multiboot1.c exec_multiboot2.c

Log Message:
Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.
This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/i386/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/include/multiboot2.h
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/boot/Makefile.boot
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/dosboot/Makefile
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/stand/efiboot/Makefile.efiboot \
src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/efiboot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/eficons.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/bootia32/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootia32/multiboot32.S
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/bootx64/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/efiboot/bootx64/multiboot64.S
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/Makefile
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/biosdisk.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/bootinfo_memmap.c
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c \
src/sys/arch/i386/stand/lib/exec_multiboot2.c
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/i386/stand/lib/libi386.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/multiboot.S
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/pread.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/netboot/Makefile.netboot
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/stand/pxeboot/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/i386/include/Makefile
diff -u src/sys/arch/i386/include/Makefile:1.49 src/sys/arch/i386/include/Makefile:1.50
--- src/sys/arch/i386/include/Makefile:1.49	Thu Jul 12 10:46:44 2018
+++ src/sys/arch/i386/include/Makefile	Fri Sep 13 02:19:45 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2018/07/12 10:46:44 maxv Exp $
+#	$NetBSD: Makefile,v 1.50 2019/09/13 02:19:45 manu Exp $
 
 INCSDIR= /usr/include/i386
 
@@ -15,7 +15,7 @@ INCS=	ansi.h aout_machdep.h apmvar.h asm
 	joystick.h \
 	kcore.h \
 	limits.h lock.h \
-	math.h mcontext.h mutex.h mtrr.h multiboot.h \
+	math.h mcontext.h mutex.h mtrr.h multiboot.h multiboot2.h \
 	param.h pcb.h pio.h pmap.h proc.h profile.h psl.h \
 	pte.h ptrace.h \
 	reg.h rwlock.h \

Index: src/sys/arch/i386/stand/boot/Makefile.boot
diff -u src/sys/arch/i386/stand/boot/Makefile.boot:1.72 src/sys/arch/i386/stand/boot/Makefile.boot:1.73
--- src/sys/arch/i386/stand/boot/Makefile.boot:1.72	Wed Jul 25 23:45:32 2018
+++ src/sys/arch/i386/stand/boot/Makefile.boot	Fri Sep 13 02:19:45 2019
@@ -1,4 +1,4 @@
-# $NetBSD

Re: CVS commit: src/bin/ps

2019-09-12 Thread Kamil Rytarowski
On 13.09.2019 03:51, Roy Marples wrote:
> On 12/09/2019 20:55, Joerg Sonnenberger wrote:
>> On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote:
>>> On 11/09/2019 20:03, Robert Elz wrote:
   Date:    Wed, 11 Sep 2019 17:02:53 +
   From:    "Kamil Rytarowski" 
   Message-ID:  <20190911170253.d097ff...@cvs.netbsd.org>

     | Free it when no longer used, just before the program termination.

 Can we please avoid this kind of nonsense.   Everything is freed when
 every program exits - doing explicit free() calls makes the program
 bigger
 and slower for no reason at all.

 By all means fix places where memory is truly leaked (whenre more is
 continuously allocated, and simply discarded) but anything that is
 supposed
 to remain until program exit should simply go away when the exit
 happens.

 If the canitisers cannot be instructed to ignore such things, they are
 much less useful tan they could be.
>>>
>>> Could we add an #ifdef for this?
>>>
>>> #ifdef __SANITISATION
>>> free(foo);
>>> close(bar);
>>> #endif
>>>
>>> return EXIT_SUCCESS;
>>
>> That's kind of how coverity and valgrind dealt with it.
> 
> Do you happen to know if one #define fits all and if not, can we add it
> to sys/cdefs.h?
> 
> Roy

Coverity needs:

#ifdef __COVERITY__

Valgrind doesn't have any checks, it instruments prebuilt programs.

We could add:

#ifndef __has_feature
#define __has_feature 0
#endif

#if defined(__COVERITY__) || __has_feature(address_sanitizer) \
|| defined(__SANITIZE_ADDRESS__)
#define __NO_LEAKS
#endif



signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/bin/ps

2019-09-12 Thread Roy Marples

On 12/09/2019 20:55, Joerg Sonnenberger wrote:

On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote:

On 11/09/2019 20:03, Robert Elz wrote:

  Date:Wed, 11 Sep 2019 17:02:53 +
  From:"Kamil Rytarowski" 
  Message-ID:  <20190911170253.d097ff...@cvs.netbsd.org>

| Free it when no longer used, just before the program termination.

Can we please avoid this kind of nonsense.   Everything is freed when
every program exits - doing explicit free() calls makes the program bigger
and slower for no reason at all.

By all means fix places where memory is truly leaked (whenre more is
continuously allocated, and simply discarded) but anything that is supposed
to remain until program exit should simply go away when the exit happens.

If the canitisers cannot be instructed to ignore such things, they are
much less useful tan they could be.


Could we add an #ifdef for this?

#ifdef __SANITISATION
free(foo);
close(bar);
#endif

return EXIT_SUCCESS;


That's kind of how coverity and valgrind dealt with it.


Do you happen to know if one #define fits all and if not, can we add it 
to sys/cdefs.h?


Roy


Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Kamil Rytarowski
On 13.09.2019 03:24, Simon Burge wrote:
> Kamil Rytarowski wrote:
> 
>> I will revert it, but I am looking for a more generic approach.
>>
>> How about adding ifdef __NO_LEAKS like:
>>
>> #ifdef __NO_LEAKS
>> free(3)?
>> #endif
>>
>> And in lsan/asan/valgrind/etc checks use -D__NO_LEAKS.
> 
> Sorry if I'm missing something that has been already explained,
> but why (practically) do we care about memory leaks for a utility
> that is about to finish?
> 

I used it in the first place when the resource was no longer needed and
it happened to be before return by an accident.

> If we're doing some ugly #ifdef dance only when running the
> sanitiser(s), then we haven't actually done anything to "fix"
> the leak in the installed binaries so it seems that there was
> no practical problem that we were trying to solve in the first
> place.
> 

It's an optimization to free the resource by exit(2). It is legal in a
POSIX environment, so no need to change this default behavior.

Whenever we affect long-running applications or incomplete procedure
shutdown, we could add free(3) calls unconditionally.

> Cheers,
> Simon.
> 




signature.asc
Description: OpenPGP digital signature


CVS commit: src/share/man/man8/man8.x86

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 01:34:19 UTC 2019

Modified Files:
src/share/man/man8/man8.x86: boot.8

Log Message:
Document that bootdev option accepts device specification as NAME=label


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man8/man8.x86/boot.8

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/man8/man8.x86/boot.8
diff -u src/share/man/man8/man8.x86/boot.8:1.17 src/share/man/man8/man8.x86/boot.8:1.18
--- src/share/man/man8/man8.x86/boot.8:1.17	Sun Aug 18 08:12:36 2019
+++ src/share/man/man8/man8.x86/boot.8	Fri Sep 13 01:34:19 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: boot.8,v 1.17 2019/08/18 08:12:36 wiz Exp $
+.\"	$NetBSD: boot.8,v 1.18 2019/09/13 01:34:19 manu Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -436,7 +436,11 @@ being separated with spaces
 .It Ic bootdev Ns = Ns Ar dev Po or Ic root Ns = Ns Ar dev Pc
 Override the default boot device.
 .Ar dev
-can be a unit name
+is of the form
+.Va NAME=partition_label
+for
+.Xr gpt 8
+partitionned disks. It can also be a unit name
 .Po Dq wd0
 .Pc ,
 or an interface name



CVS commit: src/share/man/man8/man8.x86

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 01:34:19 UTC 2019

Modified Files:
src/share/man/man8/man8.x86: boot.8

Log Message:
Document that bootdev option accepts device specification as NAME=label


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man8/man8.x86/boot.8

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



CVS commit: src/sys/kern

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 01:33:20 UTC 2019

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

Log Message:
Accept root device specification as NAME=label


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/kern_subr.c

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



CVS commit: src/sys/kern

2019-09-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Sep 13 01:33:20 UTC 2019

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

Log Message:
Accept root device specification as NAME=label


To generate a diff of this commit:
cvs rdiff -u -r1.224 -r1.225 src/sys/kern/kern_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/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.224 src/sys/kern/kern_subr.c:1.225
--- src/sys/kern/kern_subr.c:1.224	Sun Aug 18 06:28:42 2019
+++ src/sys/kern/kern_subr.c	Fri Sep 13 01:33:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.224 2019/08/18 06:28:42 mlelstv Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.224 2019/08/18 06:28:42 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.225 2019/09/13 01:33:20 manu Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -229,6 +229,16 @@ setroot(device_t bootdv, int bootpartiti
 	 */
 	setroot_nfs(bootdv);
 
+
+	/*
+	 * Try to lookup by wedge label name
+	 */
+	if (bootdv == NULL && rootspec != NULL &&
+	strncmp(rootspec, "NAME=", 5) == 0) {
+		if ((bootdv = dkwedge_find_by_wname(rootspec + 5)) != NULL)
+			rootspec = bootdv->dv_xname;
+	}
+
 	/*
 	 * If no bootdv was found by MD code and no
 	 * root specified ask the user.



Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Simon Burge
Kamil Rytarowski wrote:

> I will revert it, but I am looking for a more generic approach.
>
> How about adding ifdef __NO_LEAKS like:
>
> #ifdef __NO_LEAKS
> free(3)?
> #endif
>
> And in lsan/asan/valgrind/etc checks use -D__NO_LEAKS.

Sorry if I'm missing something that has been already explained,
but why (practically) do we care about memory leaks for a utility
that is about to finish?

If we're doing some ugly #ifdef dance only when running the
sanitiser(s), then we haven't actually done anything to "fix"
the leak in the installed binaries so it seems that there was
no practical problem that we were trying to solve in the first
place.

Cheers,
Simon.


Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Kamil Rytarowski
On 12.09.2019 21:24, Robert Elz wrote:
> Date:Thu, 12 Sep 2019 15:12:25 +0200
> From:Kamil Rytarowski 
> Message-ID:  <2a6e1fb2-cedc-4a57-750b-45f101be9...@gmx.com>
> 
> 
>   | This proposal is practically equivalent of disabling leak detection at
>   | all and removes the whole purpose.
> 
> No it isn't.   Or rather, it might be, the way you describe LSan to
> work, but if that's what it is doing, then it is close to useless:
> 

Please note that in all arguments about leak sanitization, that it uses
internally the same mechanism as garbage collectors. lsan and libgc (and
others) also server similar purpose.

>   | Leak detection works simply by scanning memory (TLS, stacks, heap) for
>   | pointers to allocations. If there is no longer a reference, than there
>   | is a leak.
> 

I forgot to mention that there might be references to allocated objects
still in at least registers. Certain leaks could be skipped if at least
one thread still references it in a register.

> So the following code
> 
>   struct list {
>   struct list *prev;
>   struct list *next;
>   int age;
>   /* other stuff not relevant here */
>   };
> 
>   struct list *
>   new_list(int age1, int age2)
>   {
>   strust list *l1, *l2;
> 
>   l1 = malloc(sizeof *l1);/* check for NULL elided here */
>   l2 = malloc(sizeof *l2); /* ditto */
> 
>   l1->prev = NULL; l1->next = l2; l1->age = age1;
>   l2->prev = l1; l2->next = NULL; l2->age = age2;
> 
>   if (age1 > age2)
>   return NULL;
> 
>   return l1;
>   }
> 
> has no leak (in the case age1 > age2) ?   Scanning memory would see
> a pointer to *l1 (in *l2), and a pointer to *l2 (in *l1).  Both blocks
> of memory are referenced according to that trivial analysis.   Useless.
> 

LSan can detect indirect leaks:

$ ./test2

=
==14114==ERROR: LeakSanitizer: detected memory leaks

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x40ba65 in __interceptor_malloc
/public/llvm/projects/compiler-rt/lib/lsan/lsan_interceptors.cpp:54:3
#1 0x403915 in new_list (/tmp/./test2+0x403915)
#2 0x4039b4 in main (/tmp/./test2+0x4039b4)
#3 0x40381c in ___start (/tmp/./test2+0x40381c)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
#0 0x40ba65 in __interceptor_malloc
/public/llvm/projects/compiler-rt/lib/lsan/lsan_interceptors.cpp:54:3
#1 0x403907 in new_list (/tmp/./test2+0x403907)
#2 0x4039b4 in main (/tmp/./test2+0x4039b4)
#3 0x40381c in ___start (/tmp/./test2+0x40381c)

SUMMARY: LeakSanitizer: 48 byte(s) leaked in 2 allocation(s).

$ cat test2.c


#include 
#include 

struct list {
struct list *prev;
struct list *next;
int age;
/* other stuff not relevant here */
};

struct list *
new_list(int age1, int age2)
{
struct list *l1, *l2;

l1 = malloc(sizeof *l1);/* check for NULL elided
here */
l2 = malloc(sizeof *l2); /* ditto */

l1->prev = NULL; l1->next = l2; l1->age = age1;
l2->prev = l1; l2->next = NULL; l2->age = age2;

if (age1 > age2)
return NULL;

return l1;
}


int
main(int argc, char **argv)
{
struct list *l;

l = new_list(10,5);

return 0;
}


> The "close to" just above came from there being cases that it can find.
> 
> Because of this, I also looked at the change you pade to "fix" ps.
> You added
> 
>   free(pinfo);
> 
> But *pinfo (a struct pinfo) contains 3 pointers, each of which may
> refer to other malloc'd blocks.   Further, pinfo points to an array
> of those structs.   Because of the memory scan, those pointers (in each
> element of the array) will still have been seen, but when you free(pinfo)
> then those pointers can no longer be accessed (depending upon what the free()
> in use while the sanatiser is running does, they may not still exist
> in memory, or they might, just in a block that is now free).  Anyway
> the struct kinfo_proc2 struct kinfo_lwp and char * (prefix) entries in
> all the struct pinfo's are not being freed.  There was no leak before, but
> your "fix" introduced one (or three * N).
> 

No more leaks were reported, if there are any I will address them.

LSan/NetBSD still needs more work and it is not expected to be perfect.

> I'd suggest reverting the change you made, and instead make pinfo a
> global instead of a local in main - then its value will be seen still
> existing by the memory scan (LSan will be happy) and ps won't be wasting
> (a trivial amount of) time doing an incorrect (as it is now) free(), and
> we'll all be happier.
> 

I will revert it, but I am lo

CVS commit: src/external/bsd/wpa/dist/src/ap

2019-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 12 23:46:11 UTC 2019

Modified Files:
src/external/bsd/wpa/dist/src/ap: drv_callbacks.c ieee802_11.c

Log Message:
[PATCH] AP: Silently ignore management frame from unexpected source address

Do not process any received Management frames with unexpected/invalid SA
so that we do not add any state for unexpected STA addresses or end up
sending out frames to unexpected destination. This prevents unexpected
sequences where an unprotected frame might end up causing the AP to send
out a response to another device and that other device processing the
unexpected response.

In particular, this prevents some potential denial of service cases
where the unexpected response frame from the AP might result in a
connected station dropping its association.

Signed-off-by: Jouni Malinen 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/wpa/dist/src/ap/drv_callbacks.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/wpa/dist/src/ap/ieee802_11.c

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



CVS commit: src/external/bsd/wpa/dist/src/ap

2019-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 12 23:46:11 UTC 2019

Modified Files:
src/external/bsd/wpa/dist/src/ap: drv_callbacks.c ieee802_11.c

Log Message:
[PATCH] AP: Silently ignore management frame from unexpected source address

Do not process any received Management frames with unexpected/invalid SA
so that we do not add any state for unexpected STA addresses or end up
sending out frames to unexpected destination. This prevents unexpected
sequences where an unprotected frame might end up causing the AP to send
out a response to another device and that other device processing the
unexpected response.

In particular, this prevents some potential denial of service cases
where the unexpected response frame from the AP might result in a
connected station dropping its association.

Signed-off-by: Jouni Malinen 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/wpa/dist/src/ap/drv_callbacks.c
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/wpa/dist/src/ap/ieee802_11.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/wpa/dist/src/ap/drv_callbacks.c
diff -u src/external/bsd/wpa/dist/src/ap/drv_callbacks.c:1.4 src/external/bsd/wpa/dist/src/ap/drv_callbacks.c:1.5
--- src/external/bsd/wpa/dist/src/ap/drv_callbacks.c:1.4	Fri Jan  4 16:22:20 2019
+++ src/external/bsd/wpa/dist/src/ap/drv_callbacks.c	Thu Sep 12 19:46:11 2019
@@ -129,6 +129,19 @@ int hostapd_notif_assoc(struct hostapd_d
 			   "hostapd_notif_assoc: Skip event with no address");
 		return -1;
 	}
+
+	if (is_multicast_ether_addr(addr) ||
+	is_zero_ether_addr(addr) ||
+	os_memcmp(addr, hapd->own_addr, ETH_ALEN) == 0) {
+		/* Do not process any frames with unexpected/invalid SA so that
+		 * we do not add any state for unexpected STA addresses or end
+		 * up sending out frames to unexpected destination. */
+		wpa_printf(MSG_DEBUG, "%s: Invalid SA=" MACSTR
+			   " in received indication - ignore this indication silently",
+			   __func__, MAC2STR(addr));
+		return 0;
+	}
+
 	random_add_randomness(addr, ETH_ALEN);
 
 	hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,

Index: src/external/bsd/wpa/dist/src/ap/ieee802_11.c
diff -u src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.3 src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.4
--- src/external/bsd/wpa/dist/src/ap/ieee802_11.c:1.3	Fri Jan  4 16:22:20 2019
+++ src/external/bsd/wpa/dist/src/ap/ieee802_11.c	Thu Sep 12 19:46:11 2019
@@ -3978,6 +3978,18 @@ int ieee802_11_mgmt(struct hostapd_data 
 	fc = le_to_host16(mgmt->frame_control);
 	stype = WLAN_FC_GET_STYPE(fc);
 
+	if (is_multicast_ether_addr(mgmt->sa) ||
+	is_zero_ether_addr(mgmt->sa) ||
+	os_memcmp(mgmt->sa, hapd->own_addr, ETH_ALEN) == 0) {
+		/* Do not process any frames with unexpected/invalid SA so that
+		 * we do not add any state for unexpected STA addresses or end
+		 * up sending out frames to unexpected destination. */
+		wpa_printf(MSG_DEBUG, "MGMT: Invalid SA=" MACSTR
+			   " in received frame - ignore this frame silently",
+			   MAC2STR(mgmt->sa));
+		return 0;
+	}
+
 	if (stype == WLAN_FC_STYPE_BEACON) {
 		handle_beacon(hapd, mgmt, len, fi);
 		return 1;



CVS commit: src/usr.sbin/postinstall

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 21:56:55 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude_libs - redirect ls 2> /dev/null so that the user is not
spammed with errors for directories without any libraries; the most
common case in the wild would be empty /usr/libdata/debug.  Add -d to
ls for good measure while here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.5 src/usr.sbin/postinstall/postinstall.in:1.6
--- src/usr.sbin/postinstall/postinstall.in:1.5	Sat Jun 15 13:07:09 2019
+++ src/usr.sbin/postinstall/postinstall.in	Thu Sep 12 21:56:55 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.5 2019/06/15 13:07:09 christos Exp $
+# $NetBSD: postinstall.in,v 1.6 2019/09/12 21:56:55 uwe Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -591,7 +591,7 @@ exclude()
 # from consideration for removal
 #
 exclude_libs() {
-	local target="$(ls -l lib*.so.* \
+	local target="$(ls -l -d lib*.so.* 2> /dev/null \
 	| ${AWK} '{ print $11; }' \
 	| ${SED} -e 's@.*/@@' | ${SORT} -u)"
 	exclude -t ${target}



CVS commit: src/usr.sbin/postinstall

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 21:56:55 UTC 2019

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
exclude_libs - redirect ls 2> /dev/null so that the user is not
spammed with errors for directories without any libraries; the most
common case in the wild would be empty /usr/libdata/debug.  Add -d to
ls for good measure while here.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/postinstall/postinstall.in

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



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 21:37:06 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
typo: ARCH_EXTRA -> ARCHS_EXTRA


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.44 src/sys/rump/listsrcdirs:1.45
--- src/sys/rump/listsrcdirs:1.44	Thu Sep 12 21:10:19 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 21:37:06 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.44 2019/09/12 21:10:19 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.45 2019/09/12 21:37:06 bad Exp $
 #
 
 #
@@ -81,7 +81,7 @@ include_headerlist ()
 ARCHS="amd64 i386 x86 arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv"
 ARCHS_EXTRA="arm/arm32 Makefile"
 # files listed in src/tools/Makefile.nbincludes
-ARCH_EXTRA="$ARCH_EXTRA ews4800mips/include/pdinfo.h
+ARCHS_EXTRA="$ARCHS_EXTRA ews4800mips/include/pdinfo.h
 ews4800mips/include/vtoc.h
 dreamcast/include/endian_machdep.h
 evbsh3/include/endian_machdep.h



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 21:37:06 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
typo: ARCH_EXTRA -> ARCHS_EXTRA


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/listsrcdirs

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



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 21:10:19 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Add ews4800mips and sh3 heads only listed in src/tools/Makefile.nbincludes.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.43 src/sys/rump/listsrcdirs:1.44
--- src/sys/rump/listsrcdirs:1.43	Thu Sep 12 20:10:00 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 21:10:19 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.43 2019/09/12 20:10:00 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.44 2019/09/12 21:10:19 bad Exp $
 #
 
 #
@@ -80,6 +80,15 @@ include_headerlist ()
 
 ARCHS="amd64 i386 x86 arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv"
 ARCHS_EXTRA="arm/arm32 Makefile"
+# files listed in src/tools/Makefile.nbincludes
+ARCH_EXTRA="$ARCH_EXTRA ews4800mips/include/pdinfo.h
+ews4800mips/include/vtoc.h
+dreamcast/include/endian_machdep.h
+evbsh3/include/endian_machdep.h
+hpcsh/include/endian_machdep.h
+landisk/include/endian_machdep.h
+mmeye/include/endian_machdep.h
+sh3/include/endian_machdep.h"
 
 # sources necessary for building rump kernel components.  This list
 # depends on TOOLS_BUILDRUMP=yes.



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 21:10:19 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Add ews4800mips and sh3 heads only listed in src/tools/Makefile.nbincludes.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/listsrcdirs

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



CVS commit: src/share/man/man9

2019-09-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Sep 12 21:08:35 UTC 2019

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

Log Message:
struct buf is typedefed to buf_t
specify the width argument for Bl


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/bufferio.9

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



CVS commit: src/share/man/man9

2019-09-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Sep 12 21:08:35 UTC 2019

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

Log Message:
struct buf is typedefed to buf_t
specify the width argument for Bl


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/share/man/man9/bufferio.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/bufferio.9
diff -u src/share/man/man9/bufferio.9:1.17 src/share/man/man9/bufferio.9:1.18
--- src/share/man/man9/bufferio.9:1.17	Sat Mar 18 19:01:01 2017
+++ src/share/man/man9/bufferio.9	Thu Sep 12 21:08:35 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bufferio.9,v 1.17 2017/03/18 19:01:01 riastradh Exp $
+.\"	$NetBSD: bufferio.9,v 1.18 2019/09/12 21:08:35 sevan Exp $
 .\"
 .\" Copyright (c) 2015 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 March 29, 2015
+.Dd September 12, 2019
 .Dt BUFFERIO 9
 .Os
 .Sh NAME
@@ -42,18 +42,18 @@
 .Sh SYNOPSIS
 .In sys/buf.h
 .Ft void
-.Fn biodone "struct buf *bp"
+.Fn biodone "buf_t *bp"
 .Ft int
-.Fn biowait "struct buf *bp"
-.Ft struct buf *
+.Fn biowait "buf_t *bp"
+.Ft buf_t *
 .Fn getiobuf "struct vnode *vp" "bool waitok"
 .Ft void
-.Fn putiobuf "struct buf *bp"
+.Fn putiobuf "buf_t *bp"
 .Ft void
-.Fn nestiobuf_setup "struct buf *mbp" "struct buf *bp" "int offset" \
+.Fn nestiobuf_setup "buf_t *mbp" "buf_t *bp" "int offset" \
 "size_t size"
 .Ft void
-.Fn nestiobuf_done "struct buf *mbp" "int donebytes" "int error"
+.Fn nestiobuf_done "buf_t *mbp" "int donebytes" "int error"
 .Sh DESCRIPTION
 The
 .Nm
@@ -82,10 +82,10 @@ The parameters to an I/O transfer descri
 are specified by the following
 .Vt "struct buf"
 fields:
-.Bl -tag -offset abcd
+.Bl -tag -width 6n -offset abcd
 .It Fa bp Ns Li "->b_flags"
 Flags specifying the type of transfer.
-.Bl -tag -compact
+.Bl -tag -width 6n -compact
 .It Dv B_READ
 Transfer is read from device.
 If not set, transfer is write to device.
@@ -283,10 +283,10 @@ member of
 .Pq Xr driver 9 ,
 to queue a buffer for disk I/O.
 The inputs to the strategy method are:
-.Bl -tag -offset abcd
+.Bl -tag -width 6n -offset abcd
 .It Fa bp Ns Li "->b_flags"
 Flags specifying the type of transfer.
-.Bl -tag -compact
+.Bl -tag -width 6n -compact
 .It Dv B_READ
 Transfer is read from device.
 If not set, transfer is write to device.
@@ -305,7 +305,7 @@ it must additionally initialize the foll
 .Fa bp
 with
 .Xr bufq_put 9 :
-.Bl -tag -offset abcd
+.Bl -tag -width 6n -offset abcd
 .It Fa bp Ns Li "->b_rawblkno"
 Block number relative to volume start.
 .El



CVS commit: src/share/man/man9

2019-09-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Sep 12 20:32:31 UTC 2019

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

Log Message:
Update parameter list, struct buf is typedefed to buf_t


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/physio.9

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



CVS commit: src/share/man/man9

2019-09-12 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Sep 12 20:32:31 UTC 2019

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

Log Message:
Update parameter list, struct buf is typedefed to buf_t


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/physio.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/physio.9
diff -u src/share/man/man9/physio.9:1.11 src/share/man/man9/physio.9:1.12
--- src/share/man/man9/physio.9:1.11	Tue Apr 13 10:06:43 2010
+++ src/share/man/man9/physio.9	Thu Sep 12 20:32:30 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: physio.9,v 1.11 2010/04/13 10:06:43 jruoho Exp $
+.\"	$NetBSD: physio.9,v 1.12 2019/09/12 20:32:30 sevan Exp $
 .\"
 .\" Copyright (c) 1996 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 April 13, 2010
+.Dd September 12, 2019
 .Dt PHYSIO 9
 .Os
 .Sh NAME
@@ -36,11 +36,11 @@
 .Sh SYNOPSIS
 .Ft int
 .Fo "physio"
-.Fa "(*strategy)(struct buf *)"
-.Fa "struct buf *bp"
+.Fa "void (*strategy)(buf_t *)"
+.Fa "buf_t *bp"
 .Fa "dev_t dev"
 .Fa "int flags"
-.Fa "(*minphys)(struct buf *)"
+.Fa "void (*minphys)(buf_t *)"
 .Fa "struct uio *uio"
 .Fc
 .Sh DESCRIPTION



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 20:10:00 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Make include_headerlist ignore files in already exported directories.
Invoke include_headerlist after exporting the ARCHS directories.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.42 src/sys/rump/listsrcdirs:1.43
--- src/sys/rump/listsrcdirs:1.42	Thu Sep 12 18:28:05 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 20:10:00 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.42 2019/09/12 18:28:05 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.43 2019/09/12 20:10:00 bad Exp $
 #
 
 #
@@ -73,7 +73,8 @@ include_headerlist ()
 		[ -f headerlist ] \
 			|| { echo 'missing file: headerlist' 1>&2; exit 1; }
 		sed -E -e '/^#/d' -e '/^[  ]*$/d' \
-		-e "/^\.?\/?/s##src${pfx}#" headerlist
+		-e "/^\.?\/?/s##src${pfx}#" headerlist \
+		| egrep -v "^src${pfx}($(echo "$@" | tr ' ' \|))/include"
 	fi
 }
 
@@ -140,15 +141,14 @@ if ${cvsmode}; then
 	echo \!src/external/bsd/libc++/dist/libcxx/test \
 	   src/external/bsd/libc++
 
-	# the includes mentioned in src/tools/headerlist are required.
-	# pull them in first or else CVS export will complain if they
-	# have been checked out as one of the usefule archs.
-	include_headerlist sys /sys/arch/
-
 	# pick a few useful archs, namely those mentioned in buildrump.sh
 	for arch in ${ARCHS}; do
 		lsrc sys /sys/arch/${arch}/ include ${arch} Makefile
 	done
+	# the includes mentioned in src/tools/headerlist are required.
+	# but pull in only those that have not been pulled in by the previous
+	# loop
+	include_headerlist sys /sys/arch/ ${ARCHS}
 	for extra in ${ARCHS_EXTRA}; do
 		lsrc sys /sys/arch/ ${extra}
 	done



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 20:10:00 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Make include_headerlist ignore files in already exported directories.
Invoke include_headerlist after exporting the ARCHS directories.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/rump/listsrcdirs

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



Re: CVS commit: src/bin/ps

2019-09-12 Thread Joerg Sonnenberger
On Thu, Sep 12, 2019 at 01:52:19AM +0100, Roy Marples wrote:
> On 11/09/2019 20:03, Robert Elz wrote:
> >  Date:Wed, 11 Sep 2019 17:02:53 +
> >  From:"Kamil Rytarowski" 
> >  Message-ID:  <20190911170253.d097ff...@cvs.netbsd.org>
> > 
> >| Free it when no longer used, just before the program termination.
> > 
> > Can we please avoid this kind of nonsense.   Everything is freed when
> > every program exits - doing explicit free() calls makes the program bigger
> > and slower for no reason at all.
> > 
> > By all means fix places where memory is truly leaked (whenre more is
> > continuously allocated, and simply discarded) but anything that is supposed
> > to remain until program exit should simply go away when the exit happens.
> > 
> > If the canitisers cannot be instructed to ignore such things, they are
> > much less useful tan they could be.
> 
> Could we add an #ifdef for this?
> 
> #ifdef __SANITISATION
> free(foo);
> close(bar);
> #endif
> 
> return EXIT_SUCCESS;

That's kind of how coverity and valgrind dealt with it.

Joerg


Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Robert Elz
Date:Thu, 12 Sep 2019 15:12:25 +0200
From:Kamil Rytarowski 
Message-ID:  <2a6e1fb2-cedc-4a57-750b-45f101be9...@gmx.com>


  | This proposal is practically equivalent of disabling leak detection at
  | all and removes the whole purpose.

No it isn't.   Or rather, it might be, the way you describe LSan to
work, but if that's what it is doing, then it is close to useless:

  | Leak detection works simply by scanning memory (TLS, stacks, heap) for
  | pointers to allocations. If there is no longer a reference, than there
  | is a leak.

So the following code

struct list {
struct list *prev;
struct list *next;
int age;
/* other stuff not relevant here */
};

struct list *
new_list(int age1, int age2)
{
strust list *l1, *l2;

l1 = malloc(sizeof *l1);/* check for NULL elided here */
l2 = malloc(sizeof *l2); /* ditto */

l1->prev = NULL; l1->next = l2; l1->age = age1;
l2->prev = l1; l2->next = NULL; l2->age = age2;

if (age1 > age2)
return NULL;

return l1;
}

has no leak (in the case age1 > age2) ?   Scanning memory would see
a pointer to *l1 (in *l2), and a pointer to *l2 (in *l1).  Both blocks
of memory are referenced according to that trivial analysis.   Useless.

The "close to" just above came from there being cases that it can find.

Because of this, I also looked at the change you pade to "fix" ps.
You added

free(pinfo);

But *pinfo (a struct pinfo) contains 3 pointers, each of which may
refer to other malloc'd blocks.   Further, pinfo points to an array
of those structs.   Because of the memory scan, those pointers (in each
element of the array) will still have been seen, but when you free(pinfo)
then those pointers can no longer be accessed (depending upon what the free()
in use while the sanatiser is running does, they may not still exist
in memory, or they might, just in a block that is now free).  Anyway
the struct kinfo_proc2 struct kinfo_lwp and char * (prefix) entries in
all the struct pinfo's are not being freed.  There was no leak before, but
your "fix" introduced one (or three * N).

I'd suggest reverting the change you made, and instead make pinfo a
global instead of a local in main - then its value will be seen still
existing by the memory scan (LSan will be happy) and ps won't be wasting
(a trivial amount of) time doing an incorrect (as it is now) free(), and
we'll all be happier.

Incidentally, what happens with code like:

struct foo {
int a, b, c;
};

int *
make_foo(int a, int b, int c)
{
struct foo *p;

p = malloc(sizeof *p);  /* again NULL check elided here 
*/
p->a = a; p->b = b; p->c = c;

return (&p->b);
}

int * global_ptr;

main()
{
global_ptr = make_foo(1,2,3);

/* ... */

{
struct foo *p;

p = (struct foo *)((intptr_t)global_ptr -
 offsetof(struct foo, b));

p->a++;
}

/* ... */
}

Ugly (and stupid) but not illegal I think.   The more common case is
a list where the back pointers point at the forward pointer, rather
than at the struct itself, so one can do

if ((*(p->back) = p->next) != NULL)
p->next->back = p->back
free(p);

to delete an element from the middle of a list easily - which works
even if the element to be deleted is first or last.   There if the
next field is the first in the struct, the back field will refer to
the malloc's memory block (by accident) but if it isn't, it won't.

  | I have not investigated where are the sh(1) leaks,

As far as I know it doesn't.   What I said is that it does not free
memory it allocates before it exits.  That is not a leak.

  | In sanitizers we cannot overload or do anything special with main()
  | (such as replace it with our own copy).

That wasn't the suggestion.   However, what was assumed a more rational
leak detection algorithm than appears to be in use - I agree, by simply
scanning memory you cannot do anything special with main() as when the
code runs, apparently, main's stack frame has already gone.

But were this done a different way -- the right way is to annotate, in the
code, all assignments to pointers , and add a ref counter to all allocated
memory blocks - when a pointer is assigned, and it points to something
allocated, then incr the ref count.  Whan the value of a pointer is
overwritten, and it used to point to allocated memory, decr the ref count.
If that decrease drops it to 0, then memory has been leaked.  In the
exit code for every 

CVS commit: [netbsd-9] src/doc

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:21:16 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Ticket #195


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/doc/CHANGES-9.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-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.48 src/doc/CHANGES-9.0:1.1.2.49
--- src/doc/CHANGES-9.0:1.1.2.48	Wed Sep 11 16:37:07 2019
+++ src/doc/CHANGES-9.0	Thu Sep 12 19:21:16 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.48 2019/09/11 16:37:07 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.49 2019/09/12 19:21:16 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -2937,3 +2937,545 @@ sys/netinet/tcp_usrreq.c			1.225
 	Clamp tcp timer quantities to reasonable ranges.
 	[maxv, ticket #193]
 
+external/mpl/bind/dist/bin/pkcs11/Makefile  up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/pkcs11/benchmarks/Makefile up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/pkcs11/Makefile up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/additional/ns1/root.db up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/additional/ns3/ex.db up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/additional/ns3/ex2.db up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/checkconf/good-dup-managed-key.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/checkconf/good-dup-trusted-key.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/checkconf/warn-duplicate-key.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/checkconf/warn-duplicate-root-key.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/checkconf/warn-validation-auto-key.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/cookie/bad-cookie-badaes.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/cookie/bad-cookie-badsiphash24.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/cookie/good-cookie-aes.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/cookie/good-cookie-siphash24.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dlv/ns7/hints up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dlv/ns7/named.conf.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dlv/ns8/hints up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dlv/ns8/named.conf.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dlzexternal/ns1/dlzs.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/bad18.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/bad19.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn1.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn2.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn3.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn4.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn5.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn6.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn7.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dns64/conf/warn8.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnssec/ns2/key.db.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnssec/ns2/template.secure.db.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnssec/ns3/key.db.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnssec/ns8/named.conf.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnssec/ns9/named.conf.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnstap/README up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnstap/bad-missing-dnstap-output.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/dnstap/large-answer.fstrm up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+09713.key up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+09713.private up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+38353.key up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/eddsa/ns2/Xexample.com.+016+38353.private up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip/ns2/named16.conf.in up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-areacode.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-dbname.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-netspeed.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-regiondb.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/bad-threeletter.conf up to 1.1.1.1
+external/mpl/bind/dist/bin/tests/system/geoip2/conf/good-options.conf up to 1.1.1.1
+external/mpl/bind/d

CVS commit: [netbsd-9] src/doc

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:21:16 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Ticket #195


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.48 -r1.1.2.49 src/doc/CHANGES-9.0

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



CVS commit: [netbsd-9] src

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:18:19 UTC 2019

Modified Files:
src/distrib/sets/lists/base [netbsd-9]: shl.mi
src/distrib/sets/lists/debug [netbsd-9]: shl.mi
src/external/mpl/bind [netbsd-9]: Makefile.inc
src/external/mpl/bind/bin/named [netbsd-9]: Makefile
src/external/mpl/bind/dist [netbsd-9]: CHANGES CONTRIBUTING HISTORY
Makefile.in OPTIONS PLATFORMS PLATFORMS.md README README.md
aclocal.m4 config.h.in config.h.win32 configure configure.ac srcid
version
src/external/mpl/bind/dist/bin/check [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/confgen [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/delv [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/dig [netbsd-9]: Makefile.in dig.1 dig.c
dig.docbook dig.html dighost.c
src/external/mpl/bind/dist/bin/dnssec [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/named [netbsd-9]: Makefile.in bind9.xsl
bind9.xsl.h config.c fuzz.c geoip.c main.c named.conf.5
named.conf.docbook named.conf.html server.c statschannel.c
zoneconf.c
src/external/mpl/bind/dist/bin/named/include/named [netbsd-9]: geoip.h
globals.h
src/external/mpl/bind/dist/bin/named/unix [netbsd-9]:
dlz_dlopen_driver.c
src/external/mpl/bind/dist/bin/named/win32 [netbsd-9]:
named.vcxproj.filters.in named.vcxproj.in ntservice.c os.c
src/external/mpl/bind/dist/bin/nsupdate [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/pkcs11 [netbsd-9]: pkcs11-keygen.c
src/external/mpl/bind/dist/bin/plugins [netbsd-9]: Makefile.in
filter-.c
src/external/mpl/bind/dist/bin/rndc [netbsd-9]: Makefile.in rndc.8
rndc.docbook rndc.html
src/external/mpl/bind/dist/bin/tests [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/tests/optional [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/tests/system [netbsd-9]: Makefile.in
conf.sh.common conf.sh.in conf.sh.win32 feature-test.c genzone.sh
ifconfig.bat ifconfig.sh run.sh runall.sh stop.pl
src/external/mpl/bind/dist/bin/tests/system/additional [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/additional/ns1 [netbsd-9]:
named1.conf.in named2.conf.in named3.conf.in named4.conf.in
naptr.db naptr2.db nid.db rt.db rt2.db
src/external/mpl/bind/dist/bin/tests/system/additional/ns3 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/allow-query/ns1 [netbsd-9]:
root.db
src/external/mpl/bind/dist/bin/tests/system/autosign [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cacheclean [netbsd-9]:
clean.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/cds [netbsd-9]: setup.sh
src/external/mpl/bind/dist/bin/tests/system/checkconf [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cookie [netbsd-9]: clean.sh
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cookie/ns4 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/cookie/ns5 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/cookie/ns6 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/digdelv [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/digdelv/ns2 [netbsd-9]:
sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv [netbsd-9]: clean.sh
setup.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns1 [netbsd-9]:
root.db.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns2 [netbsd-9]:
named.conf.in utld.db
src/external/mpl/bind/dist/bin/tests/system/dlv/ns3 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns5 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/dlzexternal [netbsd-9]:
driver.c
src/external/mpl/bind/dist/bin/tests/system/dns64 [netbsd-9]: clean.sh
tests.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec [netbsd-9]: README
clean.sh setup.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns1 [netbsd-9]:
root.db.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns2 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns3 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns5 [netbsd-9]:
sign.sh
src/ex

CVS commit: [netbsd-9] src

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 19:18:19 UTC 2019

Modified Files:
src/distrib/sets/lists/base [netbsd-9]: shl.mi
src/distrib/sets/lists/debug [netbsd-9]: shl.mi
src/external/mpl/bind [netbsd-9]: Makefile.inc
src/external/mpl/bind/bin/named [netbsd-9]: Makefile
src/external/mpl/bind/dist [netbsd-9]: CHANGES CONTRIBUTING HISTORY
Makefile.in OPTIONS PLATFORMS PLATFORMS.md README README.md
aclocal.m4 config.h.in config.h.win32 configure configure.ac srcid
version
src/external/mpl/bind/dist/bin/check [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/confgen [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/delv [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/dig [netbsd-9]: Makefile.in dig.1 dig.c
dig.docbook dig.html dighost.c
src/external/mpl/bind/dist/bin/dnssec [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/named [netbsd-9]: Makefile.in bind9.xsl
bind9.xsl.h config.c fuzz.c geoip.c main.c named.conf.5
named.conf.docbook named.conf.html server.c statschannel.c
zoneconf.c
src/external/mpl/bind/dist/bin/named/include/named [netbsd-9]: geoip.h
globals.h
src/external/mpl/bind/dist/bin/named/unix [netbsd-9]:
dlz_dlopen_driver.c
src/external/mpl/bind/dist/bin/named/win32 [netbsd-9]:
named.vcxproj.filters.in named.vcxproj.in ntservice.c os.c
src/external/mpl/bind/dist/bin/nsupdate [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/pkcs11 [netbsd-9]: pkcs11-keygen.c
src/external/mpl/bind/dist/bin/plugins [netbsd-9]: Makefile.in
filter-.c
src/external/mpl/bind/dist/bin/rndc [netbsd-9]: Makefile.in rndc.8
rndc.docbook rndc.html
src/external/mpl/bind/dist/bin/tests [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/tests/optional [netbsd-9]: Makefile.in
src/external/mpl/bind/dist/bin/tests/system [netbsd-9]: Makefile.in
conf.sh.common conf.sh.in conf.sh.win32 feature-test.c genzone.sh
ifconfig.bat ifconfig.sh run.sh runall.sh stop.pl
src/external/mpl/bind/dist/bin/tests/system/additional [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/additional/ns1 [netbsd-9]:
named1.conf.in named2.conf.in named3.conf.in named4.conf.in
naptr.db naptr2.db nid.db rt.db rt2.db
src/external/mpl/bind/dist/bin/tests/system/additional/ns3 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/allow-query/ns1 [netbsd-9]:
root.db
src/external/mpl/bind/dist/bin/tests/system/autosign [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cacheclean [netbsd-9]:
clean.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/cds [netbsd-9]: setup.sh
src/external/mpl/bind/dist/bin/tests/system/checkconf [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cookie [netbsd-9]: clean.sh
tests.sh
src/external/mpl/bind/dist/bin/tests/system/cookie/ns4 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/cookie/ns5 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/cookie/ns6 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/digdelv [netbsd-9]:
tests.sh
src/external/mpl/bind/dist/bin/tests/system/digdelv/ns2 [netbsd-9]:
sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv [netbsd-9]: clean.sh
setup.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns1 [netbsd-9]:
root.db.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns2 [netbsd-9]:
named.conf.in utld.db
src/external/mpl/bind/dist/bin/tests/system/dlv/ns3 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dlv/ns5 [netbsd-9]:
named.conf.in
src/external/mpl/bind/dist/bin/tests/system/dlzexternal [netbsd-9]:
driver.c
src/external/mpl/bind/dist/bin/tests/system/dns64 [netbsd-9]: clean.sh
tests.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec [netbsd-9]: README
clean.sh setup.sh tests.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns1 [netbsd-9]:
root.db.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns2 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns3 [netbsd-9]:
named.conf.in sign.sh
src/external/mpl/bind/dist/bin/tests/system/dnssec/ns5 [netbsd-9]:
sign.sh
src/ex

CVS commit: src/sys/ddb

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 18:43:02 UTC 2019

Modified Files:
src/sys/ddb: db_output.c

Log Message:
db_putchar - check if we need to wrap at $maxwidth after whitespace.
That fixes orphaned first character in something like:

|Stopped in ... longsymbol+0xf00:  |
|i
|nsn


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/ddb/db_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/ddb

2019-09-12 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Sep 12 18:43:02 UTC 2019

Modified Files:
src/sys/ddb: db_output.c

Log Message:
db_putchar - check if we need to wrap at $maxwidth after whitespace.
That fixes orphaned first character in something like:

|Stopped in ... longsymbol+0xf00:  |
|i
|nsn


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/ddb/db_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/ddb/db_output.c
diff -u src/sys/ddb/db_output.c:1.34 src/sys/ddb/db_output.c:1.35
--- src/sys/ddb/db_output.c:1.34	Sun Sep 16 23:18:55 2018
+++ src/sys/ddb/db_output.c	Thu Sep 12 18:43:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $	*/
+/*	$NetBSD: db_output.c,v 1.35 2019/09/12 18:43:02 uwe Exp $	*/
 
 /*
  * Mach Operating System
@@ -35,7 +35,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.34 2018/09/16 23:18:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_output.c,v 1.35 2019/09/12 18:43:02 uwe Exp $");
 
 #include 
 #include 
@@ -103,6 +103,24 @@ db_force_whitespace(void)
 	db_last_non_space = db_output_position;
 }
 
+
+/*
+ * End the current line if we it exceeds $maxwidth
+ */
+static void
+db_check_wrap(void)
+{
+
+	if (db_max_width >= DB_MIN_MAX_WIDTH
+	&& db_output_position >= db_max_width) {
+		cnputc('\n');
+		db_output_position = 0;
+		db_last_non_space = 0;
+		db_output_line++;
+	}
+}
+
+
 static void
 db_more(void)
 {
@@ -148,16 +166,10 @@ db_putchar(int c)
 		 * Use tabs if possible.
 		 */
 		db_force_whitespace();
+		db_check_wrap();
 		cnputc(c);
 		db_output_position++;
-		if (db_max_width >= DB_MIN_MAX_WIDTH
-		&& db_output_position >= db_max_width) {
-			/* auto new line */
-			cnputc('\n');
-			db_output_position = 0;
-			db_last_non_space = 0;
-			db_output_line++;
-		}
+		db_check_wrap();
 		db_last_non_space = db_output_position;
 	} else if (c == '\n') {
 		/* Return */



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 18:28:05 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: export the files from headerlist before the ARCHS's includes.
Or else cvs export will complain about them being in the way.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.41 src/sys/rump/listsrcdirs:1.42
--- src/sys/rump/listsrcdirs:1.41	Thu Sep 12 17:35:58 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 18:28:05 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.41 2019/09/12 17:35:58 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.42 2019/09/12 18:28:05 bad Exp $
 #
 
 #
@@ -140,6 +140,11 @@ if ${cvsmode}; then
 	echo \!src/external/bsd/libc++/dist/libcxx/test \
 	   src/external/bsd/libc++
 
+	# the includes mentioned in src/tools/headerlist are required.
+	# pull them in first or else CVS export will complain if they
+	# have been checked out as one of the usefule archs.
+	include_headerlist sys /sys/arch/
+
 	# pick a few useful archs, namely those mentioned in buildrump.sh
 	for arch in ${ARCHS}; do
 		lsrc sys /sys/arch/${arch}/ include ${arch} Makefile
@@ -147,8 +152,6 @@ if ${cvsmode}; then
 	for extra in ${ARCHS_EXTRA}; do
 		lsrc sys /sys/arch/ ${extra}
 	done
-	# the includes mentioned in src/tools/headerlist are required
-	include_headerlist sys /sys/arch/
 else
 	lsrc sys / sys
 



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 18:28:05 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: export the files from headerlist before the ARCHS's includes.
Or else cvs export will complain about them being in the way.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/rump/listsrcdirs

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



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 17:35:58 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: add the files from src/tools/headerlist to the output.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/listsrcdirs

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



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 17:35:58 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: add the files from src/tools/headerlist to the output.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.40 src/sys/rump/listsrcdirs:1.41
--- src/sys/rump/listsrcdirs:1.40	Thu Sep 12 15:17:08 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 17:35:58 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.40 2019/09/12 15:17:08 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.41 2019/09/12 17:35:58 bad Exp $
 #
 
 #
@@ -63,6 +63,20 @@ lsrc ()
 	iswanted ${what} && for arg in $* ; do echo src${pfx}${arg} ; done
 }
 
+include_headerlist ()
+{
+	what=$1
+	pfx=$2
+	shift 2
+
+	if iswanted ${what}; then
+		[ -f headerlist ] \
+			|| { echo 'missing file: headerlist' 1>&2; exit 1; }
+		sed -E -e '/^#/d' -e '/^[  ]*$/d' \
+		-e "/^\.?\/?/s##src${pfx}#" headerlist
+	fi
+}
+
 ARCHS="amd64 i386 x86 arm evbarm sparc sparc64 powerpc evbppc mips evbmips aarch64 riscv"
 ARCHS_EXTRA="arm/arm32 Makefile"
 
@@ -133,6 +147,8 @@ if ${cvsmode}; then
 	for extra in ${ARCHS_EXTRA}; do
 		lsrc sys /sys/arch/ ${extra}
 	done
+	# the includes mentioned in src/tools/headerlist are required
+	include_headerlist sys /sys/arch/
 else
 	lsrc sys / sys
 



CVS commit: src/sys/ddb

2019-09-12 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 12 17:09:00 UTC 2019

Modified Files:
src/sys/ddb: db_access.c

Log Message:
db_get_qvalue() with size=8 on 64bit arch returns incorrect value. fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/ddb/db_access.c

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



CVS commit: src/sys/ddb

2019-09-12 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 12 17:09:00 UTC 2019

Modified Files:
src/sys/ddb: db_access.c

Log Message:
db_get_qvalue() with size=8 on 64bit arch returns incorrect value. fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/ddb/db_access.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/ddb/db_access.c
diff -u src/sys/ddb/db_access.c:1.25 src/sys/ddb/db_access.c:1.26
--- src/sys/ddb/db_access.c:1.25	Thu Sep 12 09:20:23 2019
+++ src/sys/ddb/db_access.c	Thu Sep 12 17:09:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $	*/
+/*	$NetBSD: db_access.c,v 1.26 2019/09/12 17:09:00 ryo Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.26 2019/09/12 17:09:00 ryo Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_kgdb.h"
@@ -87,7 +87,7 @@ db_get_qvalue(db_addr_t addr, size_t siz
 {
 	uint64_t data;
 
-	if (sizeof(db_expr_t) >= sizeof(quad_t) || size <= sizeof(db_expr_t)) {
+	if (size < sizeof(uint64_t)) {
 		if (is_signed)
 			return db_get_value(addr, size, true);
 		return (uint32_t)db_get_value(addr, size, false);



CVS commit: src/external/mpl/bind/dist

2019-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 12 17:04:18 UTC 2019

Removed Files:
src/external/mpl/bind/dist: o

Log Message:
remove bad file


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 src/external/mpl/bind/dist/o

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



CVS commit: src/external/mpl/bind/dist

2019-09-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Sep 12 17:04:18 UTC 2019

Removed Files:
src/external/mpl/bind/dist: o

Log Message:
remove bad file


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 src/external/mpl/bind/dist/o

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



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 15:17:08 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: pax needs pack_dev.h from mknod. move mknod to sys sources


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/listsrcdirs

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

Modified files:

Index: src/sys/rump/listsrcdirs
diff -u src/sys/rump/listsrcdirs:1.39 src/sys/rump/listsrcdirs:1.40
--- src/sys/rump/listsrcdirs:1.39	Thu Sep 12 00:56:05 2019
+++ src/sys/rump/listsrcdirs	Thu Sep 12 15:17:08 2019
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: listsrcdirs,v 1.39 2019/09/12 00:56:05 bad Exp $
+#	$NetBSD: listsrcdirs,v 1.40 2019/09/12 15:17:08 bad Exp $
 #
 
 #
@@ -82,6 +82,7 @@ lsrc sys /usr.bin/		lorder join cksum m4
 lsrc sys /usr.bin/		rpcgen rump_wmd
 lsrc sys /usr.bin/		genassym grep stat uname
 lsrc sys /usr.sbin/		mtree
+lsrc sys /sbin/			mknod
 
 # sources hosted in the NetBSD tree that are required/useful
 # when targeting POSIX-y platforms
@@ -101,7 +102,7 @@ lsrc usr /bin/			rm rmdir
 lsrc usr /sbin/			brconfig cgdconfig chown
 lsrc usr /sbin/			disklabel dump fdisk
 lsrc usr /sbin/			fsck fsck_ext2fs fsck_ffs fsck_msdos
-lsrc usr /sbin/			ifconfig mknod
+lsrc usr /sbin/			ifconfig
 lsrc usr /sbin/			modstat mount
 lsrc usr /sbin/			mount_ext2fs mount_ffs mount_msdos mount_tmpfs
 lsrc usr /sbin/			newfs newfs_ext2fs newfs_msdos



CVS commit: src/sys/rump

2019-09-12 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Thu Sep 12 15:17:08 UTC 2019

Modified Files:
src/sys/rump: listsrcdirs

Log Message:
Summary: pax needs pack_dev.h from mknod. move mknod to sys sources


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/listsrcdirs

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



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

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 14:28:09 UTC 2019

Modified Files:
src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
Cast physical addresses via uintptr_t to ACPI_PHYSICAL_ADDRESS to deal
with all size variants of the types used here in different builds.
Patch from manu@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/acpi/acpi_machdep.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.27 src/sys/arch/x86/acpi/acpi_machdep.c:1.28
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.27	Thu Sep 12 00:52:22 2019
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Thu Sep 12 14:28:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.27 2019/09/12 00:52:22 manu Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.28 2019/09/12 14:28:08 martin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.27 2019/09/12 00:52:22 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.28 2019/09/12 14:28:08 martin Exp $");
 
 #include 
 #include 
@@ -126,8 +126,8 @@ acpi_md_OsGetRootPointer(void)
 		for (i = 0; i < info->cfg.nent; i++) {
 	if (memcmp(&ct[i].ct_uuid,
 			&EFI_UUID_ACPI20, sizeof(EFI_UUID_ACPI20)) == 0) {
-PhysicalAddress =
-(ACPI_PHYSICAL_ADDRESS)ct[i].ct_data;
+PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
+(uintptr_t)ct[i].ct_data;
 if (PhysicalAddress)
 	goto out;
 	
@@ -137,8 +137,8 @@ acpi_md_OsGetRootPointer(void)
 		for (i = 0; i < info->cfg.nent; i++) {
 	if (memcmp(&ct[i].ct_uuid,
 			&EFI_UUID_ACPI10, sizeof(EFI_UUID_ACPI10)) == 0) {
-PhysicalAddress =
-(ACPI_PHYSICAL_ADDRESS)ct[i].ct_data;
+PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
+(uintptr_t)ct[i].ct_data;
 if (PhysicalAddress)
 	goto out;
 	



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

2019-09-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 12 14:28:09 UTC 2019

Modified Files:
src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
Cast physical addresses via uintptr_t to ACPI_PHYSICAL_ADDRESS to deal
with all size variants of the types used here in different builds.
Patch from manu@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/x86/acpi/acpi_machdep.c

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



Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Kamil Rytarowski
On 12.09.2019 10:09, Robert Elz wrote:
> The right change to make however is to teach the santitsers (all of them)
> that exiting (via exit() or a return from main()) frees everything,

This proposal is practically equivalent of disabling leak detection at
all and removes the whole purpose.

Leak detection works simply by scanning memory (TLS, stacks, heap) for
pointers to allocations. If there is no longer a reference, than there
is a leak.

I have not investigated where are the sh(1) leaks, but the pointers are
still accessible in memory. There are few tests failing in regression
test-suite and they related to pointers that are on the stack. There is
apparently a bug in calculating the range of used/valid stack region
somewhere or something that has this red-herring effect. (I would like
to see it fixed, but I am supposed to do other things now and cannot
focus on it.)

On 12.09.2019 10:55, Jason Thorpe wrote:>
>> On Sep 12, 2019, at 11:09 AM, Robert Elz  wrote:
>>
>> To me it seems apparent that the sanatiser is detecting the local
variable
>> in main() go out of scope when main() returns, and so the value it
contains
>> (the pointer to the allocated memory) is lost, and so it is
determined that
>> there is a leak.   For any other function that would often be true,
but for
>> main() it never is.
>
> It seems obvious that the sanitizer should special-case main().
>
> -- thorpej
>

In sanitizers we cannot overload or do anything special with main()
(such as replace it with our own copy). If this would be the case, it
would be simpler to perform some operations in other sanitizers.

main() is the same entity as any regular fun(). Unless we decorate it
with some attributes in .c code, it is not distinguishable.


On 12.09.2019 07:39, Simon Burge wrote:> for the free-just-before-exit
cases?

Leak detection is performed just before the exit.

Technically it is performed from atexit(3) handler that is expected to
be the last one to be executed.

We need to perform this phase in that moment as we need to fire other
atexit handlers, destructors etc.

main() is not really privileged here.

At least with LSan there is an option to perform the end-of-process
check on demand with __lsan_do_leak_check(), it will disable the
atexit(3) handler later on. But it is not much different to adding
workarounds for 1 type of leak detecting software.

On 12.09.2019 10:09, Robert Elz wrote:> If this is what is happening, it
would seem that a relatively cost free
> fix, instead of calling free()

Globals are treated specially in sanitizers as sanitizers generate
constructors and destructors to keep the track of them.

LSan on NetBSD is still distanced from being as good as the Linux
equivalent so it's not a perfect example of presenting how LSan
behaves., I wouldn't assume that globals can store freely pointers. Even
if this is the case today, it would be fixed in future.


On 12.09.2019 10:09, Robert Elz wrote:>   | There is a cost of calling a
dummy function _suppress_leak(), but it is
>   | probably negligible.
>
> No, it isn't.   The way you have described it, that function needs to be
> called for every block of allocated memory that has been allocated, and is
> never going to be freed.   That means either calling this function
immediately
> after all (or much) memory is allocated, even if it turns out that
memory is
> later freed, as often the code does not know what allocations will be
released
> and which will still be active when the program terminates.   Or every
time
> the program is about to exit, it needs to traverse all of its data
structures
> calling this function on all memory that had perviously been allocated.
> Potentially thousands of these dummy function calls.

I have benchmarked in the past that we execute for true(1) or similar
applications at least 1 million instructions on CPU.


$ ./singlestepper true
Total count: 1639915

$ ./singlestepper echo

Total count: 1039124

Calling one 1 dummy function in libc in comparison to that is negligible.

We are talking here about simple programs that are expected to get some
measurable optimization by skipping free(3) calls. Such as sh(1) or ps(1).

In all other cases I consider this style of programming as buggy.

If there are thousands of leaked memory objects than it is not just
simple optimization, but really wrong style of programming. One example
of that is ATF, it randomly picks one set of pointers to free before
exit, and skips others leaking the memory. It is bug.

As I have stated originally, we could remove free(3) from almost every
basesystem program and not many would notice. There is even a C compiler
that performs only allocations and never frees the memory. It is still a
correct UNIX application, regardless of taking like 2GB for building a
hello world application.



signature.asc
Description: OpenPGP digital signature


CVS commit: src/sys/dev/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 12 12:25:46 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_type.h ixgbe_vf.c ixv.c

Log Message:
Add support ALLMULTI on ixv(4):
 - Negotiate API version up to 1.3.
 - On linux's PF driver implementation, the PF replies VF's XCAST_MODE_ALLMULTI
   message not with NACK but with ACK even if the virtual function is NOT
   marked "trust" and act as XCAST_MODE_"MULTI". If ixv(4) simply check the
   return vaule of update_xcast_mode(XCAST_MODE_ALLMULTI), SIOCSADDMULTI
   success and the user may have trouble with some addresses. Fortunately,
   the Linux's PF driver's "ACK" message has not XCAST_MODE_"ALL"MULTI but
   XCAST_MODE_MULTI, so we can check this state by checking if the send
   message's argument and the reply message's argument are different.
 - Noy yet for PROMISC.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/pci/ixgbe/ixv.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/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 12 12:25:46 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_type.h ixgbe_vf.c ixv.c

Log Message:
Add support ALLMULTI on ixv(4):
 - Negotiate API version up to 1.3.
 - On linux's PF driver implementation, the PF replies VF's XCAST_MODE_ALLMULTI
   message not with NACK but with ACK even if the virtual function is NOT
   marked "trust" and act as XCAST_MODE_"MULTI". If ixv(4) simply check the
   return vaule of update_xcast_mode(XCAST_MODE_ALLMULTI), SIOCSADDMULTI
   success and the user may have trouble with some addresses. Fortunately,
   the Linux's PF driver's "ACK" message has not XCAST_MODE_"ALL"MULTI but
   XCAST_MODE_MULTI, so we can check this state by checking if the send
   message's argument and the reply message's argument are different.
 - Noy yet for PROMISC.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.42
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.41	Wed Jul 24 06:07:58 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Thu Sep 12 12:25:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.41 2019/07/24 06:07:58 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.42 2019/09/12 12:25:46 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -4311,6 +4311,8 @@ struct ixgbe_hw {
 #define IXGBE_ERR_FW_RESP_INVALID		-39
 #define IXGBE_ERR_TOKEN_RETRY			-40
 
+#define IXGBE_ERR_NOT_TRUSTED			-50 /* XXX NetBSD */
+
 #define IXGBE_NOT_IMPLEMENTED			0x7FFF
 
 

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.20 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.21
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.20	Thu Sep 12 06:19:47 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c	Thu Sep 12 12:25:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.20 2019/09/12 06:19:47 msaitoh Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.21 2019/09/12 12:25:46 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -462,6 +462,21 @@ s32 ixgbevf_update_xcast_mode(struct ixg
 	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
 	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
 		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	/*
+	 *  On linux's PF driver implementation, the PF replies VF's
+	 * XCAST_MODE_ALLMULTI message not with NACK but with ACK even if the
+	 * virtual function is NOT marked "trust" and act as
+	 * XCAST_MODE_"MULTI". If ixv(4) simply check the return vaule of
+	 * update_xcast_mode(XCAST_MODE_ALLMULTI), SIOCSADDMULTI success and
+	 * the user may have trouble with some addresses. Fortunately, the
+	 * Linux's PF driver's "ACK" message has not XCAST_MODE_"ALL"MULTI but
+	 * XCAST_MODE_MULTI, so we can check this state by checking if the
+	 * send message's argument and the reply message's argument are
+	 * different.
+	 */
+	if ((xcast_mode > IXGBEVF_XCAST_MODE_MULTI)
+	&& (xcast_mode != msgbuf[1]))
+		return IXGBE_ERR_NOT_TRUSTED;
 	return IXGBE_SUCCESS;
 }
 

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.133 src/sys/dev/pci/ixgbe/ixv.c:1.134
--- src/sys/dev/pci/ixgbe/ixv.c:1.133	Thu Sep 12 11:48:44 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Sep 12 12:25:46 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.133 2019/09/12 11:48:44 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.134 2019/09/12 12:25:46 msaitoh Exp $*/
 
 /**
 
@@ -1085,7 +1085,9 @@ static int
 ixv_negotiate_api(struct adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	int		mbx_api[] = { ixgbe_mbox_api_11,
+	int		mbx_api[] = { ixgbe_mbox_api_13,
+  ixgbe_mbox_api_12,
+  ixgbe_mbox_api_11,
   ixgbe_mbox_api_10,
   ixgbe_mbox_api_unknown };
 	int		i = 0;
@@ -1108,12 +1110,16 @@ ixv_negotiate_api(struct adapter *adapte
 static void
 ixv_set_multi(struct adapter *adapter)
 {
+	struct ixgbe_hw *hw = &adapter->hw;
 	struct ether_multi *enm;
 	struct ether_multistep step;
 	struct ethercom *ec = &adapter->osdep.ec;
 	u8	mta[IXGBE_MAX_VF_MC * IXGBE_ETH_LENGTH_OF_ADDRESS];
 	u8		   *update_ptr;
 	int		   mcnt = 0;
+	bool overflow = false;
+	bool allmulti = false;
+	int error;
 
 	KASSERT(mutex_owned(&adapter->core_mtx));
 	IOCTL_DEBUGOUT("ixv_set_multi: begin");
@@ -1121,17 +1127,48 @@ ixv_set_multi(struct adapter *adapter)
 	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
+		if (mcnt >= IXGBE_MAX_VF_MC) {
+			overflow =

CVS commit: src/sys/dev/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 12 11:48:44 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Reduce ixv(4)'s multicast table array size in ixv_set_multi from
MAX_NUM_MULTICAST_ADDRESSES(128) to IXGBE_MAX_VF_MC(30).


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.132 src/sys/dev/pci/ixgbe/ixv.c:1.133
--- src/sys/dev/pci/ixgbe/ixv.c:1.132	Thu Sep 12 06:19:47 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Sep 12 11:48:44 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.132 2019/09/12 06:19:47 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.133 2019/09/12 11:48:44 msaitoh Exp $*/
 
 /**
 
@@ -,7 +,7 @@ ixv_set_multi(struct adapter *adapter)
 	struct ether_multi *enm;
 	struct ether_multistep step;
 	struct ethercom *ec = &adapter->osdep.ec;
-	u8	mta[MAX_NUM_MULTICAST_ADDRESSES * IXGBE_ETH_LENGTH_OF_ADDRESS];
+	u8	mta[IXGBE_MAX_VF_MC * IXGBE_ETH_LENGTH_OF_ADDRESS];
 	u8		   *update_ptr;
 	int		   mcnt = 0;
 
@@ -1126,7 +1126,7 @@ ixv_set_multi(struct adapter *adapter)
 		IXGBE_ETH_LENGTH_OF_ADDRESS);
 		mcnt++;
 		/* XXX This might be required --msaitoh */
-		if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES)
+		if (mcnt >= IXGBE_MAX_VF_MC)
 			break;
 		ETHER_NEXT_MULTI(step, enm);
 	}



CVS commit: src/sys/dev/pci/ixgbe

2019-09-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Sep 12 11:48:44 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
 Reduce ixv(4)'s multicast table array size in ixv_set_multi from
MAX_NUM_MULTICAST_ADDRESSES(128) to IXGBE_MAX_VF_MC(30).


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: src/lib/libkvm

2019-09-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Sep 12 10:18:50 UTC 2019

Modified Files:
src/lib/libkvm: kvm_aarch64.c

Log Message:
Need register defines that were moved to armreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libkvm/kvm_aarch64.c

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

Modified files:

Index: src/lib/libkvm/kvm_aarch64.c
diff -u src/lib/libkvm/kvm_aarch64.c:1.8 src/lib/libkvm/kvm_aarch64.c:1.9
--- src/lib/libkvm/kvm_aarch64.c:1.8	Wed Dec 19 11:02:21 2018
+++ src/lib/libkvm/kvm_aarch64.c	Thu Sep 12 10:18:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: kvm_aarch64.c,v 1.8 2018/12/19 11:02:21 mrg Exp $ */
+/* $NetBSD: kvm_aarch64.c,v 1.9 2019/09/12 10:18:50 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -48,7 +49,7 @@
 
 #include "kvm_private.h"
 
-__RCSID("$NetBSD: kvm_aarch64.c,v 1.8 2018/12/19 11:02:21 mrg Exp $");
+__RCSID("$NetBSD: kvm_aarch64.c,v 1.9 2019/09/12 10:18:50 mlelstv Exp $");
 
 /*ARGSUSED*/
 void



CVS commit: src/lib/libkvm

2019-09-12 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Sep 12 10:18:50 UTC 2019

Modified Files:
src/lib/libkvm: kvm_aarch64.c

Log Message:
Need register defines that were moved to armreg.h


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libkvm/kvm_aarch64.c

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



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

2019-09-12 Thread Yuuki Enomoto
Module Name:src
Committed By:   uki
Date:   Thu Sep 12 09:45:43 UTC 2019

Modified Files:
src/distrib/sets/lists/xcomp: md.amd64 md.evbarm md.hp300 md.i386
md.macppc md.sparc64

Log Message:
Give package name to xcomp machine dependency files


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/distrib/sets/lists/xcomp/md.amd64
cvs rdiff -u -r1.14 -r1.15 src/distrib/sets/lists/xcomp/md.evbarm \
src/distrib/sets/lists/xcomp/md.sparc64
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/xcomp/md.hp300
cvs rdiff -u -r1.61 -r1.62 src/distrib/sets/lists/xcomp/md.i386
cvs rdiff -u -r1.21 -r1.22 src/distrib/sets/lists/xcomp/md.macppc

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

Modified files:

Index: src/distrib/sets/lists/xcomp/md.amd64
diff -u src/distrib/sets/lists/xcomp/md.amd64:1.55 src/distrib/sets/lists/xcomp/md.amd64:1.56
--- src/distrib/sets/lists/xcomp/md.amd64:1.55	Tue Mar 12 23:50:56 2019
+++ src/distrib/sets/lists/xcomp/md.amd64	Thu Sep 12 09:45:43 2019
@@ -1,46 +1,46 @@
-# $NetBSD: md.amd64,v 1.55 2019/03/12 23:50:56 christos Exp $
-./usr/X11R7/include/intel_bufmgr.h			-unknown-	obsolete
-./usr/X11R7/include/libdrm/nouveau/nvif/cl0080.h	-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/cl9097.h	-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/class.h		-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/if0002.h	-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/if0003.h	-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/ioctl.h		-unknown-	xorg
-./usr/X11R7/include/libdrm/nouveau/nvif/unpack.h	-unknown-	xorg
-./usr/X11R7/include/vdpau/vdpau.h			-unknown-	xorg
-./usr/X11R7/include/vdpau/vdpau_x11.h			-unknown-	xorg
-./usr/X11R7/lib/libI810XvMC.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libI810XvMC_p.a-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libI810XvMC_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libIntelXvMC.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libIntelXvMC_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libIntelXvMC_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libchromeXvMC.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libchromeXvMCPro.a			-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libchromeXvMCPro_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libchromeXvMCPro_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libchromeXvMC_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libchromeXvMC_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libdrm_amdgpu.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libdrm_amdgpu_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libdrm_amdgpu_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libdrm_intel.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libdrm_intel_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libdrm_intel_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libdrm_nouveau.a			-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libdrm_nouveau_p.a			-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libdrm_nouveau_pic.a			-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/libvdpau.a-unknown-	xorg,compatx11file
-./usr/X11R7/lib/libvdpau_p.a-unknown-	profile,xorg,compatx11file
-./usr/X11R7/lib/libvdpau_pic.a-unknown-	xorg,picinstall,compatx11file
-./usr/X11R7/lib/pkgconfig/libdrm_amdgpu.pc		-unknown-	xorg
-./usr/X11R7/lib/pkgconfig/libdrm_intel.pc		-unknown-	xorg
-./usr/X11R7/lib/pkgconfig/libdrm_nouveau.pc		-unknown-	xorg
-./usr/X11R7/lib/pkgconfig/vdpau.pc			-unknown-	xorg
-./usr/libdata/lint/llib-lI810XvMC.ln			-unknown-	lint,xorg
-./usr/libdata/lint/llib-lchromeXvMC.ln			-unknown-	lint,xorg
-./usr/libdata/lint/llib-lchromeXvMCPro.ln		-unknown-	lint,xorg
-./usr/libdata/lint/llib-ldrm_amdgpu.ln			-unknown-	lint,xorg
-./usr/libdata/lint/llib-ldrm_intel.ln			-unknown-	lint,xorg
-./usr/libdata/lint/llib-ldrm_nouveau.ln			-unknown-	lint,xorg
-./usr/libdata/lint/llib-lvdpau.ln			-unknown-	lint,xorg
+# $NetBSD: md.amd64,v 1.56 2019/09/12 09:45:43 uki Exp $
+./usr/X11R7/include/intel_bufmgr.h			xcomp-obsolete	obsolete
+./usr/X11R7/include/libdrm/nouveau/nvif/cl0080.h	xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/cl9097.h	xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/class.h		xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/if0002.h	xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/if0003.h	xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/ioctl.h		xcomp-libdrm-include	xorg
+./usr/X11R7/include/libdrm/nouveau/nvif/unpack.h	xcomp-libdrm-include	xorg
+./usr/X11R7/include/vdpau/vdpau.h			xcomp-vdpau-include	xorg
+./usr/X11R7/include/vdpau/vdpau_x11.h			xcomp-vdpau-include	xorg
+./usr/X11R7/lib/libI810XvMC.axc

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

2019-09-12 Thread Yuuki Enomoto
Module Name:src
Committed By:   uki
Date:   Thu Sep 12 09:45:43 UTC 2019

Modified Files:
src/distrib/sets/lists/xcomp: md.amd64 md.evbarm md.hp300 md.i386
md.macppc md.sparc64

Log Message:
Give package name to xcomp machine dependency files


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/distrib/sets/lists/xcomp/md.amd64
cvs rdiff -u -r1.14 -r1.15 src/distrib/sets/lists/xcomp/md.evbarm \
src/distrib/sets/lists/xcomp/md.sparc64
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/xcomp/md.hp300
cvs rdiff -u -r1.61 -r1.62 src/distrib/sets/lists/xcomp/md.i386
cvs rdiff -u -r1.21 -r1.22 src/distrib/sets/lists/xcomp/md.macppc

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



CVS commit: src/sys/ddb

2019-09-12 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 12 09:20:23 UTC 2019

Modified Files:
src/sys/ddb: db_access.c db_access.h db_examine.c

Log Message:
changes of r1.39 was incomplete. only "examin/m" could handle 'q'.
added support 'r','x','z','d','u', and 'o' with 'q' modifier on 32bit arch.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ddb/db_access.c
cvs rdiff -u -r1.13 -r1.14 src/sys/ddb/db_access.h
cvs rdiff -u -r1.39 -r1.40 src/sys/ddb/db_examine.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/ddb/db_access.c
diff -u src/sys/ddb/db_access.c:1.24 src/sys/ddb/db_access.c:1.25
--- src/sys/ddb/db_access.c:1.24	Fri Aug 23 14:48:50 2019
+++ src/sys/ddb/db_access.c	Thu Sep 12 09:20:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_access.c,v 1.24 2019/08/23 14:48:50 kamil Exp $	*/
+/*	$NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.24 2019/08/23 14:48:50 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_access.c,v 1.25 2019/09/12 09:20:23 ryo Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_kgdb.h"
@@ -82,6 +82,26 @@ db_get_value(db_addr_t addr, size_t size
 	return (value);
 }
 
+quad_t
+db_get_qvalue(db_addr_t addr, size_t size, bool is_signed)
+{
+	uint64_t data;
+
+	if (sizeof(db_expr_t) >= sizeof(quad_t) || size <= sizeof(db_expr_t)) {
+		if (is_signed)
+			return db_get_value(addr, size, true);
+		return (uint32_t)db_get_value(addr, size, false);
+	}
+
+	if (size != sizeof(data)) {
+		db_error("unnsupported size\n");
+		/*NOTREACHED*/
+	}
+
+	db_read_bytes(addr, sizeof(data), (char *)&data);
+	return data;
+}
+
 void
 db_put_value(db_addr_t addr, size_t size, db_expr_t value)
 {

Index: src/sys/ddb/db_access.h
diff -u src/sys/ddb/db_access.h:1.13 src/sys/ddb/db_access.h:1.14
--- src/sys/ddb/db_access.h:1.13	Sat Mar  7 22:02:17 2009
+++ src/sys/ddb/db_access.h	Thu Sep 12 09:20:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_access.h,v 1.13 2009/03/07 22:02:17 ad Exp $	*/
+/*	$NetBSD: db_access.h,v 1.14 2019/09/12 09:20:23 ryo Exp $	*/
 
 /*
  * Mach Operating System
@@ -33,6 +33,7 @@
  * Data access functions for debugger.
  */
 db_expr_t	db_get_value(db_addr_t, size_t, bool);
+quad_t		db_get_qvalue(db_addr_t, size_t, bool);
 void		db_put_value(db_addr_t, size_t, db_expr_t);
 
 void		db_read_bytes(db_addr_t, size_t, char *);

Index: src/sys/ddb/db_examine.c
diff -u src/sys/ddb/db_examine.c:1.39 src/sys/ddb/db_examine.c:1.40
--- src/sys/ddb/db_examine.c:1.39	Tue Sep 10 09:32:05 2019
+++ src/sys/ddb/db_examine.c	Thu Sep 12 09:20:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $	*/
+/*	$NetBSD: db_examine.c,v 1.40 2019/09/12 09:20:23 ryo Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.39 2019/09/10 09:32:05 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_examine.c,v 1.40 2019/09/12 09:20:23 ryo Exp $");
 
 #include 
 #include 
@@ -70,7 +70,7 @@ static void
 db_examine(db_addr_t addr, char *fmt, int count)
 {
 	int		i, c;
-	db_expr_t	value;
+	quad_t		value;
 	int		size;
 	int		width;
 	int		bytes;
@@ -103,7 +103,7 @@ db_examine(db_addr_t addr, char *fmt, in
 break;
 			case 'q':	/* quad-word */
 size = 8;
-width = 16;
+width = 24;
 break;
 			case 'L':	/* implementation maximum */
 size = sizeof value;
@@ -114,27 +114,27 @@ db_examine(db_addr_t addr, char *fmt, in
 break;
 			case 'p':
 size = sizeof(void *);
-value = db_get_value(addr, size, true);
+value = db_get_value(addr, size, false);
 addr += size;
 db_printf("= 0x%lx ", (long)value);
 db_printsym((db_addr_t)value, DB_STGY_ANY, db_printf);
 db_printf("\n");
 break;
 			case 'r':	/* signed, current radix */
-value = db_get_value(addr, size, true);
+value = db_get_qvalue(addr, size, true);
 addr += size;
 db_format_radix(tbuf, 24, value, false);
 db_printf("%-*s", width, tbuf);
 break;
 			case 'x':	/* unsigned hex */
-value = db_get_value(addr, size, false);
+value = db_get_qvalue(addr, size, false);
 addr += size;
-db_printf("%-*" DDB_EXPR_FMT "x", width, value);
+db_printf("%-*" PRIx64, width, value);
 break;
 			case 'm':	/* hex dump */
 /*
  * Print off in chunks of size. Try to print 16
- * bytes at a time into 4 columns. This
+ * bytes at a time into 16/size columns. This
  * loops modify's count extra times in order
  * to get the nicely formatted lines.
  */
@@ -152,7 +152,7 @@ db_examine(db_addr_t addr, char *fmt, in
 		1, false);
 #endif
 		db_printf(
-		"%02" DDB_EXPR_FMT "x",
+		"%02" PRIx64,
 		value);
 		bytes++;
 		if (!(bytes % size))
@@ -174,25 +174,25 @@ db_examine(db_addr_t addr, char *fmt, in
 		

CVS commit: src/sys/ddb

2019-09-12 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Sep 12 09:20:23 UTC 2019

Modified Files:
src/sys/ddb: db_access.c db_access.h db_examine.c

Log Message:
changes of r1.39 was incomplete. only "examin/m" could handle 'q'.
added support 'r','x','z','d','u', and 'o' with 'q' modifier on 32bit arch.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ddb/db_access.c
cvs rdiff -u -r1.13 -r1.14 src/sys/ddb/db_access.h
cvs rdiff -u -r1.39 -r1.40 src/sys/ddb/db_examine.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/aarch64/aarch64

2019-09-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Sep 12 09:05:28 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpufunc.c

Log Message:
Do not attempt to change coherency_unit at runtime. Instead, if the
required coherency unit is greater than COHERENCY_UNIT in a MULTIPROCESSOR
kernel, just panic instead.

This makes non-MULTIPROCESSOR kernels work again.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/cpufunc.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/aarch64/aarch64

2019-09-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Sep 12 09:05:28 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpufunc.c

Log Message:
Do not attempt to change coherency_unit at runtime. Instead, if the
required coherency unit is greater than COHERENCY_UNIT in a MULTIPROCESSOR
kernel, just panic instead.

This makes non-MULTIPROCESSOR kernels work again.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/aarch64/cpufunc.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/aarch64/aarch64/cpufunc.c
diff -u src/sys/arch/aarch64/aarch64/cpufunc.c:1.5 src/sys/arch/aarch64/aarch64/cpufunc.c:1.6
--- src/sys/arch/aarch64/aarch64/cpufunc.c:1.5	Fri Dec 21 08:01:01 2018
+++ src/sys/arch/aarch64/aarch64/cpufunc.c	Thu Sep 12 09:05:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.c,v 1.5 2018/12/21 08:01:01 ryo Exp $	*/
+/*	$NetBSD: cpufunc.c,v 1.6 2019/09/12 09:05:28 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -26,8 +26,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_multiprocessor.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.5 2018/12/21 08:01:01 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.6 2019/09/12 09:05:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -135,9 +137,12 @@ aarch64_getcacheinfo(void)
 		arm_dcache_align = sizeof(int) << arm_dcache_maxline;
 		arm_dcache_align_mask = arm_dcache_align - 1;
 	}
-	/* update coherency_unit (in param.h) */
+
+#ifdef MULTIPROCESSOR
 	if (coherency_unit < arm_dcache_align)
-		coherency_unit = arm_dcache_align;
+		panic("coherency_unit %ld < arm_dcache_align %d; increase COHERENCY_UNIT",
+		coherency_unit, arm_dcache_align);
+#endif
 
 	/*
 	 * CLIDR -  Cache Level ID Register



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

2019-09-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Sep 12 09:02:36 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: gicv3_acpi.c

Log Message:
Redistributors with virtual LPI support have larger register spaces. Take
this into consideration when scanning LPI regions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/acpi/gicv3_acpi.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/acpi

2019-09-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Sep 12 09:02:36 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: gicv3_acpi.c

Log Message:
Redistributors with virtual LPI support have larger register spaces. Take
this into consideration when scanning LPI regions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/acpi/gicv3_acpi.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/acpi/gicv3_acpi.c
diff -u src/sys/arch/arm/acpi/gicv3_acpi.c:1.3 src/sys/arch/arm/acpi/gicv3_acpi.c:1.4
--- src/sys/arch/arm/acpi/gicv3_acpi.c:1.3	Mon Nov 12 12:56:05 2018
+++ src/sys/arch/arm/acpi/gicv3_acpi.c	Thu Sep 12 09:02:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */
+/* $NetBSD: gicv3_acpi.c,v 1.4 2019/09/12 09:02:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_acpi.c,v 1.4 2019/09/12 09:02:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -200,6 +200,10 @@ gicv3_acpi_map_gicr(ACPI_SUBTABLE_HEADER
 		const uint32_t typer = bus_space_read_4(sc->sc_gic.sc_bst, sc->sc_gic.sc_bsh_r[redist], GICR_TYPER);
 		if (typer & GICR_TYPER_Last)
 			break;
+
+		/* If the redistributor supports virtual LPIs, skip the VLPI register region */
+		if (typer & GICR_TYPER_VLPIS)
+			off += GICR_SIZE;
 	}
 
 	return AE_OK;



Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Jason Thorpe


> On Sep 12, 2019, at 11:09 AM, Robert Elz  wrote:
> 
> To me it seems apparent that the sanatiser is detecting the local variable
> in main() go out of scope when main() returns, and so the value it contains
> (the pointer to the allocated memory) is lost, and so it is determined that
> there is a leak.   For any other function that would often be true, but for
> main() it never is.

It seems obvious that the sanitizer should special-case main().

-- thorpej



Re: Leak Sanitizer - how to suppress leaks

2019-09-12 Thread Robert Elz
Date:Thu, 12 Sep 2019 02:58:41 +0200
From:Kamil Rytarowski 
Message-ID:  <373b9331-5306-9797-b4bd-8f6c52683...@gmx.com>

  | I have tested interactive sh(1) with LSan and it does not leak when
  | used.

It doesn't matter what code (if any) you run, there is always memory
allocated in sh that isn't freed when it exits.   Always.   What varies
depending upon what code the shell runs is just how much of it exists.

What this tells me is that the sanatisers aren't detecting unfreed memory
when it is done the way the shell does it.   There are two potential
differences from ps that may be it (perhaps one of them, perhaps both are
needed) - all the shell's allocated memory is referred to from globals,
the variable in question in ps was a local in main().   And second, ps
exits by returning from main(), the shell never does that, it exits via
an explicit call to exit() (or _exit() in one or two cases - the shell forks
a lot so there are several different exit paths depending upon just what
is happening .. all of the forks inherit all the unfreed memory of the
parent shell).

To me it seems apparent that the sanatiser is detecting the local variable
in main() go out of scope when main() returns, and so the value it contains
(the pointer to the allocated memory) is lost, and so it is determined that
there is a leak.   For any other function that would often be true, but for
main() it never is.

If this is what is happening, it would seem that a relatively cost free
fix, instead of calling free() would be simply to make the variable (psinfo)
a global instead of local to main.   That would be a pity, as it makes it
harder to be certain that other code is not fiddling with its value, but
might make this problem go away.

Alternatively, perhaps ps could call exit(eval); instead of doing
return eval; and since one presumes that the sanitisers know that exit()
never returns, then the local variable would never go out of scope, and
hence its memory would not be lost.

The right change to make however is to teach the santitsers (all of them)
that exiting (via exit() or a return from main()) frees everything, and
not to complain about any unfreed memory when that happens (and that local
variables in main effectively have the same lifetime as globals).
This could be an option, so those programs that don't intend to leave
any unfreed memory when they exit could verify that (ideally via a
pragma or magic comment of some kind in the code, rather than yet another
command line option).


  | There is a cost of calling a dummy function _suppress_leak(), but it is
  | probably negligible.

No, it isn't.   The way you have described it, that function needs to be
called for every block of allocated memory that has been allocated, and is
never going to be freed.   That means either calling this function immediately
after all (or much) memory is allocated, even if it turns out that memory is
later freed, as often the code does not know what allocations will be released
and which will still be active when the program terminates.   Or every time
the program is about to exit, it needs to traverse all of its data structures
calling this function on all memory that had perviously been allocated.
Potentially thousands of these dummy function calls.

For something like sh we are not talking about just when the script (or
interactive shell) exits when it is finished, but every time one of its
forked children exits, or calls one of the exec*() family - which also is
effectively exiting the shell (if memory needs to be freed before an exit
it needs to be freed before an exec() as well ... which is tricky when the
args being given to exec() are in malloc'd memory!)

Doing it this way (anything like this way) is simply not feasible.  If there
is to be some new sanatiser specific function call, it needs to be more like
_all_memory_is_free() which simply tells the sanitiser that anything it thinks
is still allocated, should be treated as if it has been freed.

But even that is the wrong way, the right way is to invert that function,
and make it be something like _verify_no_unfreed_memory();

That's a better method than the pragma/magic comment I suggested above to
allow the sanatisers to be told to go check that there is no unallocated
memory, and what's more, can be called any time at all (of course programs
need to be aware that libc functions, like stdio, may have allocated mem,
like FILE buffers, that have not been freed, so use would need to be
cautious).   This still requires the sanatisers to be taught that simply
exiting with unfreed memory is not a problem.

kre



CVS commit: src/sys/net

2019-09-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Sep 12 07:38:19 UTC 2019

Modified Files:
src/sys/net: bpf.c

Log Message:
Add KASSERT to catch bugs. Something tells me it could easily fire.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/net/bpf.c

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

Modified files:

Index: src/sys/net/bpf.c
diff -u src/sys/net/bpf.c:1.229 src/sys/net/bpf.c:1.230
--- src/sys/net/bpf.c:1.229	Wed Jul 10 17:55:33 2019
+++ src/sys/net/bpf.c	Thu Sep 12 07:38:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bpf.c,v 1.229 2019/07/10 17:55:33 maxv Exp $	*/
+/*	$NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.229 2019/07/10 17:55:33 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.230 2019/09/12 07:38:19 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_bpf.h"
@@ -1680,6 +1680,7 @@ _bpf_mtap(struct bpf_if *bp, struct mbuf
 		cpfn = (void *)memcpy;
 		marg = mtod(m, void *);
 		buflen = pktlen;
+		KASSERT(buflen != 0);
 	} else {
 		cpfn = bpf_mcpy;
 		marg = m;



CVS commit: src/sys/net

2019-09-12 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Sep 12 07:38:19 UTC 2019

Modified Files:
src/sys/net: bpf.c

Log Message:
Add KASSERT to catch bugs. Something tells me it could easily fire.


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/net/bpf.c

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