Re: CVS commit: src/sys/sys

2018-04-17 Thread Kamil Rytarowski
On 18.04.2018 07:30, Michael van Elst wrote:
> On Wed, Apr 18, 2018 at 07:09:34AM +0200, Kamil Rytarowski wrote:
> 
>>> Anyway, I think sys/pmf.h is only included for the declaration of
>>> pmf_qual_t and that is only used for some function declarations that
>>> are for _KERNEL only. Can you please try:
> 
> 
> Maybe this:
> 
> Index: sys/device.h
> ===
> RCS file: /cvsroot/src/sys/sys/device.h,v
> retrieving revision 1.151
> diff -p -u -r1.151 device.h
> --- sys/device.h4 Mar 2018 07:13:11 -   1.151
> +++ sys/device.h18 Apr 2018 05:17:44 -
> @@ -84,7 +84,13 @@
>  #if defined(_KERNEL) || defined(_KMEMUSER)
>  #include 
>  #include 
> +#endif
> +
> +#if defined(_KERNEL)
>  #include 
> +#else if defined(_KMEMUSER) && !defined(_SYS_PMF_H)
> +struct pmf_qual;
> +typedef struct pmf_qual pmf_qual_t;
>  #endif
>  
>  #include 
> 
> 
> Ugly and needs further discussion, but the alternative of moving sys/pmf.h
> into userland is probably worse.
> 
> 
> Greetings,
> 

OK, so assuming that  shall not be exposed to userland - I
propose this patch:

http://netbsd.org/~kamil/patch-00047-pmf_h.txt

It follows the existing style of handling multiple typedefs for the same
type (compliant with pre-C11 code).

It works for me.



signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Wed, Apr 18, 2018 at 07:09:34AM +0200, Kamil Rytarowski wrote:

> > Anyway, I think sys/pmf.h is only included for the declaration of
> > pmf_qual_t and that is only used for some function declarations that
> > are for _KERNEL only. Can you please try:


Maybe this:

Index: sys/device.h
===
RCS file: /cvsroot/src/sys/sys/device.h,v
retrieving revision 1.151
diff -p -u -r1.151 device.h
--- sys/device.h4 Mar 2018 07:13:11 -   1.151
+++ sys/device.h18 Apr 2018 05:17:44 -
@@ -84,7 +84,13 @@
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #include 
 #include 
+#endif
+
+#if defined(_KERNEL)
 #include 
+#else if defined(_KMEMUSER) && !defined(_SYS_PMF_H)
+struct pmf_qual;
+typedef struct pmf_qual pmf_qual_t;
 #endif
 
 #include 


Ugly and needs further discussion, but the alternative of moving sys/pmf.h
into userland is probably worse.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


Re: CVS commit: src/sys/sys

2018-04-17 Thread Kamil Rytarowski
On 18.04.2018 06:56, Michael van Elst wrote:
> On Wed, Apr 18, 2018 at 01:36:23AM +0200, Kamil Rytarowski wrote:
> 
>> Looking at other users, everyone except  include
>>  in the _KERNEL namespace.
> 
> It defines internal kernel data structures. Normal programs must
> not see it, that's why it was hidden and finally all uses were removed
> from userland, so it only exists in _KERNEL namespace.
> 
> But crash(8) is a hybrid, because it is mostly ddb code compiled for
> userland.
> 
> Anyway, I think sys/pmf.h is only included for the declaration of
> pmf_qual_t and that is only used for some function declarations that
> are for _KERNEL only. Can you please try:
> 
> Index: sys/device.h
> ===
> RCS file: /cvsroot/src/sys/sys/device.h,v
> retrieving revision 1.151
> diff -p -u -r1.151 device.h
> --- sys/device.h4 Mar 2018 07:13:11 -   1.151
> +++ sys/device.h18 Apr 2018 04:53:14 -
> @@ -84,6 +84,9 @@
>  #if defined(_KERNEL) || defined(_KMEMUSER)
>  #include 
>  #include 
> +#endif
> +
> +#if defined(_KERNEL)
>  #include 
>  #endif
> 
> I'm verifying against a regular build.
> 
> 
> Greetings,
> 

This change is not sufficient:

In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
In file included from /usr/include/dev/biovar.h:40:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
In file included from /usr/include/dev/biovar.h:40:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
In file included from /usr/include/dev/biovar.h:40:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
In file included from /usr/include/dev/biovar.h:40:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
In file included from /usr/include/dev/biovar.h:40:
In file included from
/public/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc:97:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
In file included from /usr/include/dev/biovar.h:40:
/usr/include/sys/device.h:169:45: error: unknown type name 'pmf_qual_t'
[ 49%] Built target LLVMBPFDesc
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
 ^
/usr/include/sys/device.h:170:44: error: unknown type name 'pmf_qual_t'
bool(*dv_driver_resume)(device_t, const pmf_qual_t *);
^
/usr/include/sys/device.h:175:42: error: unknown type name 'pmf_qual_t'
bool(*dv_bus_suspend)(device_t, const pmf_qual_t *);
  ^
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
 ^
/usr/include/sys/device.h:170:44: error: unknown type name 'pmf_qual_t'
bool(*dv_driver_resume)(device_t, const pmf_qual_t *);
^
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
 ^
/usr/include/sys/device.h:170:44: error: unknown type name 'pmf_qual_t'
bool(*dv_driver_resume)(device_t, const pmf_qual_t *);
^
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
 ^
/usr/include/sys/device.h:170:44: error: unknown type name 'pmf_qual_t'
bool(*dv_driver_resume)(device_t, const pmf_qual_t *);
^
/usr/include/sys/device.h:175:42: error: unknown type name 'pmf_qual_t'
bool(*dv_bus_suspend)(device_t, const pmf_qual_t *);
  ^
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
 ^
/usr/include/sys/device.h:170:44: error: unknown type name 'pmf_qual_t'
bool(*dv_driver_resume)(device_t, const pmf_qual_t *);
^
bool(*dv_driver_suspend)(device_t, const pmf_qual_t *);
   

Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Wed, Apr 18, 2018 at 01:36:23AM +0200, Kamil Rytarowski wrote:

> Looking at other users, everyone except  include
>  in the _KERNEL namespace.

It defines internal kernel data structures. Normal programs must
not see it, that's why it was hidden and finally all uses were removed
from userland, so it only exists in _KERNEL namespace.

But crash(8) is a hybrid, because it is mostly ddb code compiled for
userland.

Anyway, I think sys/pmf.h is only included for the declaration of
pmf_qual_t and that is only used for some function declarations that
are for _KERNEL only. Can you please try:

Index: sys/device.h
===
RCS file: /cvsroot/src/sys/sys/device.h,v
retrieving revision 1.151
diff -p -u -r1.151 device.h
--- sys/device.h4 Mar 2018 07:13:11 -   1.151
+++ sys/device.h18 Apr 2018 04:53:14 -
@@ -84,6 +84,9 @@
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #include 
 #include 
+#endif
+
+#if defined(_KERNEL)
 #include 
 #endif

I'm verifying against a regular build.


Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


CVS commit: src/etc/defaults

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 04:27:47 UTC 2018

Modified Files:
src/etc/defaults: rc.conf

Log Message:
Cosmetics: default to dmesg -t when writing /var/run/dmesg.boot -
the timestamps at boot time are mostly useless.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/etc/defaults/rc.conf

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



CVS commit: src/etc/defaults

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 18 04:27:47 UTC 2018

Modified Files:
src/etc/defaults: rc.conf

Log Message:
Cosmetics: default to dmesg -t when writing /var/run/dmesg.boot -
the timestamps at boot time are mostly useless.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/etc/defaults/rc.conf

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

Modified files:

Index: src/etc/defaults/rc.conf
diff -u src/etc/defaults/rc.conf:1.141 src/etc/defaults/rc.conf:1.142
--- src/etc/defaults/rc.conf:1.141	Tue Jan  9 03:31:14 2018
+++ src/etc/defaults/rc.conf	Wed Apr 18 04:27:47 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: rc.conf,v 1.141 2018/01/09 03:31:14 christos Exp $
+#	$NetBSD: rc.conf,v 1.142 2018/04/18 04:27:47 martin Exp $
 #
 # /etc/defaults/rc.conf --
 #	default configuration of /etc/rc.conf
@@ -125,7 +125,7 @@ per_user_tmp=NO	# per-user /tmp dire
 per_user_tmp_dir="/private/tmp"			# real storage for /tmp
 clear_tmp=YES	# clear /tmp after reboot
 update_motd=YES	# updates /etc/motd
-dmesg=YES		dmesg_flags=""		# write /var/run/dmesg.boot
+dmesg=YES		dmesg_flags="-t"	# write /var/run/dmesg.boot
 accounting=NO	# uses /var/account/acct
 newsyslog=NO		newsyslog_flags=""	# trim log files
 quota=YES	# check and enable quotas



CVS commit: src/tests/net/if_bridge

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 04:03:12 UTC 2018

Modified Files:
src/tests/net/if_bridge: t_rtable.sh

Log Message:
Add a test that checks if brconfig flush surely removes all entries


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_bridge/t_rtable.sh

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

Modified files:

Index: src/tests/net/if_bridge/t_rtable.sh
diff -u src/tests/net/if_bridge/t_rtable.sh:1.2 src/tests/net/if_bridge/t_rtable.sh:1.3
--- src/tests/net/if_bridge/t_rtable.sh:1.2	Tue Apr 10 07:09:00 2018
+++ src/tests/net/if_bridge/t_rtable.sh	Wed Apr 18 04:03:12 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_rtable.sh,v 1.2 2018/04/10 07:09:00 ozaki-r Exp $
+#	$NetBSD: t_rtable.sh,v 1.3 2018/04/18 04:03:12 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -169,6 +169,7 @@ bridge_rtable_flush_head()
 bridge_rtable_flush_body()
 {
 	local addr1= addr3=
+	local n=
 
 	setup
 	setup_bridge
@@ -195,6 +196,34 @@ bridge_rtable_flush_body()
 	atf_check -s exit:0 -o not-match:"$addr3 shmif1" /sbin/brconfig bridge0
 	unset LD_PRELOAD
 
+	# Add extra interfaces and addresses
+	export RUMP_SERVER=$SOCK1
+	rump_server_add_iface $SOCK1 shmif1 bus1
+	atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.11/24
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	export RUMP_SERVER=$SOCK3
+	rump_server_add_iface $SOCK3 shmif1 bus2
+	atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.12/24
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	# Let cache entries
+	export RUMP_SERVER=$SOCK1
+	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.12
+	export RUMP_SERVER=$SOCK3
+	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.11
+
+	export RUMP_SERVER=$SOCK2
+	export LD_PRELOAD=/usr/lib/librumphijack.so
+	$DEBUG && /sbin/brconfig bridge0
+	n=$(get_number_of_caches)
+	atf_check_equal $n 4
+
+	atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 flush
+	n=$(get_number_of_caches)
+	atf_check_equal $n 0
+	unset LD_PRELOAD
+
 	rump_server_destroy_ifaces
 }
 



CVS commit: src/tests/net/if_bridge

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 04:03:12 UTC 2018

Modified Files:
src/tests/net/if_bridge: t_rtable.sh

Log Message:
Add a test that checks if brconfig flush surely removes all entries


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_bridge/t_rtable.sh

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



CVS commit: src/sys/net

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 04:01:58 UTC 2018

Modified Files:
src/sys/net: if_bridge.c if_bridgevar.h

Log Message:
bridge: use pslist(9) for rtlist and rthash

The change fixes race conditions on list operations.  One example is that a
reader may see invalid pointers on a looking item in a list due to lack of
membar_producer.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/net/if_bridge.c
cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_bridgevar.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/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.151 src/sys/net/if_bridge.c:1.152
--- src/sys/net/if_bridge.c:1.151	Wed Apr 18 03:49:44 2018
+++ src/sys/net/if_bridge.c	Wed Apr 18 04:01:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.151 2018/04/18 03:49:44 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.152 2018/04/18 04:01:58 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.151 2018/04/18 03:49:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.152 2018/04/18 04:01:58 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -191,6 +191,29 @@ __CTASSERT(offsetof(struct ifbifconf, if
 #define BRIDGE_RT_RENTER(__s)	do { __s = pserialize_read_enter(); } while (0)
 #define BRIDGE_RT_REXIT(__s)	do { pserialize_read_exit(__s); } while (0)
 
+#define BRIDGE_RTLIST_READER_FOREACH(_brt, _sc)			\
+	PSLIST_READER_FOREACH((_brt), &((_sc)->sc_rtlist),		\
+	struct bridge_rtnode, brt_list)
+#define BRIDGE_RTLIST_WRITER_FOREACH(_brt, _sc)			\
+	PSLIST_WRITER_FOREACH((_brt), &((_sc)->sc_rtlist),		\
+	struct bridge_rtnode, brt_list)
+#define BRIDGE_RTLIST_WRITER_INSERT_HEAD(_sc, _brt)			\
+	PSLIST_WRITER_INSERT_HEAD(&(_sc)->sc_rtlist, brt, brt_list)
+#define BRIDGE_RTLIST_WRITER_REMOVE(_brt)\
+	PSLIST_WRITER_REMOVE((_brt), brt_list)
+
+#define BRIDGE_RTHASH_READER_FOREACH(_brt, _sc, _hash)			\
+	PSLIST_READER_FOREACH((_brt), &(_sc)->sc_rthash[(_hash)],	\
+	struct bridge_rtnode, brt_hash)
+#define BRIDGE_RTHASH_WRITER_FOREACH(_brt, _sc, _hash)			\
+	PSLIST_WRITER_FOREACH((_brt), &(_sc)->sc_rthash[(_hash)],	\
+	struct bridge_rtnode, brt_hash)
+#define BRIDGE_RTHASH_WRITER_INSERT_HEAD(_sc, _hash, _brt)		\
+	PSLIST_WRITER_INSERT_HEAD(&(_sc)->sc_rthash[(_hash)], brt, brt_hash)
+#define BRIDGE_RTHASH_WRITER_INSERT_AFTER(_brt, _new)			\
+	PSLIST_WRITER_INSERT_AFTER((_brt), (_new), brt_hash)
+#define BRIDGE_RTHASH_WRITER_REMOVE(_brt)\
+	PSLIST_WRITER_REMOVE((_brt), brt_hash)
 
 #ifdef NET_MPSAFE
 #define DECLARE_LOCK_VARIABLE
@@ -1039,7 +1062,7 @@ bridge_ioctl_rts(struct bridge_softc *sc
 	BRIDGE_RT_LOCK(sc);
 
 	len = bac->ifbac_len;
-	LIST_FOREACH(brt, >sc_rtlist, brt_list) {
+	BRIDGE_RTLIST_WRITER_FOREACH(brt, sc) {
 		if (len < sizeof(bareq))
 			goto out;
 		memset(, 0, sizeof(bareq));
@@ -2105,7 +2128,7 @@ typedef bool (*bridge_iterate_cb_t)
 static void
 bridge_rtlist_iterate_remove(struct bridge_softc *sc, bridge_iterate_cb_t func, void *arg)
 {
-	struct bridge_rtnode *brt, *nbrt;
+	struct bridge_rtnode *brt;
 	struct bridge_rtnode **brt_list;
 	int i, count;
 
@@ -2124,7 +2147,12 @@ retry:
 	}
 
 	i = 0;
-	LIST_FOREACH_SAFE(brt, >sc_rtlist, brt_list, nbrt) {
+	/*
+	 * We don't need to use a _SAFE variant here because we know
+	 * that a removed item keeps its next pointer as-is thanks to
+	 * pslist(9) and isn't freed in the loop.
+	 */
+	BRIDGE_RTLIST_WRITER_FOREACH(brt, sc) {
 		bool need_break = false;
 		if (func(sc, brt, _break, arg)) {
 			bridge_rtnode_remove(sc, brt);
@@ -2298,7 +2326,7 @@ bridge_rtdelete(struct bridge_softc *sc,
 	/* XXX pserialize_perform for each entry is slow */
 again:
 	BRIDGE_RT_LOCK(sc);
-	LIST_FOREACH(brt, >sc_rtlist, brt_list) {
+	BRIDGE_RTLIST_WRITER_FOREACH(brt, sc) {
 		if (brt->brt_ifp == ifp)
 			break;
 	}
@@ -2329,11 +2357,11 @@ bridge_rtable_init(struct bridge_softc *
 	KM_SLEEP);
 
 	for (i = 0; i < BRIDGE_RTHASH_SIZE; i++)
-		LIST_INIT(>sc_rthash[i]);
+		PSLIST_INIT(>sc_rthash[i]);
 
 	sc->sc_rthash_key = cprng_fast32();
 
-	LIST_INIT(>sc_rtlist);
+	PSLIST_INIT(>sc_rtlist);
 
 	sc->sc_rtlist_psz = pserialize_create();
 	sc->sc_rtlist_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
@@ -2402,7 +2430,7 @@ bridge_rtnode_lookup(struct bridge_softc
 	int dir;
 
 	hash = bridge_rthash(sc, addr);
-	LIST_FOREACH(brt, >sc_rthash[hash], brt_hash) {
+	BRIDGE_RTHASH_READER_FOREACH(brt, sc, hash) {
 		dir = memcmp(addr, brt->brt_addr, ETHER_ADDR_LEN);
 		if (dir == 0)
 			return brt;
@@ -2428,7 +2456,7 @@ bridge_rtnode_insert(struct bridge_softc
 	KASSERT(BRIDGE_RT_LOCKED(sc));
 
 	hash = bridge_rthash(sc, brt->brt_addr);
-	LIST_FOREACH(lbrt, >sc_rthash[hash], brt_hash) {
+	BRIDGE_RTHASH_WRITER_FOREACH(lbrt, sc, hash) {
 		int dir = memcmp(brt->brt_addr, lbrt->brt_addr, 

CVS commit: src/sys/net

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 04:01:58 UTC 2018

Modified Files:
src/sys/net: if_bridge.c if_bridgevar.h

Log Message:
bridge: use pslist(9) for rtlist and rthash

The change fixes race conditions on list operations.  One example is that a
reader may see invalid pointers on a looking item in a list due to lack of
membar_producer.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/net/if_bridge.c
cvs rdiff -u -r1.31 -r1.32 src/sys/net/if_bridgevar.h

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



CVS commit: src/sys/net

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 03:49:44 UTC 2018

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

Log Message:
Simplify bridge_rtnode_insert (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/if_bridge.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

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 03:49:44 UTC 2018

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

Log Message:
Simplify bridge_rtnode_insert (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/net/if_bridge.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/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.150 src/sys/net/if_bridge.c:1.151
--- src/sys/net/if_bridge.c:1.150	Wed Apr 18 03:47:28 2018
+++ src/sys/net/if_bridge.c	Wed Apr 18 03:49:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.150 2018/04/18 03:47:28 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.151 2018/04/18 03:49:44 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.150 2018/04/18 03:47:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.151 2018/04/18 03:49:44 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -2422,40 +2422,25 @@ bridge_rtnode_lookup(struct bridge_softc
 static int
 bridge_rtnode_insert(struct bridge_softc *sc, struct bridge_rtnode *brt)
 {
-	struct bridge_rtnode *lbrt;
+	struct bridge_rtnode *lbrt, *prev = NULL;
 	uint32_t hash;
-	int dir;
 
 	KASSERT(BRIDGE_RT_LOCKED(sc));
 
 	hash = bridge_rthash(sc, brt->brt_addr);
-
-	lbrt = LIST_FIRST(>sc_rthash[hash]);
-	if (lbrt == NULL) {
-		LIST_INSERT_HEAD(>sc_rthash[hash], brt, brt_hash);
-		goto out;
-	}
-
-	do {
-		dir = memcmp(brt->brt_addr, lbrt->brt_addr, ETHER_ADDR_LEN);
+	LIST_FOREACH(lbrt, >sc_rthash[hash], brt_hash) {
+		int dir = memcmp(brt->brt_addr, lbrt->brt_addr, ETHER_ADDR_LEN);
 		if (dir == 0)
 			return EEXIST;
-		if (dir > 0) {
-			LIST_INSERT_BEFORE(lbrt, brt, brt_hash);
-			goto out;
-		}
-		if (LIST_NEXT(lbrt, brt_hash) == NULL) {
-			LIST_INSERT_AFTER(lbrt, brt, brt_hash);
-			goto out;
-		}
-		lbrt = LIST_NEXT(lbrt, brt_hash);
-	} while (lbrt != NULL);
-
-#ifdef DIAGNOSTIC
-	panic("bridge_rtnode_insert: impossible");
-#endif
+		if (dir > 0)
+			break;
+		prev = lbrt;
+	}
+	if (prev == NULL)
+		LIST_INSERT_HEAD(>sc_rthash[hash], brt, brt_hash);
+	else
+		LIST_INSERT_AFTER(prev, brt, brt_hash);
 
- out:
 	LIST_INSERT_HEAD(>sc_rtlist, brt, brt_list);
 	sc->sc_brtcnt++;
 



CVS commit: src/sys/net

2018-04-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Apr 18 03:47:29 UTC 2018

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

Log Message:
Remove obsolete NULL checks


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/net/if_bridge.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/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.149 src/sys/net/if_bridge.c:1.150
--- src/sys/net/if_bridge.c:1.149	Tue Apr 10 07:05:39 2018
+++ src/sys/net/if_bridge.c	Wed Apr 18 03:47:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.149 2018/04/10 07:05:39 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.150 2018/04/18 03:47:28 ozaki-r Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.149 2018/04/10 07:05:39 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.150 2018/04/18 03:47:28 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -181,16 +181,12 @@ __CTASSERT(offsetof(struct ifbifconf, if
 #define	BRIDGE_RTABLE_PRUNE_PERIOD	(5 * 60)
 #endif
 
-#define BRIDGE_RT_LOCK(_sc)	if ((_sc)->sc_rtlist_lock) \
-	mutex_enter((_sc)->sc_rtlist_lock)
-#define BRIDGE_RT_UNLOCK(_sc)	if ((_sc)->sc_rtlist_lock) \
-	mutex_exit((_sc)->sc_rtlist_lock)
-#define BRIDGE_RT_LOCKED(_sc)	(!(_sc)->sc_rtlist_lock || \
- mutex_owned((_sc)->sc_rtlist_lock))
+#define BRIDGE_RT_LOCK(_sc)	mutex_enter((_sc)->sc_rtlist_lock)
+#define BRIDGE_RT_UNLOCK(_sc)	mutex_exit((_sc)->sc_rtlist_lock)
+#define BRIDGE_RT_LOCKED(_sc)	mutex_owned((_sc)->sc_rtlist_lock)
 
 #define BRIDGE_RT_PSZ_PERFORM(_sc) \
-if ((_sc)->sc_rtlist_psz != NULL) \
-	pserialize_perform((_sc)->sc_rtlist_psz);
+pserialize_perform((_sc)->sc_rtlist_psz);
 
 #define BRIDGE_RT_RENTER(__s)	do { __s = pserialize_read_enter(); } while (0)
 #define BRIDGE_RT_REXIT(__s)	do { pserialize_read_exit(__s); } while (0)
@@ -2353,10 +2349,8 @@ bridge_rtable_fini(struct bridge_softc *
 {
 
 	kmem_free(sc->sc_rthash, sizeof(*sc->sc_rthash) * BRIDGE_RTHASH_SIZE);
-	if (sc->sc_rtlist_lock)
-		mutex_obj_free(sc->sc_rtlist_lock);
-	if (sc->sc_rtlist_psz)
-		pserialize_destroy(sc->sc_rtlist_psz);
+	mutex_obj_free(sc->sc_rtlist_lock);
+	pserialize_destroy(sc->sc_rtlist_psz);
 }
 
 /*



Re: CVS commit: [pgoyette-compat] src/doc

2018-04-17 Thread Paul Goyette

On Wed, 18 Apr 2018, Paul Goyette wrote:


Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 01:39:14 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Note current lack of implementation for syscall #148 - pre-5.0 quotactl()


FWIW, this appears to have been a deliberate decision.  See 
sys/kern/syscalls.master rev. 1.248.  The commit log message

said "... for now" but that seems to have turned into "for
ever."  :)



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


CVS commit: [pgoyette-compat] src/doc

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 01:39:14 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Note current lack of implementation for syscall #148 - pre-5.0 quotactl()


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/COMPAT-branch-notes

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



CVS commit: [pgoyette-compat] src/doc

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 01:39:14 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Note current lack of implementation for syscall #148 - pre-5.0 quotactl()


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/doc/COMPAT-branch-notes

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

Modified files:

Index: src/doc/COMPAT-branch-notes
diff -u src/doc/COMPAT-branch-notes:1.1.2.13 src/doc/COMPAT-branch-notes:1.1.2.14
--- src/doc/COMPAT-branch-notes:1.1.2.13	Wed Apr 18 00:04:11 2018
+++ src/doc/COMPAT-branch-notes	Wed Apr 18 01:39:14 2018
@@ -93,3 +93,5 @@ TODO
 and perhaps define something to enable the MI modcmd code to call a
 compat_xx_MD_init() routine.
 
+11. Note that pre-5.0 quotactl (syscall #148) is not currently available.
+Its entry in syscalls.master is XXXd out.



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

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 18 01:18:16 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.c

Log Message:
__noreturn__ does in the header.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/src/file.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/file/dist/src/file.c
diff -u src/external/bsd/file/dist/src/file.c:1.10 src/external/bsd/file/dist/src/file.c:1.11
--- src/external/bsd/file/dist/src/file.c:1.10	Tue Apr 17 08:34:04 2018
+++ src/external/bsd/file/dist/src/file.c	Tue Apr 17 21:18:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.10 2018/04/17 12:34:04 jakllsch Exp $	*/
+/*	$NetBSD: file.c,v 1.11 2018/04/18 01:18:16 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: file.c,v 1.175 2018/03/02 16:11:37 christos Exp $")
 #else
-__RCSID("$NetBSD: file.c,v 1.10 2018/04/17 12:34:04 jakllsch Exp $");
+__RCSID("$NetBSD: file.c,v 1.11 2018/04/18 01:18:16 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -677,9 +677,6 @@ file_getprogname(void)
 	return file_progname;
 }
 
-#ifdef __dead
-__dead
-#endif
 protected void
 file_err(int e, const char *fmt, ...)
 {
@@ -694,9 +691,6 @@ file_err(int e, const char *fmt, ...)
 	exit(e);
 }
 
-#ifdef __dead
-__dead
-#endif
 protected void
 file_errx(int e, const char *fmt, ...)
 {



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

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 18 01:18:16 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.c

Log Message:
__noreturn__ does in the header.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/bsd/file/dist/src/file.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/file/dist/src

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 18 01:17:42 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.h

Log Message:
add __noreturn__ attribute to file_err{,x}


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/src/file.h

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

Modified files:

Index: src/external/bsd/file/dist/src/file.h
diff -u src/external/bsd/file/dist/src/file.h:1.18 src/external/bsd/file/dist/src/file.h:1.19
--- src/external/bsd/file/dist/src/file.h:1.18	Sun Apr 15 15:45:32 2018
+++ src/external/bsd/file/dist/src/file.h	Tue Apr 17 21:17:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.h,v 1.18 2018/04/15 19:45:32 christos Exp $	*/
+/*	$NetBSD: file.h,v 1.19 2018/04/18 01:17:42 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -620,9 +620,9 @@ int enable_sandbox_full(void);
 protected const char *file_getprogname(void);
 protected void file_setprogname(const char *);
 protected void file_err(int, const char *, ...)
-__attribute__((__format__(__printf__, 2, 3)));
+__attribute__((__format__(__printf__, 2, 3), __noreturn__));
 protected void file_errx(int, const char *, ...)
-__attribute__((__format__(__printf__, 2, 3)));
+__attribute__((__format__(__printf__, 2, 3), __noreturn__));
 protected void file_warn(const char *, ...)
 __attribute__((__format__(__printf__, 1, 2)));
 protected void file_warnx(const char *, ...)



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

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 18 01:17:42 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.h

Log Message:
add __noreturn__ attribute to file_err{,x}


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/src/file.h

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



CVS commit: [pgoyette-compat] src/doc

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 00:04:11 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Note changes to syscalls.master and friends


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/COMPAT-branch-notes

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

Modified files:

Index: src/doc/COMPAT-branch-notes
diff -u src/doc/COMPAT-branch-notes:1.1.2.12 src/doc/COMPAT-branch-notes:1.1.2.13
--- src/doc/COMPAT-branch-notes:1.1.2.12	Tue Apr 17 23:06:11 2018
+++ src/doc/COMPAT-branch-notes	Wed Apr 18 00:04:11 2018
@@ -43,6 +43,9 @@ DONE
 There are still several areas which are not complete - see the
 TODO list below for more details.
 
+10. syscalls.master has been updated to autoload the version-specific
+compat modules rather than the monolithic modules.
+
 
 TODO
 
@@ -50,43 +53,40 @@ TODO
 COMPAT_xx.  When found, move the actual compat code into the compat
 hierarchy and replace originals with indirect (vectored) calls.
 
-2.  Update syscalls.master to reflect that modular syscalls are now
-provided by version-specific modules.
-
-3.  The rtsock compat code is a disaster, with rtsock_50.c #include-ing
+2.  The rtsock compat code is a disaster, with rtsock_50.c #include-ing
 the main rtsock.c code with various manipulations of the COMPAT_50
 macro.
 
-4.  The compat_60 module still needs some work for XEN systems.  We
+3.  The compat_60 module still needs some work for XEN systems.  We
 probably need some build infrastructure changes to ensure that
 XEN (and, for i386, XEN-PAE) modules are build with the correct
 macros defined and with -I directories specified in the same order
 as for building kernels.
 
-5.  Update syscalls.master to point the compat calls at the specific
+4.  Update syscalls.master to point the compat calls at the specific
 modules rather than the monolithic compat module.  Update the
 "required" lists of other modules, too.
 
-6.  The rtsock compatability code needs to be de-spaghetti'd and made
+5.  The rtsock compatability code needs to be de-spaghetti'd and made
 separable into rtsock_70 and rtsock_50 pieces.
 
-8.  Once rtsock is separated, compat_14 references to rtsock_50 routines
+6.  Once rtsock is separated, compat_14 references to rtsock_50 routines
 needs to be verified.
 
-8.  For compat_60, still need to figure out what to do with BSDPTY and
+7.  For compat_60, still need to figure out what to do with BSDPTY and
 tty_ptm
 
-9.  Also for compat_60, need to fix the building of XEN (and, for i386,
+8.  Also for compat_60, need to fix the building of XEN (and, for i386,
 XEN-PAE) module variants so that the obj-dir symlinks and the -I
 include order match those present in a kernel build.  See PR/53130
 (Currently, this affects the compat_60 module and its implementation
 of microcode updates for AMD processors - i386 and amd64.)
 
-10. For compat_50, in addition to rtsock there are some things in dev/vnd,
+9.  For compat_50, in addition to rtsock there are some things in dev/vnd,
 dev/gpio, and dev/wscons/wsmux that I haven't been able to cleanly
 separate.
 
-11. There seems to be quite a bit of MD compat_xx code, in the various
+10. There seems to be quite a bit of MD compat_xx code, in the various
 sys/arch/ directories.  I haven't yet looked at any of this.  But it
 seems to me that the MI compat build infrastructure should have some
 mechanism to "reach over" to the MD code, #include a Makefile.inc file,



CVS commit: [pgoyette-compat] src/sys

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 00:01:19 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: init_sysent.c syscalls.c
syscalls_autoload.c systrace_args.c
src/sys/rump/include/rump [pgoyette-compat]: rump_syscalls.h
src/sys/rump/librump/rumpkern [pgoyette-compat]: rump_syscalls.c
src/sys/sys [pgoyette-compat]: syscall.h syscallargs.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.319.2.6 -r1.319.2.7 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.310.2.6 -r1.310.2.7 src/sys/kern/syscalls.c
cvs rdiff -u -r1.27.2.6 -r1.27.2.7 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.29.2.6 -r1.29.2.7 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.108.2.6 -r1.108.2.7 \
src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.137.2.6 -r1.137.2.7 \
src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.304.2.6 -r1.304.2.7 src/sys/sys/syscall.h
cvs rdiff -u -r1.288.2.6 -r1.288.2.7 src/sys/sys/syscallargs.h

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

Modified files:

Index: src/sys/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.319.2.6 src/sys/kern/init_sysent.c:1.319.2.7
--- src/sys/kern/init_sysent.c:1.319.2.6	Tue Mar 27 23:11:18 2018
+++ src/sys/kern/init_sysent.c	Wed Apr 18 00:01:18 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: init_sysent.c,v 1.319.2.6 2018/03/27 23:11:18 pgoyette Exp $ */
+/* $NetBSD: init_sysent.c,v 1.319.2.7 2018/04/18 00:01:18 pgoyette Exp $ */
 
 /*
  * System call switch table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.7 2018/04/17 23:58:48 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319.2.6 2018/03/27 23:11:18 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.319.2.7 2018/04/18 00:01:18 pgoyette Exp $");
 
 #include "opt_modular.h"
 #include "opt_ntp.h"

Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.310.2.6 src/sys/kern/syscalls.c:1.310.2.7
--- src/sys/kern/syscalls.c:1.310.2.6	Tue Mar 27 23:11:18 2018
+++ src/sys/kern/syscalls.c	Wed Apr 18 00:01:18 2018
@@ -1,14 +1,14 @@
-/* $NetBSD: syscalls.c,v 1.310.2.6 2018/03/27 23:11:18 pgoyette Exp $ */
+/* $NetBSD: syscalls.c,v 1.310.2.7 2018/04/18 00:01:18 pgoyette Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.7 2018/04/17 23:58:48 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.6 2018/03/27 23:11:18 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.310.2.7 2018/04/18 00:01:18 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_modular.h"

Index: src/sys/kern/syscalls_autoload.c
diff -u src/sys/kern/syscalls_autoload.c:1.27.2.6 src/sys/kern/syscalls_autoload.c:1.27.2.7
--- src/sys/kern/syscalls_autoload.c:1.27.2.6	Tue Mar 27 23:11:18 2018
+++ src/sys/kern/syscalls_autoload.c	Wed Apr 18 00:01:18 2018
@@ -1,123 +1,123 @@
-/* $NetBSD: syscalls_autoload.c,v 1.27.2.6 2018/03/27 23:11:18 pgoyette Exp $ */
+/* $NetBSD: syscalls_autoload.c,v 1.27.2.7 2018/04/18 00:01:18 pgoyette Exp $ */
 
 /*
  * System call autoload table.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp
+ * created from	NetBSD: syscalls.master,v 1.291.2.7 2018/04/17 23:58:48 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27.2.6 2018/03/27 23:11:18 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls_autoload.c,v 1.27.2.7 2018/04/18 00:01:18 pgoyette Exp $");
 
 #include 
 static struct sc_autoload netbsd_syscalls_autoload[] = {
-	{ SYS_compat_50_wait4, "compat" },
-	{ SYS_compat_43_ocreat, "compat" },
-	{ SYS_compat_50_mknod, "compat" },
-	{ SYS_compat_20_getfsstat, "compat" },
-	{ SYS_compat_43_olseek, "compat" },
-	{ SYS_compat_40_mount, "compat" },
+	{ SYS_compat_50_wait4, "compat_50" },
+	{ SYS_compat_43_ocreat, "compat_43" },
+	{ SYS_compat_50_mknod, "compat_50" },
+	{ SYS_compat_20_getfsstat, "compat_20" },
+	{ SYS_compat_43_olseek, "compat_43" },
+	{ SYS_compat_40_mount, "compat_40" },
 	{ SYS_ptrace, "ptrace" },
-	{ SYS_compat_43_stat43, "compat" },
-	{ SYS_compat_43_lstat43, "compat" },
-	{ SYS_compat_13_sigaction13, "compat" },
-	{ SYS_compat_13_sigprocmask13, "compat" },
-	{ SYS_compat_13_sigpending13, "compat" },
-	{ SYS_compat_13_sigaltstack13, "compat" },
-	{ SYS_compat_12_oreboot, "compat" },
-	{ SYS_compat_43_fstat43, "compat" },
-	{ SYS_compat_43_ogetkerninfo, "compat" },
-	{ 

CVS commit: [pgoyette-compat] src/doc

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 00:04:11 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes

Log Message:
Note changes to syscalls.master and friends


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/COMPAT-branch-notes

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



CVS commit: [pgoyette-compat] src/sys

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Apr 18 00:01:19 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: init_sysent.c syscalls.c
syscalls_autoload.c systrace_args.c
src/sys/rump/include/rump [pgoyette-compat]: rump_syscalls.h
src/sys/rump/librump/rumpkern [pgoyette-compat]: rump_syscalls.c
src/sys/sys [pgoyette-compat]: syscall.h syscallargs.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.319.2.6 -r1.319.2.7 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.310.2.6 -r1.310.2.7 src/sys/kern/syscalls.c
cvs rdiff -u -r1.27.2.6 -r1.27.2.7 src/sys/kern/syscalls_autoload.c
cvs rdiff -u -r1.29.2.6 -r1.29.2.7 src/sys/kern/systrace_args.c
cvs rdiff -u -r1.108.2.6 -r1.108.2.7 \
src/sys/rump/include/rump/rump_syscalls.h
cvs rdiff -u -r1.137.2.6 -r1.137.2.7 \
src/sys/rump/librump/rumpkern/rump_syscalls.c
cvs rdiff -u -r1.304.2.6 -r1.304.2.7 src/sys/sys/syscall.h
cvs rdiff -u -r1.288.2.6 -r1.288.2.7 src/sys/sys/syscallargs.h

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



CVS commit: [pgoyette-compat] src/sys/kern

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:58:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update compat module names to reference the version-specific modules.

This way, when we autoload compat code we load only what is needed,
and nothing "older".


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.6 -r1.291.2.7 src/sys/kern/syscalls.master

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/syscalls.master
diff -u src/sys/kern/syscalls.master:1.291.2.6 src/sys/kern/syscalls.master:1.291.2.7
--- src/sys/kern/syscalls.master:1.291.2.6	Tue Mar 27 23:08:44 2018
+++ src/sys/kern/syscalls.master	Tue Apr 17 23:58:48 2018
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.291.2.6 2018/03/27 23:08:44 pgoyette Exp $
+	$NetBSD: syscalls.master,v 1.291.2.7 2018/04/17 23:58:48 pgoyette Exp $
 
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
 
@@ -76,28 +76,28 @@
 5	STD 	 RUMP	{ int|sys||open(const char *path, \
 			int flags, ... mode_t mode); }
 6	STD	 RUMP	{ int|sys||close(int fd); }
-7	COMPAT_50 MODULAR compat { int|sys||wait4(pid_t pid, int *status, \
+7	COMPAT_50 MODULAR compat_50 { int|sys||wait4(pid_t pid, int *status, \
 			int options, struct rusage50 *rusage); }
-8	COMPAT_43 MODULAR compat	\
+8	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||creat(const char *path, mode_t mode); } ocreat
 9	STD 	 RUMP	{ int|sys||link(const char *path, const char *link); }
 10	STD 	 RUMP	{ int|sys||unlink(const char *path); }
 11	OBSOL		execv
 12	STD 	 RUMP	{ int|sys||chdir(const char *path); }
 13	STD 	 RUMP	{ int|sys||fchdir(int fd); }
-14	COMPAT_50 MODULAR compat RUMP	\
+14	COMPAT_50 MODULAR compat_50 RUMP	\
 		{ int|sys||mknod(const char *path, mode_t mode, uint32_t dev); }
 15	STD 	 RUMP	{ int|sys||chmod(const char *path, mode_t mode); }
 16	STD 	 RUMP	{ int|sys||chown(const char *path, uid_t uid, \
 			gid_t gid); }
 17	STD 		{ int|sys||obreak(char *nsize); } break
-18	COMPAT_20 MODULAR compat { int|sys||getfsstat(struct statfs12 *buf, \
+18	COMPAT_20 MODULAR compat_20 { int|sys||getfsstat(struct statfs12 *buf, \
 			long bufsize, int flags); }
-19	COMPAT_43 MODULAR compat	\
+19	COMPAT_43 MODULAR compat_43	\
 		{ long|sys||lseek(int fd, long offset, int whence); }\
 			olseek
 20	NOERR 	RUMP	{ pid_t|sys||getpid_with_ppid(void); } getpid
-21	COMPAT_40 MODULAR compat	\
+21	COMPAT_40 MODULAR compat_40	\
 		{ int|sys||mount(const char *type, const char *path, \
 			int flags, void *data); }
 22	STD 	RUMP	{ int|sys||unmount(const char *path, int flags); }
@@ -125,10 +125,10 @@
 35	STD 	RUMP	{ int|sys||fchflags(int fd, u_long flags); }
 36	NOERR 	 RUMP	{ void|sys||sync(void); }
 37	STD 		{ int|sys||kill(pid_t pid, int signum); }
-38	COMPAT_43 MODULAR compat	\
+38	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||stat(const char *path, struct stat43 *ub); } stat43
 39	NOERR 	RUMP	{ pid_t|sys||getppid(void); }
-40	COMPAT_43 MODULAR compat	\
+40	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||lstat(const char *path, \
 			struct stat43 *ub); } lstat43
 41	STD 	RUMP	{ int|sys||dup(int fd); }
@@ -138,22 +138,22 @@
 			u_long offset, u_int scale); }
 45	STD 	RUMP	{ int|sys||ktrace(const char *fname, int ops, \
 			int facs, pid_t pid); }
-46	COMPAT_13 MODULAR compat { int|sys||sigaction(int signum, \
+46	COMPAT_13 MODULAR compat_13 { int|sys||sigaction(int signum, \
 			const struct sigaction13 *nsa, \
 			struct sigaction13 *osa); } sigaction13
 47	NOERR 	RUMP	{ gid_t|sys||getgid_with_egid(void); } getgid
-48	COMPAT_13 MODULAR compat { int|sys||sigprocmask(int how, \
+48	COMPAT_13 MODULAR compat_13 { int|sys||sigprocmask(int how, \
 			int mask); } sigprocmask13
 49	STD 	RUMP	{ int|sys||__getlogin(char *namebuf, size_t namelen); }
 50	STD 	RUMP 	{ int|sys||__setlogin(const char *namebuf); }
 51	STD 		{ int|sys||acct(const char *path); }
-52	COMPAT_13 MODULAR compat { int|sys||sigpending(void); } sigpending13
-53	COMPAT_13 MODULAR compat { int|sys||sigaltstack( \
+52	COMPAT_13 MODULAR compat_13 { int|sys||sigpending(void); } sigpending13
+53	COMPAT_13 MODULAR compat_13 { int|sys||sigaltstack( \
 			const struct sigaltstack13 *nss, \
 			struct sigaltstack13 *oss); } sigaltstack13
 54	STD	RUMP	{ int|sys||ioctl(int fd, \
 			u_long com, ... void *data); }
-55	COMPAT_12 MODULAR compat { int|sys||reboot(int opt); } oreboot
+55	COMPAT_12 MODULAR compat_12 { int|sys||reboot(int opt); } oreboot
 56	STD 	 RUMP	{ int|sys||revoke(const char *path); }
 57	STD 	 RUMP	{ int|sys||symlink(const char *path, \
 			const char *link); }
@@ -163,21 +163,21 @@
 			char * const *argp, char * const *envp); }
 60	STD 	 RUMP	{ mode_t|sys||umask(mode_t newmask); }
 61	STD 	 RUMP	{ int|sys||chroot(const char *path); }
-62	COMPAT_43 MODULAR compat	\
+62	COMPAT_43 MODULAR compat_43	\
 		{ int|sys||fstat(int fd, struct 

CVS commit: [pgoyette-compat] src/sys/kern

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:58:48 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: syscalls.master

Log Message:
Update compat module names to reference the version-specific modules.

This way, when we autoload compat code we load only what is needed,
and nothing "older".


To generate a diff of this commit:
cvs rdiff -u -r1.291.2.6 -r1.291.2.7 src/sys/kern/syscalls.master

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



Re: CVS commit: src/sys/sys

2018-04-17 Thread Kamil Rytarowski
On 18.04.2018 01:29, Kamil Rytarowski wrote:
> On 17.04.2018 23:50, Michael van Elst wrote:
>> On Tue, Apr 17, 2018 at 05:45:13PM +0200, Kamil Rytarowski wrote:
>>> On 04.03.2018 08:13, Michael van Elst wrote:
 Module Name:   src
 Committed By:  mlelstv
 Date:  Sun Mar  4 07:13:11 UTC 2018

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

 Log Message:
 Expose device structures to _KMEMUSER


>>>
>>> This broke building device.h with _KMEMUSER.
>>>
 @@ -81,7 +81,7 @@
  #include 
  #include 
  
 -#ifdef _KERNEL
 +#if defined(_KERNEL) || defined(_KMEMUSER)
  #include 
  #include 
  #include 
>>>
>>> The sys/pmf.h header is not accessible from userland.
>>
>> True.
>>
>> What program includes device.h as _KMEMUSER but crash(8) ? There
>> shouldn't be any.
>>
>> crash helps itself by including system headers, but that's probably
>> not a good recipe for everyone.
>>
>>
>>
>> Greetings,
>>
> 
> I'm including this header indirectly in compiler-rt (with local
> patches). I have a long list of includes and _KMEMUSER on top.
> 
> It's included at least through  ->  ->
> .
> 
> https://github.com/llvm-mirror/compiler-rt/blob/master/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
> + local patch
> https://github.com/NetBSD/pkgsrc-wip/blob/master/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc
> 
> This code used to build and work before that change.
> 

Looking at other users, everyone except  include
 in the _KERNEL namespace.



signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/sys/sys

2018-04-17 Thread Kamil Rytarowski
On 17.04.2018 23:50, Michael van Elst wrote:
> On Tue, Apr 17, 2018 at 05:45:13PM +0200, Kamil Rytarowski wrote:
>> On 04.03.2018 08:13, Michael van Elst wrote:
>>> Module Name:src
>>> Committed By:   mlelstv
>>> Date:   Sun Mar  4 07:13:11 UTC 2018
>>>
>>> Modified Files:
>>> src/sys/sys: device.h
>>>
>>> Log Message:
>>> Expose device structures to _KMEMUSER
>>>
>>>
>>
>> This broke building device.h with _KMEMUSER.
>>
>>> @@ -81,7 +81,7 @@
>>>  #include 
>>>  #include 
>>>  
>>> -#ifdef _KERNEL
>>> +#if defined(_KERNEL) || defined(_KMEMUSER)
>>>  #include 
>>>  #include 
>>>  #include 
>>
>> The sys/pmf.h header is not accessible from userland.
> 
> True.
> 
> What program includes device.h as _KMEMUSER but crash(8) ? There
> shouldn't be any.
> 
> crash helps itself by including system headers, but that's probably
> not a good recipe for everyone.
> 
> 
> 
> Greetings,
> 

I'm including this header indirectly in compiler-rt (with local
patches). I have a long list of includes and _KMEMUSER on top.

It's included at least through  ->  ->
.

https://github.com/llvm-mirror/compiler-rt/blob/master/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc
+ local patch
https://github.com/NetBSD/pkgsrc-wip/blob/master/compiler-rt-netbsd/patches/patch-lib_sanitizer__common_sanitizer__platform__limits__netbsd.cc

This code used to build and work before that change.



signature.asc
Description: OpenPGP digital signature


CVS commit: [pgoyette-compat] src

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:06:12 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes
src/sys/compat/common [pgoyette-compat]: compat_sysv_mod.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_sysv_10_mod.c
compat_sysv_14_mod.c compat_sysv_50_mod.c
src/sys/modules/compat_sysv_10 [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv_14 [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv_50 [pgoyette-compat]: Makefile

Log Message:
Split the compat_sysv module into several version-specific modules,
similar to the compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/COMPAT-branch-notes
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_sysv_10_mod.c \
src/sys/compat/common/compat_sysv_14_mod.c \
src/sys/compat/common/compat_sysv_50_mod.c
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/compat/common/compat_sysv_mod.c
cvs rdiff -u -r1.202.2.20 -r1.202.2.21 src/sys/modules/Makefile
cvs rdiff -u -r1.3.10.4 -r1.3.10.5 src/sys/modules/compat_sysv/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_10/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_14/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_50/Makefile

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

Modified files:

Index: src/doc/COMPAT-branch-notes
diff -u src/doc/COMPAT-branch-notes:1.1.2.11 src/doc/COMPAT-branch-notes:1.1.2.12
--- src/doc/COMPAT-branch-notes:1.1.2.11	Tue Apr 17 06:20:26 2018
+++ src/doc/COMPAT-branch-notes	Tue Apr 17 23:06:11 2018
@@ -37,6 +37,9 @@ DONE
 is still available, and uses the alias mechanism to "advertise"
 that the component modules are available.
 
+Similarly, the compat_sysv module has also been split into several
+version-specific modules.
+
 There are still several areas which are not complete - see the
 TODO list below for more details.
 
@@ -47,46 +50,43 @@ TODO
 COMPAT_xx.  When found, move the actual compat code into the compat
 hierarchy and replace originals with indirect (vectored) calls.
 
-2.  Similar to the monolithic netbsd module, split the compat_sysv
-module into multiple version-specific modules.
-
-3.  Update syscalls.master to reflect that modular syscalls are now
+2.  Update syscalls.master to reflect that modular syscalls are now
 provided by version-specific modules.
 
-4.  The rtsock compat code is a disaster, with rtsock_50.c #include-ing
+3.  The rtsock compat code is a disaster, with rtsock_50.c #include-ing
 the main rtsock.c code with various manipulations of the COMPAT_50
 macro.
 
-5.  The compat_60 module still needs some work for XEN systems.  We
+4.  The compat_60 module still needs some work for XEN systems.  We
 probably need some build infrastructure changes to ensure that
 XEN (and, for i386, XEN-PAE) modules are build with the correct
 macros defined and with -I directories specified in the same order
 as for building kernels.
 
-6.  Update syscalls.master to point the compat calls at the specific
+5.  Update syscalls.master to point the compat calls at the specific
 modules rather than the monolithic compat module.  Update the
 "required" lists of other modules, too.
 
-7.  The rtsock compatability code needs to be de-spaghetti'd and made
+6.  The rtsock compatability code needs to be de-spaghetti'd and made
 separable into rtsock_70 and rtsock_50 pieces.
 
 8.  Once rtsock is separated, compat_14 references to rtsock_50 routines
 needs to be verified.
 
-9.  For compat_60, still need to figure out what to do with BSDPTY and
+8.  For compat_60, still need to figure out what to do with BSDPTY and
 tty_ptm
 
-10. Also for compat_60, need to fix the building of XEN (and, for i386,
+9.  Also for compat_60, need to fix the building of XEN (and, for i386,
 XEN-PAE) module variants so that the obj-dir symlinks and the -I
 include order match those present in a kernel build.  See PR/53130
 (Currently, this affects the compat_60 module and its implementation
 of microcode updates for AMD processors - i386 and amd64.)
 
-11. For compat_50, in addition to rtsock there are some things in dev/vnd,
+10. For compat_50, in addition to rtsock there are some things in dev/vnd,
 dev/gpio, and dev/wscons/wsmux that I haven't been able to cleanly
 separate.
 
-12. There seems to be quite a bit of MD compat_xx code, in the various
+11. There seems to be quite a bit of MD compat_xx code, in the various
 sys/arch/ directories.  I haven't yet looked at any of this.  But it
 seems to me that the MI compat build infrastructure should have some
 mechanism to "reach over" to the MD 

CVS commit: [pgoyette-compat] src

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 23:06:12 UTC 2018

Modified Files:
src/doc [pgoyette-compat]: COMPAT-branch-notes
src/sys/compat/common [pgoyette-compat]: compat_sysv_mod.c
src/sys/modules [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv [pgoyette-compat]: Makefile
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_sysv_10_mod.c
compat_sysv_14_mod.c compat_sysv_50_mod.c
src/sys/modules/compat_sysv_10 [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv_14 [pgoyette-compat]: Makefile
src/sys/modules/compat_sysv_50 [pgoyette-compat]: Makefile

Log Message:
Split the compat_sysv module into several version-specific modules,
similar to the compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/COMPAT-branch-notes
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_sysv_10_mod.c \
src/sys/compat/common/compat_sysv_14_mod.c \
src/sys/compat/common/compat_sysv_50_mod.c
cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/compat/common/compat_sysv_mod.c
cvs rdiff -u -r1.202.2.20 -r1.202.2.21 src/sys/modules/Makefile
cvs rdiff -u -r1.3.10.4 -r1.3.10.5 src/sys/modules/compat_sysv/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_10/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_14/Makefile
cvs rdiff -u -r0 -r1.1.2.1 src/sys/modules/compat_sysv_50/Makefile

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



CVS commit: [pgoyette-compat] src/sys/compat/common

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 22:31:41 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c

Log Message:
Ooops - forgot to enable the last couple of alias module names.


To generate a diff of this commit:
cvs rdiff -u -r1.24.14.34 -r1.24.14.35 src/sys/compat/common/compat_mod.c

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

Modified files:

Index: src/sys/compat/common/compat_mod.c
diff -u src/sys/compat/common/compat_mod.c:1.24.14.34 src/sys/compat/common/compat_mod.c:1.24.14.35
--- src/sys/compat/common/compat_mod.c:1.24.14.34	Tue Apr 17 07:24:55 2018
+++ src/sys/compat/common/compat_mod.c	Tue Apr 17 22:31:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_mod.c,v 1.24.14.34 2018/04/17 07:24:55 pgoyette Exp $	*/
+/*	$NetBSD: compat_mod.c,v 1.24.14.35 2018/04/17 22:31:41 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.34 2018/04/17 07:24:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_mod.c,v 1.24.14.35 2018/04/17 22:31:41 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -56,7 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: compat_mod.c
 static const char * const compat_includes[] = {
 	"compat_80", "compat_70", "compat_60", "compat_50", "compat_40",
 	"compat_30", "compat_20", "compat_16", "compat_14", "compat_13",
-	"compat_12", /*"compat_10", "compat_09",*/ "compat_43", NULL
+	"compat_12", "compat_10", "compat_09", "compat_43", NULL
 };
 
 MODULE_WITH_ALIASES(MODULE_CLASS_EXEC, compat, NULL, _includes);



CVS commit: [pgoyette-compat] src/sys/compat/common

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 22:31:41 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: compat_mod.c

Log Message:
Ooops - forgot to enable the last couple of alias module names.


To generate a diff of this commit:
cvs rdiff -u -r1.24.14.34 -r1.24.14.35 src/sys/compat/common/compat_mod.c

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



CVS commit: [pgoyette-compat] src/sys

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 21:59:27 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: files.common
src/sys/kern [pgoyette-compat]: sysv_ipc.c
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_sysv_mod.c
compat_sysv_mod.h
Removed Files:
src/sys/compat/common [pgoyette-compat]: sysv_mod.c sysv_mod.h

Log Message:
Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4.10.1 src/sys/compat/common/compat_sysv_mod.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_sysv_mod.h
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/sys/compat/common/files.common
cvs rdiff -u -r1.1.2.7 -r0 src/sys/compat/common/sysv_mod.c
cvs rdiff -u -r1.1.2.3 -r0 src/sys/compat/common/sysv_mod.h
cvs rdiff -u -r1.32.16.3 -r1.32.16.4 src/sys/kern/sysv_ipc.c

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



CVS commit: [pgoyette-compat] src/sys

2018-04-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 21:59:27 UTC 2018

Modified Files:
src/sys/compat/common [pgoyette-compat]: files.common
src/sys/kern [pgoyette-compat]: sysv_ipc.c
Added Files:
src/sys/compat/common [pgoyette-compat]: compat_sysv_mod.c
compat_sysv_mod.h
Removed Files:
src/sys/compat/common [pgoyette-compat]: sysv_mod.c sysv_mod.h

Log Message:
Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4.10.1 src/sys/compat/common/compat_sysv_mod.c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/compat/common/compat_sysv_mod.h
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/sys/compat/common/files.common
cvs rdiff -u -r1.1.2.7 -r0 src/sys/compat/common/sysv_mod.c
cvs rdiff -u -r1.1.2.3 -r0 src/sys/compat/common/sysv_mod.h
cvs rdiff -u -r1.32.16.3 -r1.32.16.4 src/sys/kern/sysv_ipc.c

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

Modified files:

Index: src/sys/compat/common/files.common
diff -u src/sys/compat/common/files.common:1.1.2.32 src/sys/compat/common/files.common:1.1.2.33
--- src/sys/compat/common/files.common:1.1.2.32	Tue Apr 17 07:24:55 2018
+++ src/sys/compat/common/files.common	Tue Apr 17 21:59:27 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.common,v 1.1.2.32 2018/04/17 07:24:55 pgoyette Exp $
+#	$NetBSD: files.common,v 1.1.2.33 2018/04/17 21:59:27 pgoyette Exp $
 
 #
 # Generic files, used by all compat options.
@@ -109,7 +109,7 @@ file	compat/common/kern_mod_80.c		compat
 # Module interface for sysv ipc compatability options
 
 define	compat_sysv			: sysvmsg, sysvshm, sysvsem
-file	compat/common/sysv_mod.c		compat_sysv
+file	compat/common/compat_sysv_mod.c		compat_sysv
 
 # Compatibility code for NetBSD 1.0
 file	compat/common/kern_ipc_10.c		compat_sysv

Index: src/sys/kern/sysv_ipc.c
diff -u src/sys/kern/sysv_ipc.c:1.32.16.3 src/sys/kern/sysv_ipc.c:1.32.16.4
--- src/sys/kern/sysv_ipc.c:1.32.16.3	Fri Mar  9 10:41:05 2018
+++ src/sys/kern/sysv_ipc.c	Tue Apr 17 21:59:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_ipc.c,v 1.32.16.3 2018/03/09 10:41:05 pgoyette Exp $	*/
+/*	$NetBSD: sysv_ipc.c,v 1.32.16.4 2018/04/17 21:59:27 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.3 2018/03/09 10:41:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v 1.32.16.4 2018/04/17 21:59:27 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysv_ipc.c,v
 #include 
 #include 
 
-#include 	/* for sysctl routine vector */
+#include 	/* for sysctl routine vector */
 
 int (*vec_sysvipc50_sysctl)(SYSCTLFN_PROTO);
 

Added files:

Index: src/sys/compat/common/compat_sysv_mod.c
diff -u /dev/null src/sys/compat/common/compat_sysv_mod.c:1.4.10.1
--- /dev/null	Tue Apr 17 21:59:28 2018
+++ src/sys/compat/common/compat_sysv_mod.c	Tue Apr 17 21:59:27 2018
@@ -0,0 +1,127 @@
+/*	$NetBSD: compat_sysv_mod.c,v 1.4.10.1 2018/04/17 21:59:27 pgoyette Exp $	*/
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software developed for The NetBSD Foundation
+ * by Paul Goyette
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: compat_sysv_mod.c,v 1.4.10.1 2018/04/17 21:59:27 pgoyette Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_compat_netbsd.h"
+#include "opt_sysv.h"
+#endif
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+

Re: CVS commit: src/sys/sys

2018-04-17 Thread Michael van Elst
On Tue, Apr 17, 2018 at 05:45:13PM +0200, Kamil Rytarowski wrote:
> On 04.03.2018 08:13, Michael van Elst wrote:
> > Module Name:src
> > Committed By:   mlelstv
> > Date:   Sun Mar  4 07:13:11 UTC 2018
> > 
> > Modified Files:
> > src/sys/sys: device.h
> > 
> > Log Message:
> > Expose device structures to _KMEMUSER
> > 
> > 
> 
> This broke building device.h with _KMEMUSER.
> 
> > @@ -81,7 +81,7 @@
> >  #include 
> >  #include 
> >  
> > -#ifdef _KERNEL
> > +#if defined(_KERNEL) || defined(_KMEMUSER)
> >  #include 
> >  #include 
> >  #include 
> 
> The sys/pmf.h header is not accessible from userland.

True.

What program includes device.h as _KMEMUSER but crash(8) ? There
shouldn't be any.

crash helps itself by including system headers, but that's probably
not a good recipe for everyone.



Greetings,
-- 
Michael van Elst
Internet: mlel...@serpens.de
"A potential Snark may lurk in every tree."


re: CVS commit: [pgoyette-compat] src

2018-04-17 Thread Paul Goyette

On Wed, 18 Apr 2018, matthew green wrote:


"Paul Goyette" writes:

Module Name:src
Committed By:   pgoyette
Date:   Tue Apr 17 08:02:35 UTC 2018

Modified Files:
src/distrib/sets/lists/modules [pgoyette-compat]: mi
src/sys/modules [pgoyette-compat]: Makefile
Added Files:
src/sys/modules/compat_sysctl_09_43 [pgoyette-compat]: Makefile

Log Message:
Actually create the new compat_sysctl_09_43 module


hmm, these combined seems like an odd choice.  typically,
older compat relies upon newer comapt, except for compat_43,
which is more about enabing 4.3BSD tty and other interfaces
we have modern APIs for.

eg, it's valid to have a non netbsd comapt but compat_43
kernel running with software compiled today that uses the
old  interface, for instance.  the above change
seems to imply that doing this will pull in all other
compat as well, via compat_09.


In this case, both compat_43 and compat_09 depend on having this
"shared" module available, but this module doesn't require any
other compat code.  If you load _either_ of compat_43 or compat_09
it will pull in the shared module automatically.

Of course, compat_09 requires all the newer stuff, but compat_43
doesn't.

If you've got a better suggestion for the module name (one that
doesn't imply pulling in all the other compat code), I'd be happy
to use it!



+--+--++
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:  |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee dot com   |
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd dot org |
+--+--++


re: CVS commit: [pgoyette-compat] src

2018-04-17 Thread matthew green
"Paul Goyette" writes:
> Module Name:  src
> Committed By: pgoyette
> Date: Tue Apr 17 08:02:35 UTC 2018
> 
> Modified Files:
>   src/distrib/sets/lists/modules [pgoyette-compat]: mi
>   src/sys/modules [pgoyette-compat]: Makefile
> Added Files:
>   src/sys/modules/compat_sysctl_09_43 [pgoyette-compat]: Makefile
> 
> Log Message:
> Actually create the new compat_sysctl_09_43 module

hmm, these combined seems like an odd choice.  typically,
older compat relies upon newer comapt, except for compat_43,
which is more about enabing 4.3BSD tty and other interfaces
we have modern APIs for.

eg, it's valid to have a non netbsd comapt but compat_43
kernel running with software compiled today that uses the
old  interface, for instance.  the above change
seems to imply that doing this will pull in all other
compat as well, via compat_09.


.mrg.


CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:56:08 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_input.c

Log Message:
fix comments


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/netipsec/ipsec_input.c

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

Modified files:

Index: src/sys/netipsec/ipsec_input.c
diff -u src/sys/netipsec/ipsec_input.c:1.63 src/sys/netipsec/ipsec_input.c:1.64
--- src/sys/netipsec/ipsec_input.c:1.63	Sun Apr 15 07:35:49 2018
+++ src/sys/netipsec/ipsec_input.c	Tue Apr 17 17:56:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_input.c,v 1.63 2018/04/15 07:35:49 maxv Exp $	*/
+/*	$NetBSD: ipsec_input.c,v 1.64 2018/04/17 17:56:08 maxv Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/ipsec_input.c,v 1.2.4.2 2003/03/28 20:32:53 sam Exp $	*/
 /*	$OpenBSD: ipsec_input.c,v 1.63 2003/02/20 18:35:43 deraadt Exp $	*/
 
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.63 2018/04/15 07:35:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_input.c,v 1.64 2018/04/17 17:56:08 maxv Exp $");
 
 /*
  * IPsec input processing.
@@ -175,8 +175,8 @@ ipsec4_fixup_checksum(struct mbuf *m)
 
 /*
  * ipsec_common_input gets called when an IPsec-protected packet
- * is received by IPv4 or IPv6.  It's job is to find the right SA
- # and call the appropriate transform.  The transform callback
+ * is received by IPv4 or IPv6.  Its job is to find the right SA
+ * and call the appropriate transform.  The transform callback
  * takes care of further processing (like ingress filtering).
  */
 static int
@@ -685,7 +685,7 @@ ipsec6_common_input_cb(struct mbuf *m, s
 
 		/*
 		 * Enforce IPsec policy checking if we are seeing last header.
-		 * note that we do not visit this with protocols with pcb layer
+		 * Note that we do not visit this with protocols with pcb layer
 		 * code - like udp/tcp/raw ip.
 		 */
 		if ((inet6sw[ip6_protox[nxt]].pr_flags & PR_LASTHDR) != 0 &&



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:56:08 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_input.c

Log Message:
fix comments


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/netipsec/ipsec_input.c

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



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:47:05 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Add XXX. If this code really does something, it should use MCHTYPE.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/netipsec/ipsec.c

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



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:47:05 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Add XXX. If this code really does something, it should use MCHTYPE.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.154 src/sys/netipsec/ipsec.c:1.155
--- src/sys/netipsec/ipsec.c:1.154	Tue Apr 17 17:40:38 2018
+++ src/sys/netipsec/ipsec.c	Tue Apr 17 17:47:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.154 2018/04/17 17:40:38 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.155 2018/04/17 17:47:05 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.154 2018/04/17 17:40:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.155 2018/04/17 17:47:05 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -1269,7 +1269,9 @@ ipsec_get_policy(void *inp, const void *
 		return ENOBUFS;
 	}
 
+	/* XXX XXX XXX: What's the point? */
 	(*mp)->m_type = MT_DATA;
+
 	if (KEYDEBUG_ON(KEYDEBUG_IPSEC_DUMP)) {
 		kdebug_mbuf(__func__, *mp);
 	}



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:40:38 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Style, add XXX (about the mtu that goes negative), and remove #ifdef inet.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/netipsec/ipsec.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.153 src/sys/netipsec/ipsec.c:1.154
--- src/sys/netipsec/ipsec.c:1.153	Tue Apr  3 09:03:59 2018
+++ src/sys/netipsec/ipsec.c	Tue Apr 17 17:40:38 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ipsec.c,v 1.153 2018/04/03 09:03:59 maxv Exp $ */
+/* $NetBSD: ipsec.c,v 1.154 2018/04/17 17:40:38 maxv Exp $ */
 /* $FreeBSD: src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $ */
 /* $KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $ */
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.153 2018/04/03 09:03:59 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.154 2018/04/17 17:40:38 maxv Exp $");
 
 /*
  * IPsec controller part.
@@ -548,9 +548,11 @@ ipsec_getpolicybyaddr(struct mbuf *m, u_
 	if (key_havesp(dir)) {
 		sp = KEY_LOOKUP_SP_BYSPIDX(, dir);
 	}
-
-	if (sp == NULL)			/* no SP found, use system default */
+	if (sp == NULL) {
+		/* no SP found, use system default */
 		sp = KEY_GET_DEFAULT_SP(spidx.dst.sa.sa_family);
+	}
+
 	KASSERT(sp != NULL);
 	return sp;
 }
@@ -726,15 +728,18 @@ ipsec4_input(struct mbuf *m, int flags)
 	return 0;
 }
 
+/*
+ * If the packet is routed over IPsec tunnel, tell the originator the
+ * tunnel MTU.
+ * tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz
+ *
+ * XXX: Quick hack!!!
+ *
+ * XXX: And what if the MTU goes negative?
+ */
 int
 ipsec4_forward(struct mbuf *m, int *destmtu)
 {
-	/*
-	 * If the packet is routed over IPsec tunnel, tell the
-	 * originator the tunnel MTU.
-	 *	tunnel MTU = if MTU - sizeof(IP) - ESP/AH hdrsiz
-	 * XXX quickhack!!!
-	 */
 	struct secpolicy *sp;
 	size_t ipsechdr;
 	int error;
@@ -819,7 +824,9 @@ ipsec_setspidx(struct mbuf *m, struct se
 	/*
 	 * validate m->m_pkthdr.len.  we see incorrect length if we
 	 * mistakenly call this function with inconsistent mbuf chain
-	 * (like 4.4BSD tcp/udp processing).  XXX should we panic here?
+	 * (like 4.4BSD tcp/udp processing).
+	 *
+	 * XXX XXX XXX: We should remove this.
 	 */
 	len = 0;
 	for (n = m; n; n = n->m_next)
@@ -1057,9 +1064,9 @@ ipsec6_setspidx_ipaddr(struct mbuf *m, s
 	struct ip6_hdr ip6buf;
 	struct sockaddr_in6 *sin6;
 
-	if (m->m_len >= sizeof(*ip6))
+	if (m->m_len >= sizeof(*ip6)) {
 		ip6 = mtod(m, struct ip6_hdr *);
-	else {
+	} else {
 		m_copydata(m, 0, sizeof(ip6buf), );
 		ip6 = 
 	}
@@ -1132,9 +1139,9 @@ static void
 ipsec_destroy_policy(struct secpolicy *sp)
 {
 
-	if (sp == _dummy_sp)
+	if (sp == _dummy_sp) {
 		; /* It's dummy. No need to free it. */
-	else {
+	} else {
 		/*
 		 * We cannot destroy here because it can be called in
 		 * softint. So mark the SP as DEAD and let the timer
@@ -1337,7 +1344,7 @@ ipsec_get_reqlevel(const struct ipsecreq
 		ah_trans_deflev = IPSEC_CHECK_DEFAULT(ip6_ah_trans_deflev);
 		ah_net_deflev = IPSEC_CHECK_DEFAULT(ip6_ah_net_deflev);
 		break;
-#endif /* INET6 */
+#endif
 	default:
 		panic("%s: unknown af %u", __func__,
 		isr->sp->spidx.src.sa.sa_family);
@@ -1777,11 +1784,9 @@ const char *
 ipsec_address(const union sockaddr_union *sa, char *buf, size_t size)
 {
 	switch (sa->sa.sa_family) {
-#if INET
 	case AF_INET:
 		in_print(buf, size, >sin.sin_addr);
 		return buf;
-#endif
 #if INET6
 	case AF_INET6:
 		in6_print(buf, size, >sin6.sin6_addr);



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 17:40:38 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c

Log Message:
Style, add XXX (about the mtu that goes negative), and remove #ifdef inet.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/netipsec/ipsec.c

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



CVS commit: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 16:03:37 UTC 2018

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

Log Message:
Ticket #773


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.185 src/doc/CHANGES-8.0:1.1.2.186
--- src/doc/CHANGES-8.0:1.1.2.185	Tue Apr 17 08:37:22 2018
+++ src/doc/CHANGES-8.0	Tue Apr 17 16:03:36 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.185 2018/04/17 08:37:22 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.186 2018/04/17 16:03:36 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -13013,3 +13013,10 @@ sys/miscfs/procfs/procfs_subr.c			1.112
 	of VOP_REVOKE().
 	[hannken, ticket #772]
 
+sys/netipsec/ipsec_mbuf.c			1.23,1.24
+
+	Don't assume M_PKTHDR is set only on the first mbuf of the chain.
+	Fix a pretty bad mistake (IPsec DoS).
+	[maxv, ticket #773]
+
+



CVS commit: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 16:03:37 UTC 2018

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

Log Message:
Ticket #773


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

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



Re: CVS commit: src/sys/sys

2018-04-17 Thread Kamil Rytarowski
On 04.03.2018 08:13, Michael van Elst wrote:
> Module Name:  src
> Committed By: mlelstv
> Date: Sun Mar  4 07:13:11 UTC 2018
> 
> Modified Files:
>   src/sys/sys: device.h
> 
> Log Message:
> Expose device structures to _KMEMUSER
> 
> 

This broke building device.h with _KMEMUSER.

> @@ -81,7 +81,7 @@
>  #include 
>  #include 
>  
> -#ifdef _KERNEL
> +#if defined(_KERNEL) || defined(_KMEMUSER)
>  #include 
>  #include 
>  #include 

The sys/pmf.h header is not accessible from userland.



signature.asc
Description: OpenPGP digital signature


CVS commit: [netbsd-7-0] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:40:11 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.101 -r1.1.2.102 src/doc/CHANGES-7.0.3

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-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.101 src/doc/CHANGES-7.0.3:1.1.2.102
--- src/doc/CHANGES-7.0.3:1.1.2.101	Tue Apr 17 08:30:43 2018
+++ src/doc/CHANGES-7.0.3	Tue Apr 17 15:40:11 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.101 2018/04/17 08:30:43 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.102 2018/04/17 15:40:11 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5407,3 +5407,9 @@ sys/kern/uipc_mbuf.c1.190
 	in place.
 	[maxv, ticket #1598]
 
+sys/netipsec/ipsec_mbuf.c			1.23,1.24 (patch)
+
+	Don't assume M_PKTHDR is set only on the first mbuf of the chain.
+	Fix a pretty bad mistake (IPsec DoS).
+	[maxv, ticket #1599]
+



CVS commit: [netbsd-7-0] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:40:11 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.101 -r1.1.2.102 src/doc/CHANGES-7.0.3

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



CVS commit: [netbsd-7-0] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:57 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-0]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.34.1 src/sys/netipsec/ipsec_mbuf.c

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



CVS commit: [netbsd-7-0] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:57 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-0]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.34.1 src/sys/netipsec/ipsec_mbuf.c

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

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.12 src/sys/netipsec/ipsec_mbuf.c:1.12.34.1
--- src/sys/netipsec/ipsec_mbuf.c:1.12	Mon May 16 10:05:23 2011
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 15:38:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.12.34.1 2018/04/17 15:38:57 martin Exp $	*/
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12.34.1 2018/04/17 15:38:57 martin Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -407,10 +407,11 @@ m_striphdr(struct mbuf *m, int skip, int
 		/* The header was at the beginning of the mbuf */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
 		m_adj(m1, hlen);
-		if ((m1->m_flags & M_PKTHDR) == 0)
+		if (m1 != m)
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -419,11 +420,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -431,9 +434,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
-		if ((m1->m_flags & M_PKTHDR) == 0)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
+		if (m1 != m)
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



CVS commit: [netbsd-7-1] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:39 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/doc/CHANGES-7.1.3

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-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.8 src/doc/CHANGES-7.1.3:1.1.2.9
--- src/doc/CHANGES-7.1.3:1.1.2.8	Tue Apr 17 08:29:23 2018
+++ src/doc/CHANGES-7.1.3	Tue Apr 17 15:38:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.8 2018/04/17 08:29:23 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.9 2018/04/17 15:38:39 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -99,3 +99,9 @@ sys/kern/uipc_mbuf.c1.190
 	in place.
 	[maxv, ticket #1598]
 
+sys/netipsec/ipsec_mbuf.c			1.23,1.24 (patch)
+
+	Don't assume M_PKTHDR is set only on the first mbuf of the chain.
+	Fix a pretty bad mistake (IPsec DoS).
+	[maxv, ticket #1599]
+



CVS commit: [netbsd-7-1] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:39 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.8 -r1.1.2.9 src/doc/CHANGES-7.1.3

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



CVS commit: [netbsd-7-1] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:12 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-1]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.42.1 src/sys/netipsec/ipsec_mbuf.c

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



CVS commit: [netbsd-7-1] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:38:12 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7-1]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.42.1 src/sys/netipsec/ipsec_mbuf.c

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

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.12 src/sys/netipsec/ipsec_mbuf.c:1.12.42.1
--- src/sys/netipsec/ipsec_mbuf.c:1.12	Mon May 16 10:05:23 2011
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 15:38:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.12.42.1 2018/04/17 15:38:12 martin Exp $	*/
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12.42.1 2018/04/17 15:38:12 martin Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -407,10 +407,11 @@ m_striphdr(struct mbuf *m, int skip, int
 		/* The header was at the beginning of the mbuf */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
 		m_adj(m1, hlen);
-		if ((m1->m_flags & M_PKTHDR) == 0)
+		if (m1 != m)
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -419,11 +420,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -431,9 +434,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
-		if ((m1->m_flags & M_PKTHDR) == 0)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
+		if (m1 != m)
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



CVS commit: [netbsd-7] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:36:37 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.85 -r1.1.2.86 src/doc/CHANGES-7.2

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



CVS commit: [netbsd-7] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:36:37 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Ticket #1599


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.85 -r1.1.2.86 src/doc/CHANGES-7.2

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-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.85 src/doc/CHANGES-7.2:1.1.2.86
--- src/doc/CHANGES-7.2:1.1.2.85	Tue Apr 17 08:27:46 2018
+++ src/doc/CHANGES-7.2	Tue Apr 17 15:36:37 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.85 2018/04/17 08:27:46 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.86 2018/04/17 15:36:37 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5439,3 +5439,9 @@ sys/kern/uipc_mbuf.c1.190
 	in place.
 	[maxv, ticket #1598]
 
+sys/netipsec/ipsec_mbuf.c			1.23,1.24 (patch)
+
+	Don't assume M_PKTHDR is set only on the first mbuf of the chain.
+	Fix a pretty bad mistake (IPsec DoS).
+	[maxv, ticket #1599]
+



CVS commit: src/sbin/nvmectl

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 15:31:00 UTC 2018

Modified Files:
src/sbin/nvmectl: nvmectl.h

Log Message:
nvmectl(8): fix wdc command usage.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/nvmectl/nvmectl.h

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

Modified files:

Index: src/sbin/nvmectl/nvmectl.h
diff -u src/sbin/nvmectl/nvmectl.h:1.6 src/sbin/nvmectl/nvmectl.h:1.7
--- src/sbin/nvmectl/nvmectl.h:1.6	Tue Apr 17 08:54:35 2018
+++ src/sbin/nvmectl/nvmectl.h	Tue Apr 17 15:31:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmectl.h,v 1.6 2018/04/17 08:54:35 nonaka Exp $	*/
+/*	$NetBSD: nvmectl.h,v 1.7 2018/04/17 15:31:00 nonaka Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -81,7 +81,7 @@ struct nvme_function {
 "power [-l] [-p new-state [-w workload-hint]] \n"
 
 #define WDC_USAGE			   \
-"wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n"
+"wdc cap-diag [-o path-templete]\n"
 
 void devlist(int, char *[]) __dead;
 void identify(int, char *[]) __dead;



CVS commit: src/sbin/nvmectl

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 15:31:00 UTC 2018

Modified Files:
src/sbin/nvmectl: nvmectl.h

Log Message:
nvmectl(8): fix wdc command usage.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sbin/nvmectl/nvmectl.h

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



CVS commit: [netbsd-7] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:10:53 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.30.1 src/sys/netipsec/ipsec_mbuf.c

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



CVS commit: [netbsd-7] src/sys/netipsec

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:10:53 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-7]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24 (via patch)

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.30.1 src/sys/netipsec/ipsec_mbuf.c

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

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.12 src/sys/netipsec/ipsec_mbuf.c:1.12.30.1
--- src/sys/netipsec/ipsec_mbuf.c:1.12	Mon May 16 10:05:23 2011
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 15:10:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.12.30.1 2018/04/17 15:10:53 martin Exp $	*/
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12 2011/05/16 10:05:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.12.30.1 2018/04/17 15:10:53 martin Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -407,10 +407,11 @@ m_striphdr(struct mbuf *m, int skip, int
 		/* The header was at the beginning of the mbuf */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
 		m_adj(m1, hlen);
-		if ((m1->m_flags & M_PKTHDR) == 0)
+		if (m1 != m)
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -419,11 +420,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -431,9 +434,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
-		if ((m1->m_flags & M_PKTHDR) == 0)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
+		if (m1 != m)
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:06:20 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/netipsec/ipsec_mbuf.c

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

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.16 src/sys/netipsec/ipsec_mbuf.c:1.16.2.1
--- src/sys/netipsec/ipsec_mbuf.c:1.16	Fri May 19 04:34:09 2017
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 15:06:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.16 2017/05/19 04:34:09 ozaki-r Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.16.2.1 2018/04/17 15:06:20 martin Exp $	*/
 /*-
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
  * All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.16 2017/05/19 04:34:09 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.16.2.1 2018/04/17 15:06:20 martin Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -403,10 +403,11 @@ m_striphdr(struct mbuf *m, int skip, int
 		/* The header was at the beginning of the mbuf */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_FRONT);
 		m_adj(m1, hlen);
-		if ((m1->m_flags & M_PKTHDR) == 0)
+		if (m1 != m)
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -415,11 +416,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -427,9 +430,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
-		if ((m1->m_flags & M_PKTHDR) == 0)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
+		if (m1 != m)
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 15:06:20 UTC 2018

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec_mbuf.c

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

sys/netipsec/ipsec_mbuf.c: revision 1.23,1.24

Don't assume M_PKTHDR is set only on the first mbuf of the chain. It
should, but it looks like there are several places that can put M_PKTHDR
on secondary mbufs (PR/53189), so drop this assumption right now to
prevent further bugs.

The check is replaced by (m1 != m), which is equivalent to the previous
code: we want to modify m->m_pkthdr.len only when 'm' was not passed in
m_adj().

Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/netipsec/ipsec_mbuf.c

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



CVS commit: src/crypto/external/bsd/openssl/dist/crypto/rsa

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 17 14:48:49 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/rsa: rsa_gen.c

Log Message:
CVE-2018-0737: Set constant time for rsa computation:
https://www.openssl.org/news/vulnerabilities.html
This needs to be pulled up to -8 using:

https://github.com/openssl/openssl/commit/349a41da1ad88ad87825414752a8ff5fdd6a6c3f


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c

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

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c:1.1.1.8 src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c:1.2
--- src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c:1.1.1.8	Fri Apr  6 18:49:16 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.c	Tue Apr 17 10:48:48 2018
@@ -89,6 +89,8 @@ static int rsa_builtin_keygen(RSA *rsa, 
 if (BN_copy(rsa->e, e_value) == NULL)
 goto err;
 
+BN_set_flags(rsa->p, BN_FLG_CONSTTIME);
+BN_set_flags(rsa->q, BN_FLG_CONSTTIME);
 BN_set_flags(r2, BN_FLG_CONSTTIME);
 /* generate p and q */
 for (;;) {



CVS commit: src/crypto/external/bsd/openssl/dist/crypto/rsa

2018-04-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 17 14:48:49 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto/rsa: rsa_gen.c

Log Message:
CVE-2018-0737: Set constant time for rsa computation:
https://www.openssl.org/news/vulnerabilities.html
This needs to be pulled up to -8 using:

https://github.com/openssl/openssl/commit/349a41da1ad88ad87825414752a8ff5fdd6a6c3f


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/crypto/external/bsd/openssl/dist/crypto/rsa/rsa_gen.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/file/dist/src

2018-04-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Apr 17 12:34:04 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.c

Log Message:
sprinkle #ifdef __dead \n __dead \n #endif for clang


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/file/dist/src/file.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/file/dist/src/file.c
diff -u src/external/bsd/file/dist/src/file.c:1.9 src/external/bsd/file/dist/src/file.c:1.10
--- src/external/bsd/file/dist/src/file.c:1.9	Sun Apr 15 19:45:32 2018
+++ src/external/bsd/file/dist/src/file.c	Tue Apr 17 12:34:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.9 2018/04/15 19:45:32 christos Exp $	*/
+/*	$NetBSD: file.c,v 1.10 2018/04/17 12:34:04 jakllsch Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: file.c,v 1.175 2018/03/02 16:11:37 christos Exp $")
 #else
-__RCSID("$NetBSD: file.c,v 1.9 2018/04/15 19:45:32 christos Exp $");
+__RCSID("$NetBSD: file.c,v 1.10 2018/04/17 12:34:04 jakllsch Exp $");
 #endif
 #endif	/* lint */
 
@@ -677,6 +677,9 @@ file_getprogname(void)
 	return file_progname;
 }
 
+#ifdef __dead
+__dead
+#endif
 protected void
 file_err(int e, const char *fmt, ...)
 {
@@ -691,6 +694,9 @@ file_err(int e, const char *fmt, ...)
 	exit(e);
 }
 
+#ifdef __dead
+__dead
+#endif
 protected void
 file_errx(int e, const char *fmt, ...)
 {



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

2018-04-17 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Apr 17 12:34:04 UTC 2018

Modified Files:
src/external/bsd/file/dist/src: file.c

Log Message:
sprinkle #ifdef __dead \n __dead \n #endif for clang


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/file/dist/src/file.c

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



CVS commit: src/tools

2018-04-17 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 17 10:08:54 UTC 2018

Modified Files:
src/tools: Makefile.gnuhost

Log Message:
Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.

Tested by thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/tools/Makefile.gnuhost

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

Modified files:

Index: src/tools/Makefile.gnuhost
diff -u src/tools/Makefile.gnuhost:1.47 src/tools/Makefile.gnuhost:1.48
--- src/tools/Makefile.gnuhost:1.47	Tue Apr 17 02:03:56 2018
+++ src/tools/Makefile.gnuhost	Tue Apr 17 10:08:54 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.gnuhost,v 1.47 2018/04/17 02:03:56 christos Exp $
+#	$NetBSD: Makefile.gnuhost,v 1.48 2018/04/17 10:08:54 maya Exp $
 #
 # Rules used when building a GNU host package.  Expects MODULE to be set.
 #
@@ -23,13 +23,6 @@ BUILD_OSTYPE!= uname -s
 HOST_CFLAGS+=-O2 -no-cpp-precomp
 .endif
 
-# GCC build exceeds the clang default bracket nesting level of 256.
-HOST_COMPILER_CLANG != if echo __clang__ | ${HOST_CC} -E - | grep -q clang; then echo no; else echo yes; fi
-.if ${HOST_COMPILER_CLANG} == "yes"
-HOST_CFLAGS+= -fbracket-depth=512
-HOST_CXXFLAGS+= -fbracket-depth=512
-.endif
-
 MAKE_PROGRAM?=	${MAKE}
 
 .for i in 3 2



CVS commit: src/tools

2018-04-17 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 17 10:08:54 UTC 2018

Modified Files:
src/tools: Makefile.gnuhost

Log Message:
Remove hack previously needed to build gcc/arm with clang.
genattrtab.c:1.2 makes this unnecessary.

Tested by thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/tools/Makefile.gnuhost

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



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

2018-04-17 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 17 10:02:49 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/gcc: genattrtab.c

Log Message:
Apply upstream commit:

From: ppalka 
Date: Wed, 27 Apr 2016 21:18:05 +
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
 genattrtab

gcc/ChangeLog:

* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true.  Emit an outer pair of parentheses only if
EMIT_PARENS.  When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536

gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.

Fixes PR toolchain/53178 properly.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/gpl3/gcc/dist/gcc/genattrtab.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/genattrtab.c
diff -u src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.1.1.4 src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.2
--- src/external/gpl3/gcc/dist/gcc/genattrtab.c:1.1.1.4	Fri Feb  2 01:59:20 2018
+++ src/external/gpl3/gcc/dist/gcc/genattrtab.c	Tue Apr 17 10:02:49 2018
@@ -3416,7 +3416,10 @@ find_attrs_to_cache (rtx exp, bool creat
 
 /* Given a piece of RTX, print a C expression to test its truth value to OUTF.
We use AND and IOR both for logical and bit-wise operations, so
-   interpret them as logical unless they are inside a comparison expression.  */
+   interpret them as logical unless they are inside a comparison expression.
+
+   An outermost pair of parentheses is emitted around this C expression unless
+   EMIT_PARENS is false.  */
 
 /* Interpret AND/IOR as bit-wise operations instead of logical.  */
 #define FLG_BITWISE		1
@@ -3432,16 +3435,16 @@ find_attrs_to_cache (rtx exp, bool creat
 #define FLG_OUTSIDE_AND		8
 
 static unsigned int
-write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags)
+write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags,
+		 bool emit_parens = true)
 {
   int comparison_operator = 0;
   RTX_CODE code;
   struct attr_desc *attr;
 
-  /* In order not to worry about operator precedence, surround our part of
- the expression with parentheses.  */
+  if (emit_parens)
+fprintf (outf, "(");
 
-  fprintf (outf, "(");
   code = GET_CODE (exp);
   switch (code)
 {
@@ -3575,8 +3578,18 @@ write_test_expr (FILE *outf, rtx exp, un
 	  || GET_CODE (XEXP (exp, 1)) == EQ_ATTR
 	  || (GET_CODE (XEXP (exp, 1)) == NOT
 		  && GET_CODE (XEXP (XEXP (exp, 1), 0)) == EQ_ATTR)))
-	attrs_cached
-	  = write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags);
+	{
+	  bool need_parens = true;
+
+	  /* No need to emit parentheses around the right-hand operand if we are
+	 continuing a chain of && or || (or & or |).  */
+	  if (GET_CODE (XEXP (exp, 1)) == code)
+	need_parens = false;
+
+	  attrs_cached
+	= write_test_expr (outf, XEXP (exp, 1), attrs_cached, flags,
+			   need_parens);
+	}
   else
 	write_test_expr (outf, XEXP (exp, 1), attrs_cached,
 			 flags | comparison_operator);
@@ -3794,7 +3807,9 @@ write_test_expr (FILE *outf, rtx exp, un
 	 GET_RTX_NAME (code));
 }
 
-  fprintf (outf, ")");
+  if (emit_parens)
+fprintf (outf, ")");
+
   return attrs_cached;
 }
 



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

2018-04-17 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Apr 17 10:02:49 UTC 2018

Modified Files:
src/external/gpl3/gcc/dist/gcc: genattrtab.c

Log Message:
Apply upstream commit:

From: ppalka 
Date: Wed, 27 Apr 2016 21:18:05 +
Subject: [PATCH] Reduce nesting of parentheses in conditionals generated by
 genattrtab

gcc/ChangeLog:

* genattrtab.c (write_test_expr): New parameter EMIT_PARENS
which defaults to true.  Emit an outer pair of parentheses only if
EMIT_PARENS.  When continuing a chain of && or || (or & or |),
don't emit parentheses for the right-hand operand.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235536

gcc/arm generates so many parens it hits a bracket depth limited which is
enforced by clang. This reduces the number of parens generated and avoids the
need to increase bracket depth.

Fixes PR toolchain/53178 properly.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/gpl3/gcc/dist/gcc/genattrtab.c

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



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 09:06:33 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_mbuf.c

Log Message:
Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


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

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



CVS commit: src/sys/netipsec

2018-04-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Apr 17 09:06:33 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_mbuf.c

Log Message:
Fix a pretty bad mistake, that has always been there.

m_adj(m1, -(m1->m_len - roff));
if (m1 != m)
m->m_pkthdr.len -= (m1->m_len - roff);

This is wrong: m_adj will modify m1->m_len, so we're using a wrong value
when manually adjusting m->m_pkthdr.len.

Because of that, it is possible to exploit the attack I described in
uipc_mbuf.c::rev1.182. The exploit is more complicated, but works 100%
reliably.


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

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

Modified files:

Index: src/sys/netipsec/ipsec_mbuf.c
diff -u src/sys/netipsec/ipsec_mbuf.c:1.23 src/sys/netipsec/ipsec_mbuf.c:1.24
--- src/sys/netipsec/ipsec_mbuf.c:1.23	Tue Apr 17 06:23:30 2018
+++ src/sys/netipsec/ipsec_mbuf.c	Tue Apr 17 09:06:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_mbuf.c,v 1.23 2018/04/17 06:23:30 maxv Exp $	*/
+/*	$NetBSD: ipsec_mbuf.c,v 1.24 2018/04/17 09:06:33 maxv Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.23 2018/04/17 06:23:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_mbuf.c,v 1.24 2018/04/17 09:06:33 maxv Exp $");
 
 /*
  * IPsec-specific mbuf routines.
@@ -404,6 +404,7 @@ m_striphdr(struct mbuf *m, int skip, int
 			m->m_pkthdr.len -= hlen;
 	} else if (roff + hlen >= m1->m_len) {
 		struct mbuf *mo;
+		int adjlen;
 
 		/*
 		 * Part or all of the header is at the end of this mbuf,
@@ -412,11 +413,13 @@ m_striphdr(struct mbuf *m, int skip, int
 		 */
 		IPSEC_STATINC(IPSEC_STAT_INPUT_END);
 		if (roff + hlen > m1->m_len) {
+			adjlen = roff + hlen - m1->m_len;
+
 			/* Adjust the next mbuf by the remainder */
-			m_adj(m1->m_next, roff + hlen - m1->m_len);
+			m_adj(m1->m_next, adjlen);
 
 			/* The second mbuf is guaranteed not to have a pkthdr... */
-			m->m_pkthdr.len -= (roff + hlen - m1->m_len);
+			m->m_pkthdr.len -= adjlen;
 		}
 
 		/* Now, let's unlink the mbuf chain for a second...*/
@@ -424,9 +427,10 @@ m_striphdr(struct mbuf *m, int skip, int
 		m1->m_next = NULL;
 
 		/* ...and trim the end of the first part of the chain...sick */
-		m_adj(m1, -(m1->m_len - roff));
+		adjlen = m1->m_len - roff;
+		m_adj(m1, -adjlen);
 		if (m1 != m)
-			m->m_pkthdr.len -= (m1->m_len - roff);
+			m->m_pkthdr.len -= adjlen;
 
 		/* Finally, let's relink */
 		m1->m_next = mo;



CVS commit: src

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:54:35 UTC 2018

Modified Files:
src/sbin/nvmectl: Makefile devlist.c firmware.c identify.c logpage.c
nvmectl.c nvmectl.h perftest.c reset.c wdc.c
src/sys/dev/ic: nvmereg.h
Added Files:
src/sbin/nvmectl: util.c

Log Message:
nvmectl(8): Sync with FreeBSD nvmecontrol(8) r328763.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/nvmectl/Makefile src/sbin/nvmectl/devlist.c \
src/sbin/nvmectl/identify.c src/sbin/nvmectl/perftest.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/firmware.c src/sbin/nvmectl/reset.c \
src/sbin/nvmectl/wdc.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/nvmectl/logpage.c \
src/sbin/nvmectl/nvmectl.c src/sbin/nvmectl/nvmectl.h
cvs rdiff -u -r0 -r1.1 src/sbin/nvmectl/util.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/nvmereg.h

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

Modified files:

Index: src/sbin/nvmectl/Makefile
diff -u src/sbin/nvmectl/Makefile:1.3 src/sbin/nvmectl/Makefile:1.4
--- src/sbin/nvmectl/Makefile:1.3	Sat Apr 29 00:06:40 2017
+++ src/sbin/nvmectl/Makefile	Tue Apr 17 08:54:35 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2017/04/29 00:06:40 nonaka Exp $
+#	$NetBSD: Makefile,v 1.4 2018/04/17 08:54:35 nonaka Exp $
 
 .include 
 
@@ -11,6 +11,7 @@ SRCS+=	logpage.c
 SRCS+=	perftest.c
 SRCS+=	power.c
 SRCS+=	reset.c
+SRCS+=	util.c
 SRCS+=	wdc.c
 SRCS+=	bignum.c
 SRCS+=	humanize_bignum.c
Index: src/sbin/nvmectl/devlist.c
diff -u src/sbin/nvmectl/devlist.c:1.3 src/sbin/nvmectl/devlist.c:1.4
--- src/sbin/nvmectl/devlist.c:1.3	Sat Mar 17 11:07:26 2018
+++ src/sbin/nvmectl/devlist.c	Tue Apr 17 08:54:35 2018
@@ -1,6 +1,8 @@
-/*	$NetBSD: devlist.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
+/*	$NetBSD: devlist.c,v 1.4 2018/04/17 08:54:35 nonaka Exp $	*/
 
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
@@ -28,9 +30,9 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: devlist.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
+__RCSID("$NetBSD: devlist.c,v 1.4 2018/04/17 08:54:35 nonaka Exp $");
 #if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 260381 2014-01-06 23:48:47Z jimharris $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/devlist.c 326276 2017-11-27 15:37:16Z pfg $");
 #endif
 #endif
 
Index: src/sbin/nvmectl/identify.c
diff -u src/sbin/nvmectl/identify.c:1.3 src/sbin/nvmectl/identify.c:1.4
--- src/sbin/nvmectl/identify.c:1.3	Sat Mar 17 11:07:26 2018
+++ src/sbin/nvmectl/identify.c	Tue Apr 17 08:54:35 2018
@@ -1,6 +1,8 @@
-/*	$NetBSD: identify.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
+/*	$NetBSD: identify.c,v 1.4 2018/04/17 08:54:35 nonaka Exp $	*/
 
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (C) 2012-2013 Intel Corporation
  * All rights reserved.
  *
@@ -28,9 +30,9 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: identify.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $");
+__RCSID("$NetBSD: identify.c,v 1.4 2018/04/17 08:54:35 nonaka Exp $");
 #if 0
-__FBSDID("$FreeBSD: head/sbin/nvmecontrol/identify.c 253476 2013-07-19 21:40:57Z jimharris $");
+__FBSDID("$FreeBSD: head/sbin/nvmecontrol/identify.c 326276 2017-11-27 15:37:16Z pfg $");
 #endif
 #endif
 
@@ -72,6 +74,7 @@ print_controller(struct nvm_identify_con
 		printf("Unlimited\n");
 	else
 		printf("%ld\n", sysconf(_SC_PAGESIZE) * (1 << cdata->mdts));
+	printf("Controller ID:  0x%02x\n", cdata->cntlid);
 	printf("\n");
 
 	printf("Admin Command Set Attributes\n");
@@ -85,6 +88,9 @@ print_controller(struct nvm_identify_con
 	printf("Firmware Activate/Download:  %s\n",
 		(cdata->oacs & NVME_ID_CTRLR_OACS_FW) ?
 		"Supported" : "Not Supported");
+	printf("Namespace Managment: %s\n",
+		(cdata->oacs & NVME_ID_CTRLR_OACS_NS) ?
+		"Supported" : "Not Supported");
 	printf("Abort Command Limit: %d\n", cdata->acl+1);
 	printf("Async Event Request Limit:   %d\n", cdata->aerl+1);
 	printf("Number of Firmware Slots:");
@@ -139,6 +145,16 @@ print_controller(struct nvm_identify_con
 	printf("Volatile Write Cache:%s\n",
 		(cdata->vwc & NVME_ID_CTRLR_VWC_PRESENT) ?
 		"Present" : "Not Present");
+
+	if (cdata->oacs & NVME_ID_CTRLR_OACS_NS) {
+		printf("\n");
+		printf("Namespace Drive Attributes\n");
+		printf("==\n");
+		print_bignum("NVM total cap:   ",
+		cdata->untncap.tnvmcap, "");
+		print_bignum("NVM unallocated cap: ",
+		cdata->untncap.unvmcap, "");
+	}
 }
 
 static void
Index: src/sbin/nvmectl/perftest.c
diff -u src/sbin/nvmectl/perftest.c:1.3 src/sbin/nvmectl/perftest.c:1.4
--- src/sbin/nvmectl/perftest.c:1.3	Sat Mar 17 11:07:26 2018
+++ src/sbin/nvmectl/perftest.c	Tue Apr 17 08:54:35 2018
@@ -1,6 +1,8 @@
-/*	$NetBSD: perftest.c,v 1.3 2018/03/17 11:07:26 jdolecek Exp $	*/
+/*	$NetBSD: perftest.c,v 1.4 2018/04/17 08:54:35 

CVS commit: src

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:54:35 UTC 2018

Modified Files:
src/sbin/nvmectl: Makefile devlist.c firmware.c identify.c logpage.c
nvmectl.c nvmectl.h perftest.c reset.c wdc.c
src/sys/dev/ic: nvmereg.h
Added Files:
src/sbin/nvmectl: util.c

Log Message:
nvmectl(8): Sync with FreeBSD nvmecontrol(8) r328763.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/nvmectl/Makefile src/sbin/nvmectl/devlist.c \
src/sbin/nvmectl/identify.c src/sbin/nvmectl/perftest.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/nvmectl/firmware.c src/sbin/nvmectl/reset.c \
src/sbin/nvmectl/wdc.c
cvs rdiff -u -r1.5 -r1.6 src/sbin/nvmectl/logpage.c \
src/sbin/nvmectl/nvmectl.c src/sbin/nvmectl/nvmectl.h
cvs rdiff -u -r0 -r1.1 src/sbin/nvmectl/util.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/nvmereg.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

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:44 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1319 -r1.1320 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:44 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1320 -r1.1321 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1319 -r1.1320 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1329 src/sys/dev/pci/pcidevs:1.1330
--- src/sys/dev/pci/pcidevs:1.1329	Mon Apr 16 13:11:53 2018
+++ src/sys/dev/pci/pcidevs	Tue Apr 17 08:47:19 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1329 2018/04/16 13:11:53 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1330 2018/04/17 08:47:19 nonaka Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -645,6 +645,8 @@ vendor MARVELL2		0x1b4b	Marvell
 vendor FRESCO		0x1b73	Fresco Logic
 vendor QINHENG2		0x1c00	Nanjing QinHeng Electronics (PCIe)
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
+vendor HGST		0x1c58	HGST, Inc.
+vendor BEIJING_MEMBLAZE	0x1c5f	Beijing Memblaze Technology Co. Ltd.
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
 vendor HINT		0x3388	HiNT
@@ -1742,6 +1744,9 @@ product BBELEC ISOLATED_2_PORT		0x4212	d
 product BBELEC ISOLATED_4_PORT		0x4214	quad-channel Isolated RS-485 PCI UART
 product BBELEC ISOLATED_8_PORT		0x4218	octal-channel Isolated RS-485 PCI UART
 
+/* Beijing Memblaze Technology Co. Ltd. products */
+product BEIJING_MEMBLAZE PBLAZE4	0x0540	PBlaze4 NVMe SSD
+
 /* Belkin products */
 product BELKIN F5D6001		0x6001	F5D6001
 product BELKIN F5D6020V3	0x6020	F5D6020v3 802.11b
@@ -2631,6 +2636,10 @@ product HP ILO3_SLAVE		0x3306	iLO3 Slave
 product HP ILO3_MGMT		0x3307	iLO3 Management
 product HP RS780_PPB_GFX	0x9602  (AMD) RS780 PCI-PCI Bridge (int gfx)
 
+/* HGST Inc. products */
+product HGST SN100	0x0003	Ultrastar SN100 Series NVMe SSD
+product HGST SN200	0x0023	Ultrastar SN200 Series NVMe SSD
+
 /* Hifn products */
 product HIFN 7751	0x0005	7751
 product HIFN 6500	0x0006	6500
@@ -6616,6 +6625,8 @@ product SAFENET SAFEXCEL	0x1141 SafeXcel
 product SAMSUNGELEC3	XP941		0xa800	XP941 M.2 SSD
 product SAMSUNGELEC3	SM951		0xa801	SM951 M.2 SSD
 product SAMSUNGELEC3	SM951_NVME	0xa802	SM951 M.2 NVMe SSD
+product SAMSUNGELEC3	172X		0xa821	NVMe SSD Controller 172X
+product SAMSUNGELEC3	172XAB		0xa822	NVMe SSD Controller 172Xa/172Xb
 
 /* Samsung Semiconductor products */
 product SAMSUNGSEMI	KS8920	0x8920	KS8920 10/100 Ethernet



CVS commit: src/sys/dev/pci

2018-04-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Apr 17 08:47:19 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Added some NVMe devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1329 -r1.1330 src/sys/dev/pci/pcidevs

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

2018-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 17 08:38:05 UTC 2018

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

Log Message:
 Remove unused structure entries. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.93 -r1.94 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/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.39 src/sys/dev/pci/ixgbe/ix_txrx.c:1.40
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.39	Wed Apr  4 08:13:07 2018
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.39 2018/04/04 08:13:07 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.40 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
 
@@ -494,8 +494,7 @@ retry:
 		segaddr = htole64(map->dm_segs[j].ds_addr);
 
 		txd->read.buffer_addr = segaddr;
-		txd->read.cmd_type_len = htole32(txr->txd_cmd |
-		cmd_type_len | seglen);
+		txd->read.cmd_type_len = htole32(cmd_type_len | seglen);
 		txd->read.olinfo_status = htole32(olinfo_status);
 
 		if (++i == txr->num_desc)
@@ -2266,8 +2265,6 @@ ixgbe_allocate_queues(struct adapter *ad
 		txr->num_desc = adapter->num_tx_desc;
 
 		/* Initialize the TX side lock */
-		snprintf(txr->mtx_name, sizeof(txr->mtx_name), "%s:tx(%d)",
-		device_xname(dev), txr->me);
 		mutex_init(>tx_mtx, MUTEX_DEFAULT, IPL_NET);
 
 		if (ixgbe_dma_malloc(adapter, tsize, >txdma,
@@ -2318,8 +2315,6 @@ ixgbe_allocate_queues(struct adapter *ad
 		rxr->num_desc = adapter->num_rx_desc;
 
 		/* Initialize the RX side lock */
-		snprintf(rxr->mtx_name, sizeof(rxr->mtx_name), "%s:rx(%d)",
-		device_xname(dev), rxr->me);
 		mutex_init(>rx_mtx, MUTEX_DEFAULT, IPL_NET);
 
 		if (ixgbe_dma_malloc(adapter, rsize, >rxdma,

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.147 src/sys/dev/pci/ixgbe/ixgbe.c:1.148
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.147	Tue Apr 17 05:23:58 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.147 2018/04/17 05:23:58 knakahara Exp $ */
+/* $NetBSD: ixgbe.c,v 1.148 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
 
@@ -6282,7 +6282,6 @@ ixgbe_allocate_msix(struct adapter *adap
 	adapter->osdep.intrs[vector], IPL_NET, ixgbe_msix_link, adapter,
 	intr_xname);
 	if (adapter->osdep.ihs[vector] == NULL) {
-		adapter->res = NULL;
 		aprint_error_dev(dev, "Failed to register LINK handler\n");
 		error = ENXIO;
 		goto err_out;

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.42 src/sys/dev/pci/ixgbe/ixgbe.h:1.43
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.42	Tue Apr 17 05:23:58 2018
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Apr 17 08:38:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.h,v 1.42 2018/04/17 05:23:58 knakahara Exp $ */
+/* $NetBSD: ixgbe.h,v 1.43 2018/04/17 08:38:05 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -322,11 +322,9 @@ struct ixgbe_mc_addr {
 struct ix_queue {
 	struct adapter   *adapter;
 	u32  msix;   /* This queue's MSI-X vector */
-	u32  eims;   /* This queue's EIMS bit */
 	u32  eitr_setting;
 	u32  me;
 	struct resource  *res;
-	void *tag;
 	int  busy;
 	struct tx_ring   *txr;
 	struct rx_ring   *rxr;
@@ -365,9 +363,10 @@ struct tx_ring {
 	u16			next_avail_desc;
 	u16			next_to_clean;
 	u16			num_desc;
-	u32			txd_cmd;
 	ixgbe_dma_tag_t		*txtag;
-	char			mtx_name[16];
+#if 0
+	char			mtx_name[16]; /* NetBSD has no mutex name */
+#endif
 	pcq_t			*txr_interq;
 	struct work		wq_cookie;
 	void			*txr_si;
@@ -415,7 +414,9 @@ struct rx_ring {
 u16 			next_to_check;
 	u16			num_desc;
 	u16			mbuf_sz;
-	char			mtx_name[16];
+#if 0
+	char			mtx_name[16]; /* NetBSD has no mutex name */
+#endif
 	struct ixgbe_rx_buf	*rx_buffers;
 	ixgbe_dma_tag_t		*ptag;
 
@@ -461,17 +462,10 @@ struct adapter {
 	struct resource		*pci_mem;
 	struct resource		*msix_mem;
 
-	/*
-	 * Interrupt resources: this set is
-	 * either used for legacy, or for Link
-	 * when doing MSI-X
-	 */
-	void			*tag;
-	struct resource 	*res;
+	/* NetBSD: Interrupt resources are in osdep */
 
 	struct ifmedia		media;
 	callout_t		timer;
-	int			link_rid;
 	int			if_flags;
 
 	kmutex_t		core_mtx;

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.93 src/sys/dev/pci/ixgbe/ixv.c:1.94
--- src/sys/dev/pci/ixgbe/ixv.c:1.93	Thu Apr 12 08:03:55 2018
+++ 

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

2018-04-17 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 17 08:38:05 UTC 2018

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

Log Message:
 Remove unused structure entries. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.93 -r1.94 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: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:37:23 UTC 2018

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

Log Message:
Tickets #768 - #772


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

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



CVS commit: [netbsd-8] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:37:23 UTC 2018

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

Log Message:
Tickets #768 - #772


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

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.184 src/doc/CHANGES-8.0:1.1.2.185
--- src/doc/CHANGES-8.0:1.1.2.184	Mon Apr 16 14:36:29 2018
+++ src/doc/CHANGES-8.0	Tue Apr 17 08:37:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.184 2018/04/16 14:36:29 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.185 2018/04/17 08:37:22 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -12984,3 +12984,32 @@ sys/arch/x86/pci/if_vmx.c			1.23,1.24
 	bytes interface statistics.
 	[nonaka, ticket #767]
 
+external/gpl2/gmake/dist/glob/glob.c		1.4
+
+	Fix build of gmake (in tools) on new GLIBC systems.
+	[kamil, ticket #768]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.147
+sys/dev/pci/ixgbe/ixgbe.h			1.42
+
+	Fix panic when changing the work queue size while there is traffic.
+	[knakahara, ticket #769]
+
+sys/kern/uipc_mbuf.c1.190
+
+	m_pkthdr_remove(): if the mbuf is shared leave M_PKTHDR
+	in place.
+	[maxv, ticket #770]
+
+sys/kern/subr_pserialize.c			1.11
+
+	Function pserialize_perform() usually succeeds after two cross calls
+	so defer kpause() to iterations three and above.
+	[hannken, ticket #771]
+
+sys/miscfs/procfs/procfs_subr.c			1.112
+
+	Change procfs_revoke_vnodes() to use vrecycle()/vgone() instead
+	of VOP_REVOKE().
+	[hannken, ticket #772]
+



CVS commit: [netbsd-8] src/sys/miscfs/procfs

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:36:11 UTC 2018

Modified Files:
src/sys/miscfs/procfs [netbsd-8]: procfs_subr.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #772):

sys/miscfs/procfs/procfs_subr.c: revision 1.112

Change procfs_revoke_vnodes() to use vrecycle()/vgone() instead
of VOP_REVOKE().

Gets rid of a bunch of suspensions on /proc as vrecycle() will
succeed most time and we suspend at most once per call.


To generate a diff of this commit:
cvs rdiff -u -r1.108.6.1 -r1.108.6.2 src/sys/miscfs/procfs/procfs_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/miscfs/procfs/procfs_subr.c
diff -u src/sys/miscfs/procfs/procfs_subr.c:1.108.6.1 src/sys/miscfs/procfs/procfs_subr.c:1.108.6.2
--- src/sys/miscfs/procfs/procfs_subr.c:1.108.6.1	Thu Apr 12 13:42:48 2018
+++ src/sys/miscfs/procfs/procfs_subr.c	Tue Apr 17 08:36:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_subr.c,v 1.108.6.1 2018/04/12 13:42:48 martin Exp $	*/
+/*	$NetBSD: procfs_subr.c,v 1.108.6.2 2018/04/17 08:36:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -102,13 +102,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.108.6.1 2018/04/12 13:42:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_subr.c,v 1.108.6.2 2018/04/17 08:36:11 martin Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -363,6 +364,8 @@ procfs_revoke_selector(void *arg, struct
 void
 procfs_revoke_vnodes(struct proc *p, void *arg)
 {
+	int error;
+	bool suspended;
 	struct vnode *vp;
 	struct vnode_iterator *marker;
 	struct mount *mp = (struct mount *)arg;
@@ -370,14 +373,29 @@ procfs_revoke_vnodes(struct proc *p, voi
 	if (!(p->p_flag & PK_SUGID))
 		return;
 
+	suspended = false;
 	vfs_vnode_iterator_init(mp, );
 
 	while ((vp = vfs_vnode_iterator_next(marker,
 	procfs_revoke_selector, p)) != NULL) {
-		VOP_REVOKE(vp, REVOKEALL);
-		vrele(vp);
+		if (vrecycle(vp))
+			continue;
+		/* Vnode is busy, we have to suspend the mount for vgone(). */
+		while (! suspended) {
+			error = vfs_suspend(mp, 0);
+			if (error == 0) {
+suspended = true;
+			} else if (error != EINTR && error != ERESTART) {
+KASSERT(error == EOPNOTSUPP);
+break;
+			}
+		}
+		vgone(vp);
 	}
 
+	if (suspended)
+		vfs_resume(mp);
+
 	vfs_vnode_iterator_destroy(marker);
 }
 



CVS commit: [netbsd-8] src/sys/miscfs/procfs

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:36:11 UTC 2018

Modified Files:
src/sys/miscfs/procfs [netbsd-8]: procfs_subr.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #772):

sys/miscfs/procfs/procfs_subr.c: revision 1.112

Change procfs_revoke_vnodes() to use vrecycle()/vgone() instead
of VOP_REVOKE().

Gets rid of a bunch of suspensions on /proc as vrecycle() will
succeed most time and we suspend at most once per call.


To generate a diff of this commit:
cvs rdiff -u -r1.108.6.1 -r1.108.6.2 src/sys/miscfs/procfs/procfs_subr.c

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



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:34:36 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by hannken in ticket #771):

sys/kern/subr_pserialize.c: revision 1.11

Function pserialize_perform() usually succeeds after two cross calls
so defer kpause() to iterations three and above.

Speeds up VOP_REVOKE() on /proc/XXX/status by a factor of ~12.

Ok: core@


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.2 -r1.8.10.3 src/sys/kern/subr_pserialize.c

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



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:34:36 UTC 2018

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

Log Message:
Pull up following revision(s) (requested by hannken in ticket #771):

sys/kern/subr_pserialize.c: revision 1.11

Function pserialize_perform() usually succeeds after two cross calls
so defer kpause() to iterations three and above.

Speeds up VOP_REVOKE() on /proc/XXX/status by a factor of ~12.

Ok: core@


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.2 -r1.8.10.3 src/sys/kern/subr_pserialize.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/subr_pserialize.c
diff -u src/sys/kern/subr_pserialize.c:1.8.10.2 src/sys/kern/subr_pserialize.c:1.8.10.3
--- src/sys/kern/subr_pserialize.c:1.8.10.2	Mon Jan 22 12:30:20 2018
+++ src/sys/kern/subr_pserialize.c	Tue Apr 17 08:34:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $	*/
+/*	$NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.2 2018/01/22 12:30:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.3 2018/04/17 08:34:36 martin Exp $");
 
 #include 
 
@@ -146,6 +146,7 @@ pserialize_destroy(pserialize_t psz)
 void
 pserialize_perform(pserialize_t psz)
 {
+	int n;
 	uint64_t xc;
 
 	KASSERT(!cpu_intr_p());
@@ -176,6 +177,7 @@ pserialize_perform(pserialize_t psz)
 	TAILQ_INSERT_TAIL(_queue0, psz, psz_chain);
 	psz_work_todo++;
 
+	n = 0;
 	do {
 		mutex_spin_exit(_lock);
 
@@ -183,9 +185,10 @@ pserialize_perform(pserialize_t psz)
 		 * Force some context switch activity on every CPU, as
 		 * the system may not be busy.  Pause to not flood.
 		 */
+		if (n++ > 1)
+			kpause("psrlz", false, 1, NULL);
 		xc = xc_broadcast(XC_HIGHPRI, (xcfunc_t)nullop, NULL, NULL);
 		xc_wait(xc);
-		kpause("psrlz", false, 1, NULL);
 
 		mutex_spin_enter(_lock);
 	} while (!kcpuset_iszero(psz->psz_target));



CVS commit: [netbsd-7-0] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:30:43 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.100 -r1.1.2.101 src/doc/CHANGES-7.0.3

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-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.100 src/doc/CHANGES-7.0.3:1.1.2.101
--- src/doc/CHANGES-7.0.3:1.1.2.100	Mon Apr  9 13:32:42 2018
+++ src/doc/CHANGES-7.0.3	Tue Apr 17 08:30:43 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.100 2018/04/09 13:32:42 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.101 2018/04/17 08:30:43 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5401,3 +5401,9 @@ sys/arch/amiga/amiga/cc.c			1.27
 	Fix a spl(9) leak.
 	[msaitoh, ticket #1597]
 
+sys/kern/uipc_mbuf.c1.190
+
+	m_pkthdr_remove(): if the mbuf is shared leave M_PKTHDR
+	in place.
+	[maxv, ticket #1598]
+



CVS commit: [netbsd-7-0] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:30:43 UTC 2018

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.100 -r1.1.2.101 src/doc/CHANGES-7.0.3

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



CVS commit: [netbsd-7-0] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:30:08 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-0]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.1 -r1.158.4.1.2.2 src/sys/kern/uipc_mbuf.c

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



CVS commit: [netbsd-7-0] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:30:08 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-0]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.2.1 -r1.158.4.1.2.2 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.1.2.1 src/sys/kern/uipc_mbuf.c:1.158.4.1.2.2
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.2.1	Thu Apr  5 11:53:02 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:30:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.1 2018/04/05 11:53:02 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.1 2018/04/05 11:53:02 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.2.2 2018/04/17 08:30:08 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,6 +458,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: [netbsd-7-1] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:29:23 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/doc/CHANGES-7.1.3

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-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.7 src/doc/CHANGES-7.1.3:1.1.2.8
--- src/doc/CHANGES-7.1.3:1.1.2.7	Mon Apr  9 13:30:08 2018
+++ src/doc/CHANGES-7.1.3	Tue Apr 17 08:29:23 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.7 2018/04/09 13:30:08 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.8 2018/04/17 08:29:23 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -93,3 +93,9 @@ sys/arch/amiga/amiga/cc.c			1.27
 	Fix a spl(9) leak.
 	[msaitoh, ticket #1597]
 
+sys/kern/uipc_mbuf.c1.190
+
+	m_pkthdr_remove(): if the mbuf is shared leave M_PKTHDR
+	in place.
+	[maxv, ticket #1598]
+



CVS commit: [netbsd-7-1] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:29:23 UTC 2018

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/doc/CHANGES-7.1.3

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



CVS commit: [netbsd-7-1] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:28:55 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-1]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.6.1 -r1.158.4.1.6.2 src/sys/kern/uipc_mbuf.c

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



CVS commit: [netbsd-7-1] src/sys/kern

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:28:55 UTC 2018

Modified Files:
src/sys/kern [netbsd-7-1]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.1.6.1 -r1.158.4.1.6.2 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.1.6.1 src/sys/kern/uipc_mbuf.c:1.158.4.1.6.2
--- src/sys/kern/uipc_mbuf.c:1.158.4.1.6.1	Thu Apr  5 11:50:17 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:28:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.1 2018/04/05 11:50:17 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.2 2018/04/17 08:28:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.1 2018/04/05 11:50:17 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.1.6.2 2018/04/17 08:28:55 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,6 +458,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



CVS commit: [netbsd-7] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:27:46 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.84 -r1.1.2.85 src/doc/CHANGES-7.2

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-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.84 src/doc/CHANGES-7.2:1.1.2.85
--- src/doc/CHANGES-7.2:1.1.2.84	Mon Apr  9 13:28:56 2018
+++ src/doc/CHANGES-7.2	Tue Apr 17 08:27:46 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.84 2018/04/09 13:28:56 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.85 2018/04/17 08:27:46 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5433,3 +5433,9 @@ sys/arch/amiga/amiga/cc.c			1.27
 	Fix a spl(9) leak.
 	[msaitoh, ticket #1597]
 
+sys/kern/uipc_mbuf.c1.190
+
+	m_pkthdr_remove(): if the mbuf is shared leave M_PKTHDR
+	in place.
+	[maxv, ticket #1598]
+



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:27:18 UTC 2018

Modified Files:
src/sys/kern [netbsd-7]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.2 -r1.158.4.3 src/sys/kern/uipc_mbuf.c

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



CVS commit: [netbsd-7] src/doc

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:27:46 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
Ticket #1598


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.84 -r1.1.2.85 src/doc/CHANGES-7.2

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



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:27:18 UTC 2018

Modified Files:
src/sys/kern [netbsd-7]: uipc_mbuf.c

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.158.4.2 -r1.158.4.3 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.158.4.2 src/sys/kern/uipc_mbuf.c:1.158.4.3
--- src/sys/kern/uipc_mbuf.c:1.158.4.2	Thu Apr  5 11:48:13 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:27:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.158.4.2 2018/04/05 11:48:13 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.158.4.3 2018/04/17 08:27:18 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.2 2018/04/05 11:48:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.158.4.3 2018/04/17 08:27:18 martin Exp $");
 
 #include "opt_mbuftrace.h"
 #include "opt_nmbclusters.h"
@@ -458,6 +458,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:24:02 UTC 2018

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

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.2 -r1.172.6.3 src/sys/kern/uipc_mbuf.c

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

Modified files:

Index: src/sys/kern/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172.6.2 src/sys/kern/uipc_mbuf.c:1.172.6.3
--- src/sys/kern/uipc_mbuf.c:1.172.6.2	Thu Apr  5 14:33:41 2018
+++ src/sys/kern/uipc_mbuf.c	Tue Apr 17 08:24:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172.6.2 2018/04/05 14:33:41 martin Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.2 2018/04/05 14:33:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172.6.3 2018/04/17 08:24:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -460,6 +460,11 @@ m_pkthdr_remove(struct mbuf *m)
 {
 	KASSERT(m->m_flags & M_PKTHDR);
 
+	if (M_READONLY(m)) {
+		/* Nothing we can do. */
+		return;
+	}
+
 	m_tag_delete_chain(m, NULL);
 	m->m_flags &= ~M_PKTHDR;
 	memset(>m_pkthdr, 0, sizeof(m->m_pkthdr));



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

2018-04-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 17 08:24:02 UTC 2018

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

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

sys/kern/uipc_mbuf.c: revision 1.190

If the mbuf is shared leave M_PKTHDR in place. Given where this function
is called from that's not supposed to happen, but I'm growing unconfident
about our mbuf code.


To generate a diff of this commit:
cvs rdiff -u -r1.172.6.2 -r1.172.6.3 src/sys/kern/uipc_mbuf.c

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



  1   2   >