Re: CVS commit: src/sys/net/npf

2019-08-06 Thread Christos Zoulas
Yes, rmind asked me to commit the change in private email.

christos

> On Aug 6, 2019, at 3:59 PM, Maxime Villard  wrote:
> 
> Le 06/08/2019 à 12:31, Christos Zoulas a écrit :
>> I did not see any messages about it, and the fix is fine until rmind comes 
>> up with something better.
> 
> Yes turns out it was an off-list email
> 
>> It is not nice to have HEAD unusable for 2 weeks now (since July 22nd).
> 
> Given your second commit, I should understand that rmind is ok with this
> change right?
> 
>> christos
>>> On Aug 6, 2019, at 1:26 PM, Maxime Villard  wrote:
>>> 
>>> Le 06/08/2019 à 12:25, Christos Zoulas a écrit :
 Module Name:   src
 Committed By:  christos
 Date:  Tue Aug  6 10:25:13 UTC 2019
 Modified Files:
src/sys/net/npf: npf_conn.c
 Log Message:
 Introduce an npf_conn_destroy_idx() that can handle partially constructed
 conn structures.
 To generate a diff of this commit:
 cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.c
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
>>> 
>>> Rmind said he had a fix and was testing it. Please revert this.



Re: CVS commit: src/sys/net/npf

2019-08-06 Thread Maxime Villard

Le 06/08/2019 à 12:31, Christos Zoulas a écrit :

I did not see any messages about it, and the fix is fine until rmind comes up 
with something better.


Yes turns out it was an off-list email


It is not nice to have HEAD unusable for 2 weeks now (since July 22nd).


Given your second commit, I should understand that rmind is ok with this
change right?


christos


On Aug 6, 2019, at 1:26 PM, Maxime Villard  wrote:

Le 06/08/2019 à 12:25, Christos Zoulas a écrit :

Module Name:src
Committed By:   christos
Date:   Tue Aug  6 10:25:13 UTC 2019
Modified Files:
src/sys/net/npf: npf_conn.c
Log Message:
Introduce an npf_conn_destroy_idx() that can handle partially constructed
conn structures.
To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.


Rmind said he had a fix and was testing it. Please revert this.




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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:16:55 UTC 2019

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

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

sys/kern/kern_proc.c: revision 1.234

Update our vm resource use for sysctl(3) call reading kinfo_proc*

Without this change RSS properties are zeroed unless a process exits or
calls getrusage(2).


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

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

Modified files:

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.233 src/sys/kern/kern_proc.c:1.233.2.1
--- src/sys/kern/kern_proc.c:1.233	Tue Jun 11 23:18:55 2019
+++ src/sys/kern/kern_proc.c	Tue Aug  6 16:16:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.233 2019/06/11 23:18:55 kamil Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.233.2.1 2019/08/06 16:16:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.233 2019/06/11 23:18:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.233.2.1 2019/08/06 16:16:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -1819,6 +1819,8 @@ sysctl_doeproc(SYSCTLFN_ARGS)
 
 		if (buflen >= elem_size &&
 		(type == KERN_PROC || elem_count > 0)) {
+			ruspace(p);	/* Update process vm resource use */
+
 			if (type == KERN_PROC) {
 fill_proc(p, >kproc.kp_proc, allowaddr);
 fill_eproc(p, >kproc.kp_eproc, zombie,



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:16:55 UTC 2019

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

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

sys/kern/kern_proc.c: revision 1.234

Update our vm resource use for sysctl(3) call reading kinfo_proc*

Without this change RSS properties are zeroed unless a process exits or
calls getrusage(2).


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

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



CVS commit: [netbsd-9] src/doc

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:24:59 UTC 2019

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

Log Message:
Tickets #19 - #22


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

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



CVS commit: [netbsd-9] src/doc

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:24:59 UTC 2019

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

Log Message:
Tickets #19 - #22


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.6 src/doc/CHANGES-9.0:1.1.2.7
--- src/doc/CHANGES-9.0:1.1.2.6	Mon Aug  5 04:41:41 2019
+++ src/doc/CHANGES-9.0	Tue Aug  6 16:24:59 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.6 2019/08/05 04:41:41 msaitoh Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.7 2019/08/06 16:24:59 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -267,3 +267,30 @@ usr.sbin/sysinst/label.c			1.12
 	When we find a FFSv1 filesystem, properly record it that way - so the
 	correct bootblocks get installed on system upgrades.
 	[martin, ticket #16]
+
+sys/arch/amd64/amd64/process_machdep.c		1.44
+
+	Do not dereference user pointer in ptrace_machdep_dorequest()/amd64,
+	always use copyin(9) for reading user memory.
+	This fixes SMAP crash on some amd64 machines.
+	[kamil, ticket #19]
+
+sys/kern/kern_proc.c1.234
+
+	Update our vm resource use for sysctl(3) call reading kinfo_proc*.
+	Without this change RSS properties are zeroed unless a process exits
+	or calls getrusage(2).
+	[kamil, ticket #20]
+
+sys/arch/i386/i386/process_machdep.c		1.94
+
+	Do not dereference user pointer in ptrace_machdep_dorequest()/i386,
+	always use copyin(9) for reading user memory.
+	[kamil, ticket #21]
+
+sys/sys/event.h	1.33
+
+	Make EV_SET() casts compatible with the C++ code.
+	[kamil, ticket #22]
+
+



CVS commit: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 15:52:52 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (ticket #1326)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.15 -r1.1281.2.16 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.15 -r1.1280.2.16 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: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 15:52:52 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs.h pcidevs_data.h

Log Message:
regen (ticket #1326)


To generate a diff of this commit:
cvs rdiff -u -r1.1281.2.15 -r1.1281.2.16 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1280.2.15 -r1.1280.2.16 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: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 15:51:07 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1326):

sys/dev/pci/pcidevs: revision 1.1381
sys/dev/pci/pcidevs: revision 1.1382
sys/dev/pci/pcidevs: revision 1.1383

- Intel C620 Virtual Switch Port for Termal Sensor is not 0x37c6 but 0x37c7.
- Add Some AMD Ryzen 3xxx's devices.
- Add some AMD devices mainly taken from OpenBSD.
- Rename some device names for consistency.
- Use _HDA for HD Audio.
Add BCM2711 PCIe Host bridge for RPI4


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.15 -r1.1289.2.16 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.1289.2.15 src/sys/dev/pci/pcidevs:1.1289.2.16
--- src/sys/dev/pci/pcidevs:1.1289.2.15	Wed Jul 17 15:27:55 2019
+++ src/sys/dev/pci/pcidevs	Tue Aug  6 15:51:07 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289.2.15 2019/07/17 15:27:55 martin Exp $
+$NetBSD: pcidevs,v 1.1289.2.16 2019/08/06 15:51:07 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1009,6 +1009,7 @@ product AMD F17_IOMMU	0x1451	Family17h I
 product AMD F17_PCIE_1	0x1452	Family17h PCIE
 product AMD F17_PCIE_2	0x1453	Family17h PCIE
 product AMD F17_PCIE_3	0x1454	Family17h PCIE
+product AMD F17_CCP_1	0x1456	Family17h Crypto
 product AMD F17_HDA	0x1457	Family17h HD Audio
 product AMD F17_XHCI	0x145c	Family17h xHCI
 product AMD F17_XHCI_2	0x145f	Family17h xHCI
@@ -1022,6 +1023,8 @@ product AMD F17_DF_7	0x1466	Family17h Da
 product AMD F17_DF_8	0x1467	Family17h Data Fabric
 product AMD F17_PCIE_4	0x1470	Family17h PCIE
 product AMD F17_PCIE_5	0x1471	Family17h PCIE
+product AMD F17_7X_RC	0x1480	Family17h/7xh Root Complex
+product AMD F17_7X_IOMMU 0x1481	Family17h/7xh IOMMU
 product AMD F14_RC	0x1510	Family14h Root Complex
 product AMD F16_HT	0x1530	Family16h HyperTransport Configuration
 product AMD F16_ADDR	0x1531	Family16h Address Map Configuration
@@ -1030,7 +1033,7 @@ product AMD F16_NB	0x1533	Family16h Nort
 product AMD F16_CSTATE	0x1534	Family16h CPU C-state Configuration
 product AMD F16_MISC	0x1535	Family16h Miscellaneous Configuration
 product AMD F16_RC	0x1536	Family16h Root Complex
-product AMD CRYPTO_COP	0x1537	Cryptographic Coprocessor
+product AMD F16_CCP	0x1537	Family16h Cryptographic Coprocessor
 product AMD F16_30_RC	0x1566	Family16h Root Complex
 product AMD F16_30_IOMMU	0x1567	Family16h IOMMU
 product AMD F16_HB	0x1568	Family16h Host Bridge
@@ -1108,6 +,13 @@ product AMD HUDSON_PCIE_0	0x43a0	Hudson 
 product AMD HUDSON_PCIE_1	0x43a1	Hudson PCIE Root Port 1
 product AMD HUDSON_PCIE_2	0x43a2	Hudson PCIE Root Port 2
 product AMD HUDSON_PCIE_3	0x43a3	Hudson PCIE Root Port 3
+product AMD 300SERIES_PCIE	0x43b4	300 Series PCIe
+product AMD 300SERIES_SATA	0x43b7	300 Series SATA
+product AMD 300SERIES_XHCI	0x43bb	300 Series xHCI
+product AMD 400SERIES_PCIE_1	0x43c6	400 Series PCIe
+product AMD 400SERIES_PCIE_2	0x43c7	400 Series PCIe
+product AMD 400SERIES_AHCI	0x43c8	400 Series AHCI
+product AMD 400SERIES_XHCI	0x43d0	400 Series xHCI
 product AMD SC751_SC	0x7006	AMD751 System Controller
 product AMD SC751_PPB	0x7007	AMD751 PCI-PCI Bridge
 product AMD IGR4_AGP	0x700a	AMD IGR4 AGP Bridge
@@ -1152,21 +1162,33 @@ product AMD PBC8111_ACPI	0x746b	AMD8111 
 product AMD PBC8111_AC		0x746d	AMD8111 AC97 Audio
 product AMD PBC8111_MC97	0x746e	AMD8111 MC97 Modem
 product AMD PBC8111_AC_756b	0x756b	AMD8111 756b ACPI Controller
-product AMD HUDSON_SATA		0x7800	Hudson SATA Controller
-product AMD HUDSON_SATA_AHCI	0x7801	Hudson AHCI SATA Controller
+product AMD HUDSON_SATA		0x7800	Hudson SATA (IDE) Controller
+product AMD HUDSON_SATA_AHCI	0x7801	Hudson SATA (AHCI) Controller
+product AMD HUDSON_SATA_RAID	0x7802	Hudson SATA (RAID) Controller
+product AMD HUDSON_SATA_RAID5	0x7803	Hudson SATA (RAID5) Controller
+product AMD HUDSON_SATA_AHCI_2	0x7804	Hudson SATA (AMD AHCI) Controller
+product AMD HUDSON_SATA_RAID_2	0x7805	Hudson SATA (RAID) Controller
 product AMD HUDSON_SDHC		0x7806	Hudson SD Flash Controller
 product AMD HUDSON_OHCI		0x7807	Hudson USB OHCI Controller
 product AMD HUDSON_EHCI		0x7808	Hudson USB EHCI Controller
 product AMD HUDSON_OHCI_2	0x7809	Hudson USB OHCI Controller
 product AMD HUDSON_SMB		0x780b	Hudson SMBus Controller
 product AMD HUDSON_IDE		0x780c	Hudson IDE Controller
-product AMD HUDSON_HDAUDIO	0x780d	Hudson HD Audio Controller
+product AMD HUDSON_HDA		0x780d	Hudson HD Audio Controller
 product AMD HUDSON_LPC		0x780e	Hudson LPC Bridge
 product AMD HUDSON_PCI		0x780f	Hudson PCI Bridge
 product AMD HUDSON_XHCI		0x7812	Hudson USB xHCI Controller
 product AMD FCH_SDHC		0x7813	FCH SD Flash Controller
 product AMD FCH_XHCI		0x7814	FCH USB xHCI Controller
+product AMD KERNCZ_SATA_1	0x7900	

CVS commit: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 15:51:07 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1326):

sys/dev/pci/pcidevs: revision 1.1381
sys/dev/pci/pcidevs: revision 1.1382
sys/dev/pci/pcidevs: revision 1.1383

- Intel C620 Virtual Switch Port for Termal Sensor is not 0x37c6 but 0x37c7.
- Add Some AMD Ryzen 3xxx's devices.
- Add some AMD devices mainly taken from OpenBSD.
- Rename some device names for consistency.
- Use _HDA for HD Audio.
Add BCM2711 PCIe Host bridge for RPI4


To generate a diff of this commit:
cvs rdiff -u -r1.1289.2.15 -r1.1289.2.16 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: [netbsd-8] src/sys/arch/x86/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:05:11 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1328):

sys/arch/x86/pci/amdsmn.c: revision 1.4
sys/arch/x86/pci/amdsmn.c: revision 1.5
sys/arch/x86/pci/amdsmn.c: revision 1.6

Add support for Ryzen 2xxx and 3xxx.

Use unsigned to fix compile error on i386.

Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/arch/x86/pci/amdsmn.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.3.2.3 src/sys/arch/x86/pci/amdsmn.c:1.3.2.4
--- src/sys/arch/x86/pci/amdsmn.c:1.3.2.3	Tue Feb  6 09:05:27 2018
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Aug  6 16:05:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.3.2.3 2018/02/06 09:05:27 martin Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.3 2018/02/06 09:05:27 martin Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.3.2.4 2019/08/06 16:05:11 martin Exp $ ");
 
 /*
  * Driver for the AMD Family 17h CPU System Management Network.
@@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1
 
 #define	SMN_ADDR_REG	0x60
 #define	SMN_DATA_REG	0x64
-#define	AMD_17H_MANAGEMENT_NETWORK_PCI_ID	0x14501022
 
 struct amdsmn_softc {
 	kmutex_t smn_lock;
@@ -63,6 +62,14 @@ struct amdsmn_softc {
 	pcitag_t pcitag;
 };
 
+static const struct pciid {
+	uint16_t	amdsmn_deviceid;
+} amdsmn_ids[] = {
+	{ PCI_PRODUCT_AMD_F17_RC },
+	{ PCI_PRODUCT_AMD_F17_1X_RC },
+	{ PCI_PRODUCT_AMD_F17_7X_RC },
+};
+
 static int amdsmn_match(device_t, cfdata_t, void *);
 static void amdsmn_attach(device_t, device_t, void *);
 static int amdsmn_rescan(device_t, const char *, const int *);
@@ -71,17 +78,25 @@ static int amdsmn_misc_search(device_t, 
 
 CFATTACH_DECL3_NEW(amdsmn, sizeof(struct amdsmn_softc), amdsmn_match,
 amdsmn_attach, amdsmn_detach, NULL, amdsmn_rescan, NULL, 0);
-
+
 static int
-amdsmn_match(device_t parent, cfdata_t match, void *aux) 
+amdsmn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
-	
-	return pa->pa_id == AMD_17H_MANAGEMENT_NETWORK_PCI_ID ? 2 : 0;
+	unsigned int i;
+
+	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
+		return 0;
+
+	for (i = 0; i < __arraycount(amdsmn_ids); i++)
+		if (PCI_PRODUCT(pa->pa_id) == amdsmn_ids[i].amdsmn_deviceid)
+			return 2;
+
+	return 0;
 }
 
-static int 
-amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux) 
+static int
+amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux)
 {
 	if (config_match(parent, cf, aux))
 		config_attach_loc(parent, cf, locs, aux, NULL);
@@ -89,8 +104,8 @@ amdsmn_misc_search(device_t parent, cfda
 	return 0;
 }
 
-static void 
-amdsmn_attach(device_t parent, device_t self, void *aux) 
+static void
+amdsmn_attach(device_t parent, device_t self, void *aux)
 {
 	struct amdsmn_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
@@ -115,7 +130,7 @@ amdsmn_rescan(device_t self, const char 
 }
 
 static int
-amdsmn_detach(device_t self, int flags) 
+amdsmn_detach(device_t self, int flags)
 {
 	struct amdsmn_softc *sc = device_private(self);
 



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:05:11 UTC 2019

Modified Files:
src/sys/arch/x86/pci [netbsd-8]: amdsmn.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1328):

sys/arch/x86/pci/amdsmn.c: revision 1.4
sys/arch/x86/pci/amdsmn.c: revision 1.5
sys/arch/x86/pci/amdsmn.c: revision 1.6

Add support for Ryzen 2xxx and 3xxx.

Use unsigned to fix compile error on i386.

Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/arch/x86/pci/amdsmn.c

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



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:22:04 UTC 2019

Modified Files:
src/sys/sys [netbsd-9]: event.h

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

sys/sys/event.h: revision 1.33

Make EV_SET() casts compatible with the C++ code

EV_SET() handles cast that are expected to work with alternative
kqueue/kevent implementations that take arguments in different types.

Unfortunately void* -> intptr_t cast cannot be done with
static_cast() as it needs reinterpret_cast().

Just switching to reinterpret_cast() is still not sufficient as=
it does not handle NULL argument without a compiler error/warning.

Add a compatibility function for the C++ case of _EV_SET() that accepts
the udata argument in the form of void* and performs clean
reinterpret_cast<>() internally.

There is no change for C users.

Tested by 

Proposed on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.8.1 src/sys/sys/event.h

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



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:22:04 UTC 2019

Modified Files:
src/sys/sys [netbsd-9]: event.h

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

sys/sys/event.h: revision 1.33

Make EV_SET() casts compatible with the C++ code

EV_SET() handles cast that are expected to work with alternative
kqueue/kevent implementations that take arguments in different types.

Unfortunately void* -> intptr_t cast cannot be done with
static_cast() as it needs reinterpret_cast().

Just switching to reinterpret_cast() is still not sufficient as=
it does not handle NULL argument without a compiler error/warning.

Add a compatibility function for the C++ case of _EV_SET() that accepts
the udata argument in the form of void* and performs clean
reinterpret_cast<>() internally.

There is no change for C users.

Tested by 

Proposed on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.8.1 src/sys/sys/event.h

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

Modified files:

Index: src/sys/sys/event.h
diff -u src/sys/sys/event.h:1.32 src/sys/sys/event.h:1.32.8.1
--- src/sys/sys/event.h:1.32	Tue Jan  9 03:31:13 2018
+++ src/sys/sys/event.h	Tue Aug  6 16:22:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.h,v 1.32 2018/01/09 03:31:13 christos Exp $	*/
+/*	$NetBSD: event.h,v 1.32.8.1 2019/08/06 16:22:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon 
@@ -55,10 +55,6 @@ struct kevent {
 	intptr_t	udata;		/* opaque user data identifier */
 };
 
-#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
-_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
-(fflags), (data), __CAST(intptr_t, (udata)))
-
 static __inline void
 _EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
 uint32_t _flags, uint32_t _fflags, int64_t _data, intptr_t _udata)
@@ -71,6 +67,24 @@ _EV_SET(struct kevent *_kevp, uintptr_t 
 	_kevp->udata = _udata;
 }
 
+#ifdef __cplusplus
+#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
+_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
+(fflags), (data), (udata))
+
+static __inline void
+_EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
+uint32_t _flags, uint32_t _fflags, int64_t _data, void *_udata)
+{
+	_EV_SET(_kevp, _ident, _filter, _flags, _fflags, _data,
+	reinterpret_cast(_udata));
+}
+#else
+#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
+_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
+(fflags), (data), __CAST(intptr_t, (udata)))
+#endif
+
 /* actions */
 #define	EV_ADD		0x0001U		/* add event to kq (implies ENABLE) */
 #define	EV_DELETE	0x0002U		/* delete event from kq */



CVS commit: src/sys/netinet

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:48:19 UTC 2019

Modified Files:
src/sys/netinet: tcp_input.c tcp_subr.c tcp_timer.h tcp_usrreq.c

Log Message:
Clamp tcp timer quantities to reasonable ranges.

Reported-by: syzbot+259675123340bf46a...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.414 -r1.415 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.282 -r1.283 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/tcp_timer.h
cvs rdiff -u -r1.224 -r1.225 src/sys/netinet/tcp_usrreq.c

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

Modified files:

Index: src/sys/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.414 src/sys/netinet/tcp_input.c:1.415
--- src/sys/netinet/tcp_input.c:1.414	Sat Jun  1 15:18:42 2019
+++ src/sys/netinet/tcp_input.c	Tue Aug  6 15:48:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.414 2019/06/01 15:18:42 kamil Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.415 2019/08/06 15:48:18 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.414 2019/06/01 15:18:42 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.415 2019/08/06 15:48:18 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3379,7 +3379,7 @@ tcp_xmit_timer(struct tcpcb *tp, uint32_
 		if (__predict_false(tcp_rttlocal) && tcp_msl_enable
 		&& tp->t_srtt > tcp_msl_remote_threshold
 		&& tp->t_msl  < tcp_msl_remote) {
-			tp->t_msl = tcp_msl_remote;
+			tp->t_msl = MIN(tcp_msl_remote, TCP_MAXMSL);
 		}
 	} else {
 		/*
@@ -3647,7 +3647,7 @@ syn_cache_timer(void *arg)
 	 * than the keep alive timer would allow, expire it.
 	 */
 	sc->sc_rxttot += sc->sc_rxtcur;
-	if (sc->sc_rxttot >= tcp_keepinit)
+	if (sc->sc_rxttot >= MIN(tcp_keepinit, TCP_TIMER_MAXTICKS))
 		goto dropit;
 
 	TCP_STATINC(TCP_STAT_SC_RETRANSMITTED);

Index: src/sys/netinet/tcp_subr.c
diff -u src/sys/netinet/tcp_subr.c:1.282 src/sys/netinet/tcp_subr.c:1.283
--- src/sys/netinet/tcp_subr.c:1.282	Thu Dec 27 16:59:17 2018
+++ src/sys/netinet/tcp_subr.c	Tue Aug  6 15:48:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_subr.c,v 1.282 2018/12/27 16:59:17 maxv Exp $	*/
+/*	$NetBSD: tcp_subr.c,v 1.283 2019/08/06 15:48:18 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.282 2018/12/27 16:59:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.283 2019/08/06 15:48:18 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -948,11 +948,12 @@ tcp_tcpcb_template(void)
 	TCPTV_MIN, TCPTV_REXMTMAX);
 
 	/* Keep Alive */
-	tp->t_keepinit = tcp_keepinit;
-	tp->t_keepidle = tcp_keepidle;
-	tp->t_keepintvl = tcp_keepintvl;
-	tp->t_keepcnt = tcp_keepcnt;
-	tp->t_maxidle = tp->t_keepcnt * tp->t_keepintvl;
+	tp->t_keepinit = MIN(tcp_keepinit, TCP_TIMER_MAXTICKS);
+	tp->t_keepidle = MIN(tcp_keepidle, TCP_TIMER_MAXTICKS);
+	tp->t_keepintvl = MIN(tcp_keepintvl, TCP_TIMER_MAXTICKS);
+	tp->t_keepcnt = MAX(1, MIN(tcp_keepcnt, TCP_TIMER_MAXTICKS));
+	tp->t_maxidle = tp->t_keepcnt * MIN(tp->t_keepintvl,
+	TCP_TIMER_MAXTICKS/tp->t_keepcnt);
 
 	/* MSL */
 	tp->t_msl = TCPTV_MSL;
@@ -2012,6 +2013,9 @@ tcp_established(struct tcpcb *tp)
 		break;
 	}
 
+	/* Clamp to a reasonable range.  */
+	tp->t_msl = MIN(tp->t_msl, TCP_MAXMSL);
+
 #ifdef INET6
 	/* The !tp->t_inpcb lets the compiler know it can't be v4 *and* v6 */
 	while (!tp->t_inpcb && tp->t_in6pcb) {
@@ -2041,6 +2045,9 @@ tcp_established(struct tcpcb *tp)
 		tp->t_msl = tcp_msl_remote ? tcp_msl_remote : TCPTV_MSL;
 		break;
 	}
+
+	/* Clamp to a reasonable range.  */
+	tp->t_msl = MIN(tp->t_msl, TCP_MAXMSL);
 #endif
 
 	tp->t_state = TCPS_ESTABLISHED;

Index: src/sys/netinet/tcp_timer.h
diff -u src/sys/netinet/tcp_timer.h:1.29 src/sys/netinet/tcp_timer.h:1.30
--- src/sys/netinet/tcp_timer.h:1.29	Fri Jan 19 07:53:01 2018
+++ src/sys/netinet/tcp_timer.h	Tue Aug  6 15:48:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_timer.h,v 1.29 2018/01/19 07:53:01 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_timer.h,v 1.30 2019/08/06 15:48:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2005 The NetBSD Foundation, Inc.
@@ -165,6 +165,12 @@ const char *tcptimers[] =
 #define	TCP_TIMER_ISARMED(tp, timer)	\
 	callout_active(&(tp)->t_timer[(timer)])
 
+#define	TCP_TIMER_MAXTICKS		  \
+	(INT_MAX / (hz / PR_SLOWHZ))
+
+#define	TCP_MAXMSL			  \
+	(TCP_TIMER_MAXTICKS / 2)
+
 /*
  * Force a time value to be in a certain range.
  */

Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.224 src/sys/netinet/tcp_usrreq.c:1.225
--- src/sys/netinet/tcp_usrreq.c:1.224	Tue Feb  5 04:48:47 2019
+++ src/sys/netinet/tcp_usrreq.c	Tue Aug  6 15:48:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.224 2019/02/05 

CVS commit: src/sys/netinet

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:48:19 UTC 2019

Modified Files:
src/sys/netinet: tcp_input.c tcp_subr.c tcp_timer.h tcp_usrreq.c

Log Message:
Clamp tcp timer quantities to reasonable ranges.

Reported-by: syzbot+259675123340bf46a...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.414 -r1.415 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.282 -r1.283 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.29 -r1.30 src/sys/netinet/tcp_timer.h
cvs rdiff -u -r1.224 -r1.225 src/sys/netinet/tcp_usrreq.c

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



CVS commit: src/sys/kern

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:48:06 UTC 2019

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

Log Message:
Acquire shmseg uobj reference while we hold shm_lock.

Otherwise nothing prevents it from being detached under our feet when
we drop shm_lock.

Reported-by: syzbot+a76c618a6808a0fda...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/kern/sysv_shm.c

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



CVS commit: src/sys/kern

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:48:06 UTC 2019

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

Log Message:
Acquire shmseg uobj reference while we hold shm_lock.

Otherwise nothing prevents it from being detached under our feet when
we drop shm_lock.

Reported-by: syzbot+a76c618a6808a0fda...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/kern/sysv_shm.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/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.135 src/sys/kern/sysv_shm.c:1.136
--- src/sys/kern/sysv_shm.c:1.135	Mon Jun 10 00:35:47 2019
+++ src/sys/kern/sysv_shm.c	Tue Aug  6 15:48:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_shm.c,v 1.135 2019/06/10 00:35:47 chs Exp $	*/
+/*	$NetBSD: sysv_shm.c,v 1.136 2019/08/06 15:48:06 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.135 2019/06/10 00:35:47 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.136 2019/08/06 15:48:06 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -425,14 +425,19 @@ sys_shmat(struct lwp *l, const struct sy
 	shmseg->shm_lpid = p->p_pid;
 	shmseg->shm_nattch++;
 	shm_realloc_disable++;
-	mutex_exit(_lock);
 
 	/*
-	 * Add a reference to the memory object, map it to the
-	 * address space, and lock the memory, if needed.
+	 * Add a reference to the uvm object while we hold the
+	 * shm_lock.
 	 */
 	uobj = shmseg->_shm_internal;
 	uao_reference(uobj);
+	mutex_exit(_lock);
+
+	/*
+	 * Drop the shm_lock to map it into the address space, and lock
+	 * the memory, if needed (XXX where does this lock memory?).
+	 */
 	error = uvm_map(>vm_map, _va, size, uobj, 0, 0,
 	UVM_MAPFLAG(prot, prot, UVM_INH_SHARE, UVM_ADV_RANDOM, flags));
 	if (error)



CVS commit: src/sys

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:47:55 UTC 2019

Modified Files:
src/sys/kern: kern_time.c
src/sys/sys: timevar.h

Log Message:
Fix race in timer destruction.

Anything we confirmed about the world before callout_halt may cease
to be true afterward, so make sure to start over in that case.

Add some comments explaining what's going on.

Reported-by: syzbot+d58da99969f58c1a0...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/kern/kern_time.c
cvs rdiff -u -r1.38 -r1.39 src/sys/sys/timevar.h

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

Modified files:

Index: src/sys/kern/kern_time.c
diff -u src/sys/kern/kern_time.c:1.197 src/sys/kern/kern_time.c:1.198
--- src/sys/kern/kern_time.c:1.197	Sun Mar 10 14:45:53 2019
+++ src/sys/kern/kern_time.c	Tue Aug  6 15:47:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.197 2019/03/10 14:45:53 kre Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.198 2019/08/06 15:47:55 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.197 2019/03/10 14:45:53 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.198 2019/08/06 15:47:55 riastradh Exp $");
 
 #include 
 #include 
@@ -702,6 +702,8 @@ sys_timer_delete(struct lwp *l, const st
 			pt->pt_active = 0;
 		}
 	}
+
+	/* Free the timer and release the lock.  */
 	itimerfree(pts, timerid);
 
 	return (0);
@@ -711,8 +713,11 @@ sys_timer_delete(struct lwp *l, const st
  * Set up the given timer. The value in pt->pt_time.it_value is taken
  * to be an absolute time for CLOCK_REALTIME/CLOCK_MONOTONIC timers and
  * a relative time for CLOCK_VIRTUAL/CLOCK_PROF timers.
+ *
+ * If the callout had already fired but not yet run, fails with
+ * ERESTART -- caller must restart from the top to look up a timer.
  */
-void
+int
 timer_settime(struct ptimer *pt)
 {
 	struct ptimer *ptn, *pptn;
@@ -721,7 +726,17 @@ timer_settime(struct ptimer *pt)
 	KASSERT(mutex_owned(_lock));
 
 	if (!CLOCK_VIRTUAL_P(pt->pt_type)) {
-		callout_halt(>pt_ch, _lock);
+		/*
+		 * Try to stop the callout.  However, if it had already
+		 * fired, we have to drop the lock to wait for it, so
+		 * the world may have changed and pt may not be there
+		 * any more.  In that case, tell the caller to start
+		 * over from the top.
+		 */
+		if (callout_halt(>pt_ch, _lock))
+			return ERESTART;
+
+		/* Now we can touch pt and start it up again.  */
 		if (timespecisset(>pt_time.it_value)) {
 			/*
 			 * Don't need to check tshzto() return value, here.
@@ -770,6 +785,9 @@ timer_settime(struct ptimer *pt)
 		} else
 			pt->pt_active = 0;
 	}
+
+	/* Success!  */
+	return 0;
 }
 
 void
@@ -868,6 +886,7 @@ dotimer_settime(int timerid, struct itim
 		return error;
 
 	mutex_spin_enter(_lock);
+restart:
 	if ((pt = pts->pts_timers[timerid]) == NULL) {
 		mutex_spin_exit(_lock);
 		return EINVAL;
@@ -908,7 +927,12 @@ dotimer_settime(int timerid, struct itim
 		}
 	}
 
-	timer_settime(pt);
+	error = timer_settime(pt);
+	if (error == ERESTART) {
+		KASSERT(!CLOCK_VIRTUAL_P(pt->pt_type));
+		goto restart;
+	}
+	KASSERT(error == 0);
 	mutex_spin_exit(_lock);
 
 	if (ovalue)
@@ -1046,12 +1070,17 @@ realtimerexpire(void *arg)
 	}
 
 	/*
+	 * Reset the callout, if it's not going away.
+	 *
 	 * Don't need to check tshzto() return value, here.
 	 * callout_reset() does it for us.
 	 */
-	callout_reset(>pt_ch, pt->pt_type == CLOCK_MONOTONIC ?
-	tshztoup(>pt_time.it_value) : tshzto(>pt_time.it_value),
-	realtimerexpire, pt);
+	if (!pt->pt_dying)
+		callout_reset(>pt_ch,
+		(pt->pt_type == CLOCK_MONOTONIC
+			? tshztoup(>pt_time.it_value)
+			: tshzto(>pt_time.it_value)),
+		realtimerexpire, pt);
 	mutex_spin_exit(_lock);
 }
 
@@ -1143,6 +1172,7 @@ dosetitimer(struct proc *p, int which, s
 	struct timespec now;
 	struct ptimers *pts;
 	struct ptimer *pt, *spare;
+	int error;
 
 	KASSERT((u_int)which <= CLOCK_MONOTONIC);
 	if (itimerfix(>it_value) || itimerfix(>it_interval))
@@ -1161,6 +1191,7 @@ dosetitimer(struct proc *p, int which, s
 	if (pts == NULL)
 		pts = timers_alloc(p);
 	mutex_spin_enter(_lock);
+restart:
 	pt = pts->pts_timers[which];
 	if (pt == NULL) {
 		if (spare == NULL) {
@@ -1218,7 +1249,12 @@ dosetitimer(struct proc *p, int which, s
 			break;
 		}
 	}
-	timer_settime(pt);
+	error = timer_settime(pt);
+	if (error == ERESTART) {
+		KASSERT(!CLOCK_VIRTUAL_P(pt->pt_type));
+		goto restart;
+	}
+	KASSERT(error == 0);
 	mutex_spin_exit(_lock);
 	if (spare != NULL)
 		pool_put(_pool, spare);
@@ -1305,7 +1341,9 @@ timers_free(struct proc *p, int which)
 	}
 	for ( ; i < TIMER_MAX; i++) {
 		if (pts->pts_timers[i] != NULL) {
+			/* Free the timer and release the lock.  */
 			itimerfree(pts, i);
+			/* Reacquire the lock for the next one.  */
 			

CVS commit: src/sys

2019-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  6 15:47:55 UTC 2019

Modified Files:
src/sys/kern: kern_time.c
src/sys/sys: timevar.h

Log Message:
Fix race in timer destruction.

Anything we confirmed about the world before callout_halt may cease
to be true afterward, so make sure to start over in that case.

Add some comments explaining what's going on.

Reported-by: syzbot+d58da99969f58c1a0...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/kern/kern_time.c
cvs rdiff -u -r1.38 -r1.39 src/sys/sys/timevar.h

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/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:02:54 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: piixpm.c piixpmreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1327):

sys/dev/pci/piixpmreg.h: revision 1.8
sys/dev/pci/piixpm.c: revision 1.53
sys/dev/pci/piixpm.c: revision 1.54

Sync with OpenBSD's piixpm.c up to rev. 1.35:
- Print "polling" correctly when in the attach function. Same as OpenBSD
 rev. 1.22-23.
- Improve debug printf()'s. Part of OpenBSD 1.24.
- Do not bus_space_map devices which are at address 0 (it's uninitialized).
  Same as OpenBSD rev. 1.25.
- Add ServerWorks HT1100 device from OpenBSD. Same as OpenBSD rev. 1.32
- Use unique wait channel. From OpenBSD rev. 1.35

Improve SB800 and newer chipsets support:
- Add newer chipset (e.g. X370/X399 and newer) support that the PCI device id
  is 0x790b. The register definitions are mainly taken from FreeBSD.
- Rename PIIXPM_INDIRECTIO_* to SB800_INDIRECTIO_* because those are only
  for SB800 and newer chipsets.
- SB800 also support 4 ports.
- SB800's interrupt configuration bit is different from others.
  Use SB800_SMB_HOSTC's bit 0.
- Do not bus_space_map devices which are at address 0 (it's uninitialized)
  in piixpm_attach().
- Add the port number to the dmesg output.
- Avoid uninitiliazed use of ctl and corresponding warnings. From OpenBSD rev.
  1.38


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.6.1 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.7 -r1.7.22.1 src/sys/dev/pci/piixpmreg.h

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

Modified files:

Index: src/sys/dev/pci/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.52 src/sys/dev/pci/piixpm.c:1.52.6.1
--- src/sys/dev/pci/piixpm.c:1.52	Wed Mar 29 09:04:36 2017
+++ src/sys/dev/pci/piixpm.c	Tue Aug  6 16:02:54 2019
@@ -1,5 +1,5 @@
-/* $NetBSD: piixpm.c,v 1.52 2017/03/29 09:04:36 msaitoh Exp $ */
-/*	$OpenBSD: piixpm.c,v 1.20 2006/02/27 08:25:02 grange Exp $	*/
+/* $NetBSD: piixpm.c,v 1.52.6.1 2019/08/06 16:02:54 martin Exp $ */
+/*	$OpenBSD: piixpm.c,v 1.39 2013/10/01 20:06:02 sf Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006 Alexander Yurchenko 
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.52 2017/03/29 09:04:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1.52.6.1 2019/08/06 16:02:54 martin Exp $");
 
 #include 
 #include 
@@ -49,12 +49,27 @@ __KERNEL_RCSID(0, "$NetBSD: piixpm.c,v 1
 #define DPRINTF(x)
 #endif
 
-#define PIIXPM_IS_CSB5(id) \
-	(PCI_VENDOR((id)) == PCI_VENDOR_SERVERWORKS && \
-	PCI_PRODUCT((id)) == PCI_PRODUCT_SERVERWORKS_CSB5)
+#define PIIXPM_IS_CSB5(sc)		  \
+	(PCI_VENDOR((sc)->sc_id) == PCI_VENDOR_SERVERWORKS &&		  \
+	PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_SERVERWORKS_CSB5)
 #define PIIXPM_DELAY	200
 #define PIIXPM_TIMEOUT	1
 
+#define PIIXPM_IS_SB800GRP(sc)		  \
+	((PCI_VENDOR((sc)->sc_id) == PCI_VENDOR_ATI) &&			  \
+	((PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_ATI_SB600_SMB) &&	  \
+		((sc)->sc_rev >= 0x40)))
+
+#define PIIXPM_IS_HUDSON(sc)		  \
+	((PCI_VENDOR((sc)->sc_id) == PCI_VENDOR_AMD) &&			  \
+	(PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_AMD_HUDSON_SMB))
+
+#define PIIXPM_IS_KERNCZ(sc)		  \
+	((PCI_VENDOR((sc)->sc_id) == PCI_VENDOR_AMD) &&			  \
+	(PCI_PRODUCT((sc)->sc_id) == PCI_PRODUCT_AMD_KERNCZ_SMB))
+
+#define PIIXPM_IS_FCHGRP(sc)	(PIIXPM_IS_HUDSON(sc) || PIIXPM_IS_KERNCZ(sc))
+
 struct piixpm_smbus {
 	int			sda;
 	struct			piixpm_softc *softc;
@@ -75,6 +90,7 @@ struct piixpm_softc {
 	pci_chipset_tag_t	sc_pc;
 	pcitag_t		sc_pcitag;
 	pcireg_t		sc_id;
+	pcireg_t		sc_rev;
 
 	int			sc_numbusses;
 	device_t		sc_i2c_device[4];
@@ -142,12 +158,14 @@ piixpm_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_SERVERWORKS_CSB5:
 		case PCI_PRODUCT_SERVERWORKS_CSB6:
 		case PCI_PRODUCT_SERVERWORKS_HT1000SB:
+		case PCI_PRODUCT_SERVERWORKS_HT1100SB:
 			return 1;
 		}
 		break;
 	case PCI_VENDOR_AMD:
 		switch (PCI_PRODUCT(pa->pa_id)) {
 		case PCI_PRODUCT_AMD_HUDSON_SMB:
+		case PCI_PRODUCT_AMD_KERNCZ_SMB:
 			return 1;
 		}
 		break;
@@ -164,6 +182,7 @@ piixpm_attach(device_t parent, device_t 
 	pcireg_t base, conf;
 	pcireg_t pmmisc;
 	pci_intr_handle_t ih;
+	bool usesmi = false;
 	const char *intrstr = NULL;
 	int i, flags;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -171,6 +190,7 @@ piixpm_attach(device_t parent, device_t 
 	sc->sc_dev = self;
 	sc->sc_iot = pa->pa_iot;
 	sc->sc_id = pa->pa_id;
+	sc->sc_rev = PCI_REVISION(pa->pa_class);
 	sc->sc_pc = pa->pa_pc;
 	sc->sc_pcitag = pa->pa_tag;
 	sc->sc_numbusses = 1;
@@ -180,10 +200,6 @@ piixpm_attach(device_t parent, device_t 
 	if (!pmf_device_register(self, piixpm_suspend, piixpm_resume))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	/* Read configuration */
-	conf = pci_conf_read(pa->pa_pc, pa->pa_tag, 

CVS commit: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:02:54 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: piixpm.c piixpmreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1327):

sys/dev/pci/piixpmreg.h: revision 1.8
sys/dev/pci/piixpm.c: revision 1.53
sys/dev/pci/piixpm.c: revision 1.54

Sync with OpenBSD's piixpm.c up to rev. 1.35:
- Print "polling" correctly when in the attach function. Same as OpenBSD
 rev. 1.22-23.
- Improve debug printf()'s. Part of OpenBSD 1.24.
- Do not bus_space_map devices which are at address 0 (it's uninitialized).
  Same as OpenBSD rev. 1.25.
- Add ServerWorks HT1100 device from OpenBSD. Same as OpenBSD rev. 1.32
- Use unique wait channel. From OpenBSD rev. 1.35

Improve SB800 and newer chipsets support:
- Add newer chipset (e.g. X370/X399 and newer) support that the PCI device id
  is 0x790b. The register definitions are mainly taken from FreeBSD.
- Rename PIIXPM_INDIRECTIO_* to SB800_INDIRECTIO_* because those are only
  for SB800 and newer chipsets.
- SB800 also support 4 ports.
- SB800's interrupt configuration bit is different from others.
  Use SB800_SMB_HOSTC's bit 0.
- Do not bus_space_map devices which are at address 0 (it's uninitialized)
  in piixpm_attach().
- Add the port number to the dmesg output.
- Avoid uninitiliazed use of ctl and corresponding warnings. From OpenBSD rev.
  1.38


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.6.1 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.7 -r1.7.22.1 src/sys/dev/pci/piixpmreg.h

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/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:10:17 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: if_et.c if_etreg.h

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1329:

sys/dev/pci/if_etreg.h  1.2-1.3
sys/dev/pci/if_et.c 1.23,1.25 and 1.26
via patch

Make et(4) work:
- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
  controllable.
- Enabling TX/RX in et_init() will always fail when cable is not
  plugged in. If this happens, we delay TX/RX enablement until link is
  up.
- Modify flow control stuff a little. It still doesn't work.
- Avoid undefined behavior when reset the chip.
- Code cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.14.8.2 -r1.14.8.3 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/pci/if_etreg.h

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

Modified files:

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.14.8.2 src/sys/dev/pci/if_et.c:1.14.8.3
--- src/sys/dev/pci/if_et.c:1.14.8.2	Mon May 13 12:40:13 2019
+++ src/sys/dev/pci/if_et.c	Tue Aug  6 16:10:17 2019
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_et.c,v 1.14.8.2 2019/05/13 12:40:13 martin Exp $	*/
-/*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
+/*	$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $	*/
+/*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.2 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.3 2019/08/06 16:10:17 martin Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -83,17 +83,19 @@ __KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.
 
 int	et_match(device_t, cfdata_t, void *);
 void	et_attach(device_t, device_t, void *);
-int	et_detach(device_t, int flags);
+int	et_detach(device_t, int);
 int	et_shutdown(device_t);
 
 int	et_miibus_readreg(device_t, int, int);
 void	et_miibus_writereg(device_t, int, int, int);
 void	et_miibus_statchg(struct ifnet *);
 
-int	et_init(struct ifnet *ifp);
+int	et_init(struct ifnet *);
 int	et_ioctl(struct ifnet *, u_long, void *);
 void	et_start(struct ifnet *);
 void	et_watchdog(struct ifnet *);
+static int	et_ifmedia_upd(struct ifnet *);
+static void	et_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
 int	et_intr(void *);
 void	et_enable_intrs(struct et_softc *, uint32_t);
@@ -131,7 +133,6 @@ int	et_start_rxdma(struct et_softc *);
 int	et_start_txdma(struct et_softc *);
 int	et_stop_rxdma(struct et_softc *);
 int	et_stop_txdma(struct et_softc *);
-int	et_enable_txrx(struct et_softc *);
 void	et_reset(struct et_softc *);
 int	et_bus_config(struct et_softc *);
 void	et_get_eaddr(struct et_softc *, uint8_t[]);
@@ -189,6 +190,8 @@ et_attach(device_t parent, device_t self
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	struct ifnet *ifp = >sc_ethercom.ec_if;
+	struct mii_data * const mii = >sc_miibus;
+	uint32_t pmcfg;
 	pcireg_t memtype;
 	int error;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -232,6 +235,9 @@ et_attach(device_t parent, device_t self
 	sc->sc_pct = pa->pa_pc;
 	sc->sc_pcitag = pa->pa_tag;
 
+	if (pa->pa_id == PCI_PRODUCT_LUCENT_ET1301)
+		sc->sc_flags |= ET_FLAG_FASTETHER;
+
 	error = et_bus_config(sc);
 	if (error)
 		goto fail;
@@ -241,8 +247,11 @@ et_attach(device_t parent, device_t self
 	aprint_normal_dev(self, "Ethernet address %s\n",
 	ether_sprintf(sc->sc_enaddr));
 
-	CSR_WRITE_4(sc, ET_PM,
-		ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE);
+	/* Take PHY out of COMA and enable clocks. */
+	pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE;
+	if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0)
+		pmcfg |= EM_PM_GIGEPHY_ENB;
+	CSR_WRITE_4(sc, ET_PM, pmcfg);
 
 	et_reset(sc);
 
@@ -265,23 +274,21 @@ et_attach(device_t parent, device_t self
 
 	et_chip_attach(sc);
 
-	sc->sc_miibus.mii_ifp = ifp;
-	sc->sc_miibus.mii_readreg = et_miibus_readreg;
-	sc->sc_miibus.mii_writereg = et_miibus_writereg;
-	sc->sc_miibus.mii_statchg = et_miibus_statchg;
-
-	sc->sc_ethercom.ec_mii = >sc_miibus;
-	ifmedia_init(>sc_miibus.mii_media, 0, ether_mediachange,
-	ether_mediastatus);
-	mii_attach(self, >sc_miibus, 0x, MII_PHY_ANY,
-	MII_OFFSET_ANY, 0);
-	if (LIST_FIRST(>sc_miibus.mii_phys) == NULL) {
+	mii->mii_ifp = ifp;
+	mii->mii_readreg = et_miibus_readreg;
+	mii->mii_writereg = et_miibus_writereg;
+	mii->mii_statchg = et_miibus_statchg;
+
+	sc->sc_ethercom.ec_mii = mii;
+	ifmedia_init(>mii_media, 0, et_ifmedia_upd, et_ifmedia_sts);
+	mii_attach(self, mii, 0x, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+	if (LIST_FIRST(>mii_phys) == NULL) {
 		aprint_error_dev(self, "no PHY found!\n");
-		ifmedia_add(>sc_miibus.mii_media, 

CVS commit: [netbsd-8] src/sys/dev/pci

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:10:17 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-8]: if_et.c if_etreg.h

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1329:

sys/dev/pci/if_etreg.h  1.2-1.3
sys/dev/pci/if_et.c 1.23,1.25 and 1.26
via patch

Make et(4) work:
- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
  controllable.
- Enabling TX/RX in et_init() will always fail when cable is not
  plugged in. If this happens, we delay TX/RX enablement until link is
  up.
- Modify flow control stuff a little. It still doesn't work.
- Avoid undefined behavior when reset the chip.
- Code cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.14.8.2 -r1.14.8.3 src/sys/dev/pci/if_et.c
cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/pci/if_etreg.h

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



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:14:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: process_machdep.c

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

sys/arch/amd64/amd64/process_machdep.c: revision 1.44

Do not dereference user pointer in ptrace_machdep_dorequest()/amd64

Always use copyin(9) for reading user memory.

This fixes SMAP crash on some amd64 machines.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.2.1 src/sys/arch/amd64/amd64/process_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/process_machdep.c
diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.43 src/sys/arch/amd64/amd64/process_machdep.c:1.43.2.1
--- src/sys/arch/amd64/amd64/process_machdep.c:1.43	Wed Jul 24 16:36:47 2019
+++ src/sys/arch/amd64/amd64/process_machdep.c	Tue Aug  6 16:14:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.43 2019/07/24 16:36:47 bouyer Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.43.2.1 2019/08/06 16:14:33 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43 2019/07/24 16:36:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43.2.1 2019/08/06 16:14:33 martin Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -327,14 +327,21 @@ ptrace_machdep_dorequest(
 		if (!process_machdep_validxstate(lt->l_proc))
 			return EINVAL;
 		if (__predict_false(l->l_proc->p_flag & PK_32)) {
-			struct netbsd32_iovec *user_iov = addr;
-			iov.iov_base = NETBSD32PTR64(user_iov->iov_base);
-			iov.iov_len = user_iov->iov_len;
+			struct netbsd32_iovec user_iov;
+			if ((error = copyin(addr, _iov, sizeof(user_iov)))
+			!= 0)
+return error;
+
+			iov.iov_base = NETBSD32PTR64(user_iov.iov_base);
+			iov.iov_len = user_iov.iov_len;
 		} else {
-			struct iovec *user_iov;
-			user_iov = (struct iovec*)addr;
-			iov.iov_base = user_iov->iov_base;
-			iov.iov_len = user_iov->iov_len;
+			struct iovec user_iov;
+			if ((error = copyin(addr, _iov, sizeof(user_iov)))
+			!= 0)
+return error;
+
+			iov.iov_base = user_iov.iov_base;
+			iov.iov_len = user_iov.iov_len;
 		}
 
 		error = proc_vmspace_getref(l->l_proc, );



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:14:33 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: process_machdep.c

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

sys/arch/amd64/amd64/process_machdep.c: revision 1.44

Do not dereference user pointer in ptrace_machdep_dorequest()/amd64

Always use copyin(9) for reading user memory.

This fixes SMAP crash on some amd64 machines.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.2.1 src/sys/arch/amd64/amd64/process_machdep.c

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



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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 16:20:20 UTC 2019

Modified Files:
src/sys/arch/i386/i386 [netbsd-9]: process_machdep.c

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

sys/arch/i386/i386/process_machdep.c: revision 1.94

Do not dereference user pointer in ptrace_machdep_dorequest()/i386
Always use copyin(9) for reading user memory.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/arch/i386/i386/process_machdep.c

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



CVS commit: src/sys/dev/ofw

2019-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Aug  6 18:17:52 UTC 2019

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
ofw: add of_enter_spi_devs helper method

For translating OFW child nodes of SPI controller into "spi-child-devices"
property. In similar spirit to the existing of_enter_i2c_devs method.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/ofw/openfirm.h

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



CVS commit: src/bin/ps

2019-08-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 18:07:51 UTC 2019

Modified Files:
src/bin/ps: keyword.c ps.1

Log Message:
Restore maxrss, idrss, isrss, ixrss printing in ps(1)

The RSS related statistics are now back in the NetBSD kernel.

These values were disabled since day0 until today.

libkvm(3) users will still receive inappropriate values as RSS statistics
are updated upon sysctl(3) call.

Patch submitted by 


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/ps/keyword.c
cvs rdiff -u -r1.109 -r1.110 src/bin/ps/ps.1

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

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 18:22:57 UTC 2019

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

Log Message:
Tickets #1326 - #1329


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/doc/CHANGES-8.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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.19 src/doc/CHANGES-8.2:1.1.2.20
--- src/doc/CHANGES-8.2:1.1.2.19	Mon Aug  5 14:48:29 2019
+++ src/doc/CHANGES-8.2	Tue Aug  6 18:22:57 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.19 2019/08/05 14:48:29 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.20 2019/08/06 18:22:57 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -483,3 +483,54 @@ sys/arch/i386/stand/efiboot/version		1.2
 	x86 efiboot: version 1.1.
 	[nonaka, ticket #1325]
 
+sys/dev/pci/pcidevs1.1381-1.1383
+sys/dev/pci/pcidevs.h(regen)
+sys/dev/pci/pcidevs_data.h			(regen)
+
+	- Intel C620 Virtual Switch Port for Termal Sensor is not
+	  0x37c6 but 0x37c7.
+	- Add Some AMD Ryzen 3xxx's devices.
+	- Add some AMD devices mainly taken from OpenBSD.
+	- Rename some device names for consistency.
+	- Use _HDA for HD Audio.
+	- Add BCM2711 PCIe Host bridge for RPI4
+	[msaitoh, ticket #1326]
+
+sys/dev/pci/piixpm.c1.53,1.54
+sys/dev/pci/piixpmreg.h1.8
+
+	- Add newer chipset (e.g. X370/X399 and newer) support that the PCI
+	  device id is 0x790b
+	- SB800 also support 4 ports.
+	- SB800's interrupt configuration bit is different from others.
+	  Use SB800_SMB_HOSTC's bit 0.
+	- Print "polling" correctly when in the attach function.
+	- Improve debug printf()'s.
+	- Do not bus_space_map devices which are at address 0 (it is
+	  uninitialized).
+	- Add ServerWorks HT1100 device.
+	- Use unique wait channel.
+	- Rename PIIXPM_INDIRECTIO_* to SB800_INDIRECTIO_* because those are
+	  only for SB800 and newer chipsets.
+	- Add the port number to the dmesg output.
+	[msaitoh, ticket #1327]
+
+sys/arch/x86/pci/amdsmn.c			1.4-1.6
+
+	Add support for Ryzen 2xxx and 3xxx.
+	[msaitoh, ticket #1328]
+
+sys/dev/pci/if_etreg.h1.2-1.3
+sys/dev/pci/if_et.c1.23,1.25 and 1.26 via patch
+
+	Make et(4) work:
+	- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
+	  controllable.
+	- Enabling TX/RX in et_init() will always fail when cable is not
+	  plugged in. If this happens, we delay TX/RX enablement until link is
+	  up.
+	- Modify flow control stuff a little. It still doesn't work.
+	- Avoid undefined behavior when reset the chip.
+	- Code cleanup.
+	[msaitoh, ticket #1329]
+



CVS commit: src/bin/ps

2019-08-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 18:07:51 UTC 2019

Modified Files:
src/bin/ps: keyword.c ps.1

Log Message:
Restore maxrss, idrss, isrss, ixrss printing in ps(1)

The RSS related statistics are now back in the NetBSD kernel.

These values were disabled since day0 until today.

libkvm(3) users will still receive inappropriate values as RSS statistics
are updated upon sysctl(3) call.

Patch submitted by 


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/bin/ps/keyword.c
cvs rdiff -u -r1.109 -r1.110 src/bin/ps/ps.1

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

Modified files:

Index: src/bin/ps/keyword.c
diff -u src/bin/ps/keyword.c:1.56 src/bin/ps/keyword.c:1.57
--- src/bin/ps/keyword.c:1.56	Wed Apr 11 18:52:05 2018
+++ src/bin/ps/keyword.c	Tue Aug  6 18:07:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $	*/
+/*	$NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)keyword.c	8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: keyword.c,v 1.56 2018/04/11 18:52:05 christos Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.57 2019/08/06 18:07:51 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -60,13 +60,6 @@ __RCSID("$NetBSD: keyword.c,v 1.56 2018/
 static VAR *findvar(const char *);
 static int  vcmp(const void *, const void *);
 
-#if 0 	/* kernel doesn't calculate these */
-	PUVAR("idrss", "IDRSS", 0, p_uru_idrss, UINT64, PRIu64),
-	PUVAR("isrss", "ISRSS", 0, p_uru_isrss, UINT64, PRId64),
-	PUVAR("ixrss", "IXRSS", 0, p_uru_ixrss, UINT64, PRId64),
-	PUVAR("maxrss", "MAXRSS", 0, p_uru_maxrss, UINT64, PRIu64),
-#endif
-
 /* Compute offset in common structures. */
 #define	POFF(x)	offsetof(struct kinfo_proc2, x)
 #define	LOFF(x)	offsetof(struct kinfo_lwp, x)
@@ -135,9 +128,12 @@ VAR var[] = {
 	VAR4("groups", "GROUPS", LJUST, groups),
 	/* holdcnt: unused, left for compat. */
 	LVAR("holdcnt", "HOLDCNT", 0, l_holdcnt, INT, "d"),
+	PUVAR("idrss", "IDRSS", 0, p_uru_idrss, UINT64, PRIu64),
 	VAR3("ignored", "sigignore", ALIAS),
 	PUVAR("inblk", "INBLK", 0, p_uru_inblock, UINT64, PRIu64),
 	VAR3("inblock", "inblk", ALIAS),
+	PUVAR("isrss", "ISRSS", 0, p_uru_isrss, UINT64, PRId64),
+	PUVAR("ixrss", "IXRSS", 0, p_uru_ixrss, UINT64, PRId64),
 	PVAR("jobc", "JOBC", 0, p_jobc, SHORT, "d"),
 	PVAR("ktrace", "KTRACE", 0, p_traceflag, INT, "x"),
 /*XXX*/	PVAR("ktracep", "KTRACEP", 0, p_tracep, KPTR, PRIx64),
@@ -151,6 +147,7 @@ VAR var[] = {
 	VAR4("lstate", "STAT", LJUST|LWP, lstate),
 	VAR6("ltime", "LTIME", LWP, lcputime, 0, CPUTIME),
 	PUVAR("majflt", "MAJFLT", 0, p_uru_majflt, UINT64, PRIu64),
+	PUVAR("maxrss", "MAXRSS", 0, p_uru_maxrss, UINT64, PRIu64),
 	PUVAR("minflt", "MINFLT", 0, p_uru_minflt, UINT64, PRIu64),
 	PUVAR("msgrcv", "MSGRCV", 0, p_uru_msgrcv, UINT64, PRIu64),
 	PUVAR("msgsnd", "MSGSND", 0, p_uru_msgsnd, UINT64, PRIu64),

Index: src/bin/ps/ps.1
diff -u src/bin/ps/ps.1:1.109 src/bin/ps/ps.1:1.110
--- src/bin/ps/ps.1:1.109	Mon Aug 28 05:57:37 2017
+++ src/bin/ps/ps.1	Tue Aug  6 18:07:51 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ps.1,v 1.109 2017/08/28 05:57:37 wiz Exp $
+.\"	$NetBSD: ps.1,v 1.110 2019/08/06 18:07:51 kamil Exp $
 .\"
 .\" Copyright (c) 1980, 1990, 1991, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)ps.1	8.3 (Berkeley) 4/18/94
 .\"
-.Dd August 28, 2017
+.Dd August 6, 2019
 .Dt PS 1
 .Os
 .Sh NAME
@@ -316,6 +316,8 @@ The exact time the command started, usin
 .Dq \&%c
 format described in
 .Xr strftime 3 .
+.It Ar maxrss
+the maxiumum resident set size of the process (in 1024 byte units).
 .It Ar nice
 The process scheduling increment (see
 .Xr setpriority 2 ) .
@@ -513,6 +515,12 @@ group name (from gid)
 group names (from group access list)
 .It Ar groups
 group access list
+.It Ar idrss
+integral unshared data
+.It Ar isrss
+integral unshared stack
+.It Ar ixrss
+integral shared memory size
 .It Ar inblk
 total blocks read (alias
 .Ar inblock )
@@ -543,6 +551,8 @@ symbolic LWP state
 CPU time of the LWP
 .It Ar majflt
 total page faults
+.It Ar maxrss
+maximum resident set size
 .It Ar minflt
 total page reclaims
 .It Ar msgrcv



CVS commit: [netbsd-8] src/doc

2019-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  6 18:22:57 UTC 2019

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

Log Message:
Tickets #1326 - #1329


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.19 -r1.1.2.20 src/doc/CHANGES-8.2

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



CVS commit: src/sys/sys

2019-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  7 00:39:23 UTC 2019

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

Log Message:
Welcome to 9.99.4 (the module sysctl stuff changes struct module, so
be safe and bump the kernel version).


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

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.602 src/sys/sys/param.h:1.603
--- src/sys/sys/param.h:1.602	Tue Aug  6 00:19:57 2019
+++ src/sys/sys/param.h	Wed Aug  7 00:39:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.602 2019/08/06 00:19:57 mrg Exp $	*/
+/*	$NetBSD: param.h,v 1.603 2019/08/07 00:39:23 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999000300	/* NetBSD 9.99.3 */
+#define	__NetBSD_Version__	999000400	/* NetBSD 9.99.4 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/sys

2019-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  7 00:39:23 UTC 2019

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

Log Message:
Welcome to 9.99.4 (the module sysctl stuff changes struct module, so
be safe and bump the kernel version).


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

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



CVS commit: src/lib/libc/sys

2019-08-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Aug  7 01:09:49 UTC 2019

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

Log Message:
read(2): Document ENOBUFS


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/sys/read.2

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



CVS commit: src/lib/libc/sys

2019-08-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Aug  7 01:09:49 UTC 2019

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

Log Message:
read(2): Document ENOBUFS


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/sys/read.2

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

Modified files:

Index: src/lib/libc/sys/read.2
diff -u src/lib/libc/sys/read.2:1.36 src/lib/libc/sys/read.2:1.37
--- src/lib/libc/sys/read.2:1.36	Mon Jul  3 21:32:50 2017
+++ src/lib/libc/sys/read.2	Wed Aug  7 01:09:49 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: read.2,v 1.36 2017/07/03 21:32:50 wiz Exp $
+.\"	$NetBSD: read.2,v 1.37 2019/08/07 01:09:49 roy Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)read.2	8.4 (Berkeley) 2/26/94
 .\"
-.Dd December 12, 2011
+.Dd August 07, 2019
 .Dt READ 2
 .Os
 .Sh NAME
@@ -171,6 +171,8 @@ or
 The
 .Fn readdir
 function should be used instead.
+.It Bq Er ENOBUFS
+A message was not delivered because it would have overflowed the buffer.
 .El
 .Pp
 In addition,



CVS commit: src/sys

2019-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  7 00:38:02 UTC 2019

Modified Files:
src/sys/dev: ccd.c
src/sys/dev/iscsi: iscsi_main.c
src/sys/dev/usb: usbnet.c
src/sys/kern: kern_module.c sysv_ipc.c sysv_msg.c sysv_sem.c sysv_shm.c
src/sys/miscfs/genfs: layer_vfsops.c
src/sys/sys: module.h msg.h sem.h shm.h

Log Message:
Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables.  This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data.  So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed.  We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded.  (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/ccd.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.136 -r1.137 src/sys/kern/kern_module.c \
src/sys/kern/sysv_shm.c
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sysv_ipc.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/sysv_msg.c
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/sysv_sem.c
cvs rdiff -u -r1.51 -r1.52 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/sys/module.h
cvs rdiff -u -r1.27 -r1.28 src/sys/sys/msg.h
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/sem.h
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/shm.h

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

Modified files:

Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.179 src/sys/dev/ccd.c:1.180
--- src/sys/dev/ccd.c:1.179	Wed Mar 27 19:13:34 2019
+++ src/sys/dev/ccd.c	Wed Aug  7 00:38:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ccd.c,v 1.179 2019/03/27 19:13:34 martin Exp $	*/
+/*	$NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.179 2019/03/27 19:13:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.180 2019/08/07 00:38:01 pgoyette Exp $");
 
 #include 
 #include 
@@ -216,10 +216,6 @@ static	void printiinfo(struct ccdiinfo *
 static LIST_HEAD(, ccd_softc) ccds = LIST_HEAD_INITIALIZER(ccds);
 static kmutex_t ccd_lock;
 
-#ifdef _MODULE
-static struct sysctllog *ccd_clog;
-#endif
-
 SYSCTL_SETUP_PROTO(sysctl_kern_ccd_setup);
 
 static struct ccd_softc *
@@ -1681,7 +1677,6 @@ ccd_modcmd(modcmd_t cmd, void *arg)
 
 		error = devsw_attach("ccd", _bdevsw, ,
 		_cdevsw, );
-		sysctl_kern_ccd_setup(_clog);
 #endif
 		break;
 
@@ -1696,7 +1691,6 @@ ccd_modcmd(modcmd_t cmd, void *arg)
 			error = devsw_detach(_bdevsw, _cdevsw);
 			ccddetach();
 		}
-		sysctl_teardown(_clog);
 #endif
 		break;
 

Index: src/sys/dev/iscsi/iscsi_main.c
diff -u src/sys/dev/iscsi/iscsi_main.c:1.30 src/sys/dev/iscsi/iscsi_main.c:1.31
--- src/sys/dev/iscsi/iscsi_main.c:1.30	Sat Jul 13 17:06:00 2019
+++ src/sys/dev/iscsi/iscsi_main.c	Wed Aug  7 00:38:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_main.c,v 1.30 2019/07/13 17:06:00 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_main.c,v 1.31 2019/08/07 00:38:02 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -677,7 +677,6 @@ iscsi_modcmd(modcmd_t cmd, void *arg)
 #ifdef _MODULE
 	devmajor_t cmajor = NODEVMAJOR, bmajor = NODEVMAJOR;
 	int error;
-	static struct sysctllog *clog;
 #endif
 
 	switch (cmd) {
@@ -723,8 +722,6 @@ iscsi_modcmd(modcmd_t cmd, void *arg)
 			config_cfdriver_detach(_cd);
 			return ENXIO;
 		}
-
-		sysctl_iscsi_setup();
 #endif
 		return 0;
 		break;
@@ -735,8 +732,6 @@ iscsi_modcmd(modcmd_t cmd, void *arg)
 		if (error)
 			return error;
 
-		sysctl_teardown();
-
 		config_cfattach_detach(iscsi_cd.cd_name, _ca);
 		config_cfdriver_detach(_cd);
 		devsw_detach(NULL, _cdevsw);

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.6 src/sys/dev/usb/usbnet.c:1.7
--- src/sys/dev/usb/usbnet.c:1.6	Tue Aug  6 01:42:22 2019
+++ src/sys/dev/usb/usbnet.c	Wed Aug  7 00:38:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.6 2019/08/06 01:42:22 mrg Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.7 2019/08/07 00:38:02 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 

CVS commit: src/sys

2019-08-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Aug  7 00:38:02 UTC 2019

Modified Files:
src/sys/dev: ccd.c
src/sys/dev/iscsi: iscsi_main.c
src/sys/dev/usb: usbnet.c
src/sys/kern: kern_module.c sysv_ipc.c sysv_msg.c sysv_sem.c sysv_shm.c
src/sys/miscfs/genfs: layer_vfsops.c
src/sys/sys: module.h msg.h sem.h shm.h

Log Message:
Many years ago someone created a new __link_set_sysctl_funcs to hold
the list of routines that need to be called for setting up sysctl
variables.  This worked great for all code included in the kernel
itself, but didn't deal with modules that want to create their own
sysctl data.  So, we ended up with a lot of #ifdef _MODULE blocks
so modules could explicitly call their setup functions when loaded
as non-built-in modules.

So today, we complete the task that was started so many years ago.

When modules are loaded, after we've called xxx_modcmd(INIT...) we
check if the module contains its own __link_set_sysctl_funcs, and
if so we call the functions listed.  We add a struct sysctllog member
to the struct module so we can call sysctl_teardown() when the module
gets unloaded.  (The sequence of events ensures that the sysctl stuff
doesn't get created until the rest of the module's init code does any
required memory allocation.)

So, no more need to explicitly call the sysctl setup routines when
built as a loadable module.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/ccd.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/usbnet.c
cvs rdiff -u -r1.136 -r1.137 src/sys/kern/kern_module.c \
src/sys/kern/sysv_shm.c
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sysv_ipc.c
cvs rdiff -u -r1.74 -r1.75 src/sys/kern/sysv_msg.c
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/sysv_sem.c
cvs rdiff -u -r1.51 -r1.52 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.46 -r1.47 src/sys/sys/module.h
cvs rdiff -u -r1.27 -r1.28 src/sys/sys/msg.h
cvs rdiff -u -r1.33 -r1.34 src/sys/sys/sem.h
cvs rdiff -u -r1.52 -r1.53 src/sys/sys/shm.h

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



CVS commit: src/sys/dev/usb

2019-08-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug  7 01:47:18 UTC 2019

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

Log Message:
fix two issues, found by maya@ while testing urndis:
- avoid an KASSERT() in usbnet_rx_tx_init() when called early
- move the pmf and usb driver event calls out of the mii specific code,
  now suspend is able to work on them again.

urndis port to usbnet works with additional ipv6 lossage that
may indicate it doesn't work (not commited yet.)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/usbnet.c

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



CVS commit: src/sys/dev/usb

2019-08-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Aug  7 01:47:18 UTC 2019

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

Log Message:
fix two issues, found by maya@ while testing urndis:
- avoid an KASSERT() in usbnet_rx_tx_init() when called early
- move the pmf and usb driver event calls out of the mii specific code,
  now suspend is able to work on them again.

urndis port to usbnet works with additional ipv6 lossage that
may indicate it doesn't work (not commited yet.)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/usbnet.c

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

Modified files:

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.7 src/sys/dev/usb/usbnet.c:1.8
--- src/sys/dev/usb/usbnet.c:1.7	Wed Aug  7 00:38:02 2019
+++ src/sys/dev/usb/usbnet.c	Wed Aug  7 01:47:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.7 2019/08/07 00:38:02 pgoyette Exp $	*/
+/*	$NetBSD: usbnet.c,v 1.8 2019/08/07 01:47:18 mrg Exp $	*/
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.7 2019/08/07 00:38:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.8 2019/08/07 01:47:18 mrg Exp $");
 
 #include 
 #include 
@@ -633,7 +633,7 @@ usbnet_init_rx_tx(struct usbnet * const 
 	usbnet_rx_start_pipes(un, usbnet_rxeof);
 
 	/* Indicate we are up and running. */
-	KASSERT(IFNET_LOCKED(ifp));
+	KASSERT(ifp->if_softc == NULL || IFNET_LOCKED(ifp));
 	ifp->if_flags |= IFF_RUNNING;
 
 	callout_schedule(>un_stat_ch, hz);
@@ -1055,11 +1055,6 @@ usbnet_attach_mii(struct usbnet *un, int
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_NONE);
 	} else
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_AUTO);
-
-	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, un->un_udev, un->un_dev);
-
-	if (!pmf_device_register(un->un_dev, NULL, NULL))
-		aprint_error_dev(un->un_dev, "couldn't establish power handler\n");
 }
 
 void
@@ -1107,6 +1102,11 @@ usbnet_attach_ifp(struct usbnet *un,
 		if_alloc_sadl(ifp);
 		bpf_attach(ifp, DLT_RAW, 0);
 	}
+
+	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, un->un_udev, un->un_dev);
+
+	if (!pmf_device_register(un->un_dev, NULL, NULL))
+		aprint_error_dev(un->un_dev, "couldn't establish power handler\n");
 }
 
 int



CVS commit: src/sys/uvm

2019-08-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Aug  6 08:10:27 UTC 2019

Modified Files:
src/sys/uvm: uvm_mmap.c

Log Message:
Change 'npgs' from int to size_t. Otherwise the 64bit->32bit conversion
could lead to npgs=0, which is not expected. It later triggers a panic
in uvm_vsunlock().

Found by TriforceAFL (Akul Pillai).


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/uvm/uvm_mmap.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/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.172 src/sys/uvm/uvm_mmap.c:1.173
--- src/sys/uvm/uvm_mmap.c:1.172	Sat Apr  6 03:06:29 2019
+++ src/sys/uvm/uvm_mmap.c	Tue Aug  6 08:10:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mmap.c,v 1.172 2019/04/06 03:06:29 thorpej Exp $	*/
+/*	$NetBSD: uvm_mmap.c,v 1.173 2019/08/06 08:10:27 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.172 2019/04/06 03:06:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.173 2019/08/06 08:10:27 maxv Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -132,7 +132,8 @@ sys_mincore(struct lwp *l, const struct 
 	vaddr_t start, end, lim;
 	struct vm_map *map;
 	vsize_t len;
-	int error = 0, npgs;
+	int error = 0;
+	size_t npgs;
 
 	map = >p_vmspace->vm_map;
 



CVS commit: src/sys/uvm

2019-08-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Aug  6 08:10:27 UTC 2019

Modified Files:
src/sys/uvm: uvm_mmap.c

Log Message:
Change 'npgs' from int to size_t. Otherwise the 64bit->32bit conversion
could lead to npgs=0, which is not expected. It later triggers a panic
in uvm_vsunlock().

Found by TriforceAFL (Akul Pillai).


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/uvm/uvm_mmap.c

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



CVS commit: src/sys/sys

2019-08-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 11:21:59 UTC 2019

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

Log Message:
Make EV_SET() casts compatible with the C++ code

EV_SET() handles cast that are expected to work with alternative
kqueue/kevent implementations that take arguments in different types.

Unfortunately void* -> intptr_t cast cannot be done with
static_cast() as it needs reinterpret_cast().

Just switching to reinterpret_cast() is still not sufficient as
it does not handle NULL argument without a compiler error/warning.

Add a compatibility function for the C++ case of _EV_SET() that accepts
the udata argument in the form of void* and performs clean
reinterpret_cast<>() internally.

There is no change for C users.

Tested by 

Proposed on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/sys/event.h

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

Modified files:

Index: src/sys/sys/event.h
diff -u src/sys/sys/event.h:1.32 src/sys/sys/event.h:1.33
--- src/sys/sys/event.h:1.32	Tue Jan  9 03:31:13 2018
+++ src/sys/sys/event.h	Tue Aug  6 11:21:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: event.h,v 1.32 2018/01/09 03:31:13 christos Exp $	*/
+/*	$NetBSD: event.h,v 1.33 2019/08/06 11:21:59 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999,2000,2001 Jonathan Lemon 
@@ -55,10 +55,6 @@ struct kevent {
 	intptr_t	udata;		/* opaque user data identifier */
 };
 
-#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
-_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
-(fflags), (data), __CAST(intptr_t, (udata)))
-
 static __inline void
 _EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
 uint32_t _flags, uint32_t _fflags, int64_t _data, intptr_t _udata)
@@ -71,6 +67,24 @@ _EV_SET(struct kevent *_kevp, uintptr_t 
 	_kevp->udata = _udata;
 }
 
+#ifdef __cplusplus
+#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
+_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
+(fflags), (data), (udata))
+
+static __inline void
+_EV_SET(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter,
+uint32_t _flags, uint32_t _fflags, int64_t _data, void *_udata)
+{
+	_EV_SET(_kevp, _ident, _filter, _flags, _fflags, _data,
+	reinterpret_cast(_udata));
+}
+#else
+#define EV_SET(kevp, ident, filter, flags, fflags, data, udata)	\
+_EV_SET((kevp), __CAST(uintptr_t, (ident)), (filter), (flags), \
+(fflags), (data), __CAST(intptr_t, (udata)))
+#endif
+
 /* actions */
 #define	EV_ADD		0x0001U		/* add event to kq (implies ENABLE) */
 #define	EV_DELETE	0x0002U		/* delete event from kq */



CVS commit: src/sys/sys

2019-08-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 11:21:59 UTC 2019

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

Log Message:
Make EV_SET() casts compatible with the C++ code

EV_SET() handles cast that are expected to work with alternative
kqueue/kevent implementations that take arguments in different types.

Unfortunately void* -> intptr_t cast cannot be done with
static_cast() as it needs reinterpret_cast().

Just switching to reinterpret_cast() is still not sufficient as
it does not handle NULL argument without a compiler error/warning.

Add a compatibility function for the C++ case of _EV_SET() that accepts
the udata argument in the form of void* and performs clean
reinterpret_cast<>() internally.

There is no change for C users.

Tested by 

Proposed on tech-userlevel@.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/sys/event.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/npf

2019-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 11:40:15 UTC 2019

Modified Files:
src/sys/net/npf: npf.c npf_conn.c npf_conn.h

Log Message:
- npf_conn_init(): fix a race when initialising the G/C thread.
- Fix a bug when partially initialised connection is destroyed on error.
(from rmind@)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/npf/npf.c
cvs rdiff -u -r1.28 -r1.29 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net/npf/npf_conn.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/npf

2019-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 11:40:15 UTC 2019

Modified Files:
src/sys/net/npf: npf.c npf_conn.c npf_conn.h

Log Message:
- npf_conn_init(): fix a race when initialising the G/C thread.
- Fix a bug when partially initialised connection is destroyed on error.
(from rmind@)


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/net/npf/npf.c
cvs rdiff -u -r1.28 -r1.29 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net/npf/npf_conn.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/npf/npf.c
diff -u src/sys/net/npf/npf.c:1.38 src/sys/net/npf/npf.c:1.39
--- src/sys/net/npf/npf.c:1.38	Mon Jul 22 20:52:01 2019
+++ src/sys/net/npf/npf.c	Tue Aug  6 07:40:15 2019
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.38 2019/07/23 00:52:01 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.39 2019/08/06 11:40:15 christos Exp $");
 
 #include 
 #include 
@@ -79,13 +79,17 @@ npf_create(int flags, const npf_mbufops_
 	npf_param_init(npf);
 	npf_state_sysinit(npf);
 	npf_ifmap_init(npf, ifops);
-	npf_conn_init(npf, flags);
+	npf_conn_init(npf);
 	npf_portmap_init(npf);
 	npf_alg_init(npf);
 	npf_ext_init(npf);
 
 	/* Load an empty configuration. */
 	npf_config_init(npf);
+
+	if ((flags & NPF_NO_GC) == 0) {
+		npf_worker_register(npf, npf_conn_worker);
+	}
 	return npf;
 }
 

Index: src/sys/net/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.28 src/sys/net/npf/npf_conn.c:1.29
--- src/sys/net/npf/npf_conn.c:1.28	Tue Aug  6 06:25:13 2019
+++ src/sys/net/npf/npf_conn.c	Tue Aug  6 07:40:15 2019
@@ -107,7 +107,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.28 2019/08/06 10:25:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.29 2019/08/06 11:40:15 christos Exp $");
 
 #include 
 #include 
@@ -143,14 +143,13 @@ CTASSERT(PFIL_ALL == (0x001 | 0x002));
 enum { CONN_TRACKING_OFF, CONN_TRACKING_ON };
 
 static nvlist_t *npf_conn_export(npf_t *, npf_conn_t *);
-static void npf_conn_destroy_idx(npf_t *, npf_conn_t *, unsigned);
 
 /*
  * npf_conn_sys{init,fini}: initialise/destroy connection tracking.
  */
 
 void
-npf_conn_init(npf_t *npf, int flags)
+npf_conn_init(npf_t *npf)
 {
 	npf->conn_cache[0] = pool_cache_init(
 	offsetof(npf_conn_t, c_keys[NPF_CONNKEY_V4WORDS * 2]),
@@ -162,10 +161,6 @@ npf_conn_init(npf_t *npf, int flags)
 	mutex_init(>conn_lock, MUTEX_DEFAULT, IPL_NONE);
 	npf->conn_tracking = CONN_TRACKING_OFF;
 	npf->conn_db = npf_conndb_create();
-
-	if ((flags & NPF_NO_GC) == 0) {
-		npf_worker_register(npf, npf_conn_worker);
-	}
 	npf_conndb_sysinit(npf);
 }
 
@@ -430,10 +425,11 @@ npf_conn_establish(npf_cache_t *npc, int
 
 	con->c_proto = npc->npc_proto;
 	CTASSERT(sizeof(con->c_proto) >= sizeof(npc->npc_proto));
+	con->c_alen = alen;
 
 	/* Initialize the protocol state. */
 	if (!npf_state_init(npc, >c_state)) {
-		npf_conn_destroy_idx(npf, con, idx);
+		npf_conn_destroy(npf, con);
 		return NULL;
 	}
 	KASSERT(npf_iscached(npc, NPC_IP46));
@@ -447,7 +443,7 @@ npf_conn_establish(npf_cache_t *npc, int
 	 */
 	if (!npf_conn_conkey(npc, fw, true) ||
 	!npf_conn_conkey(npc, bk, false)) {
-		npf_conn_destroy_idx(npf, con, idx);
+		npf_conn_destroy(npf, con);
 		return NULL;
 	}
 	con->c_ifid = global ? nbuf->nb_ifid : 0;
@@ -500,14 +496,8 @@ err:
 void
 npf_conn_destroy(npf_t *npf, npf_conn_t *con)
 {
-	const npf_connkey_t *key = npf_conn_getforwkey(con);
-	const unsigned alen = NPF_CONNKEY_ALEN(key);
-	npf_conn_destroy_idx(npf, con, NPF_CONNCACHE(alen));
-}
+	const unsigned idx __unused = NPF_CONNCACHE(con->c_alen);
 
-static void
-npf_conn_destroy_idx(npf_t *npf, npf_conn_t *con, unsigned idx)
-{
 	KASSERT(con->c_refcnt == 0);
 
 	if (con->c_nat) {
@@ -799,6 +789,7 @@ npf_conn_export(npf_t *npf, npf_conn_t *
 
 	fw = npf_conn_getforwkey(con);
 	alen = NPF_CONNKEY_ALEN(fw);
+	KASSERT(alen == con->c_alen);
 	bk = npf_conn_getbackkey(con, alen);
 
 	kdict = npf_connkey_export(fw);
@@ -899,7 +890,7 @@ npf_conn_import(npf_t *npf, npf_conndb_t
 	npf_conndb_enqueue(cd, con);
 	return 0;
 err:
-	npf_conn_destroy_idx(npf, con, idx);
+	npf_conn_destroy(npf, con);
 	return EINVAL;
 }
 

Index: src/sys/net/npf/npf_conn.h
diff -u src/sys/net/npf/npf_conn.h:1.16 src/sys/net/npf/npf_conn.h:1.17
--- src/sys/net/npf/npf_conn.h:1.16	Mon Jul 22 20:52:01 2019
+++ src/sys/net/npf/npf_conn.h	Tue Aug  6 07:40:15 2019
@@ -50,7 +50,8 @@ struct npf_conn {
 	 * Protocol, address length, the interface ID (if zero,
 	 * then the state is global) and connection flags.
 	 */
-	unsigned		c_proto;
+	uint16_t		c_proto;
+	uint16_t		c_alen;
 	unsigned		c_ifid;
 	unsigned		c_flags;
 
@@ -123,7 +124,7 @@ void		npf_connkey_print(const npf_connke
 /*
  * Connection tracking interface.
  */
-void		npf_conn_init(npf_t *, int);
+void		npf_conn_init(npf_t *);
 void		npf_conn_fini(npf_t 

CVS commit: xsrc/external/mit/libX11/dist/m4

2019-08-06 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Tue Aug  6 11:57:13 UTC 2019

Modified Files:
xsrc/external/mit/libX11/dist/m4: libtool.m4

Log Message:
Undo local diff in file we don't use.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libX11/dist/m4/libtool.m4

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

Modified files:

Index: xsrc/external/mit/libX11/dist/m4/libtool.m4
diff -u xsrc/external/mit/libX11/dist/m4/libtool.m4:1.6 xsrc/external/mit/libX11/dist/m4/libtool.m4:1.7
--- xsrc/external/mit/libX11/dist/m4/libtool.m4:1.6	Sun Dec 30 05:45:22 2018
+++ xsrc/external/mit/libX11/dist/m4/libtool.m4	Tue Aug  6 11:57:13 2019
@@ -2666,7 +2666,14 @@ freebsd* | dragonfly*)
 *) objformat=elf ;;
 esac
   fi
-  version_type=freebsd-$objformat
+  # Handle Gentoo/FreeBSD as it was Linux
+  case $host_vendor in
+gentoo)
+  version_type=linux ;;
+*)
+  version_type=freebsd-$objformat ;;
+  esac
+
   case $version_type in
 freebsd-elf*)
   library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
@@ -2678,6 +2685,12 @@ freebsd* | dragonfly*)
   library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
   need_version=yes
   ;;
+linux)
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  need_lib_prefix=no
+  need_version=no
+  ;;
   esac
   shlibpath_var=LD_LIBRARY_PATH
   case $host_os in
@@ -2887,18 +2900,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   dynamic_linker='GNU/Linux ld.so'
   ;;
 
-netbsdelf*-gnu)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  dynamic_linker='NetBSD ld.elf_so'
-  ;;
-
 netbsd*)
   version_type=sunos
   need_lib_prefix=no
@@ -3558,7 +3559,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu 
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
 lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
   else
@@ -4436,7 +4437,7 @@ m4_if([$1], [CXX], [
 	;;
 	esac
 	;;
-  netbsd* | netbsdelf*-gnu)
+  netbsd*)
 	;;
   *qnx* | *nto*)
 # QNX uses GNU C++, but need to define -shared option too, otherwise
@@ -4948,9 +4949,6 @@ m4_if([$1], [CXX], [
   ;;
 esac
 ;;
-  linux* | k*bsd*-gnu | gnu*)
-_LT_TAGVAR(link_all_deplibs, $1)=no
-;;
   *)
 _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
 ;;
@@ -5013,9 +5011,6 @@ dnl Note also adjust exclude_expsyms for
   openbsd* | bitrig*)
 with_gnu_ld=no
 ;;
-  linux* | k*bsd*-gnu | gnu*)
-_LT_TAGVAR(link_all_deplibs, $1)=no
-;;
   esac
 
   _LT_TAGVAR(ld_shlibs, $1)=yes
@@ -5270,7 +5265,7 @@ _LT_EOF
   fi
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
@@ -5791,7 +5786,6 @@ _LT_EOF
 	if test yes = "$lt_cv_irix_exported_symbol"; then
   _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
 	fi
-	_LT_TAGVAR(link_all_deplibs, $1)=no
   else
 	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
@@ -5813,7 +5807,7 @@ _LT_EOF
   esac
   ;;
 
-netbsd* | netbsdelf*-gnu)
+netbsd*)
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
   else



CVS commit: xsrc/external/mit/libX11/dist/m4

2019-08-06 Thread Maya Rashish
Module Name:xsrc
Committed By:   maya
Date:   Tue Aug  6 11:57:13 UTC 2019

Modified Files:
xsrc/external/mit/libX11/dist/m4: libtool.m4

Log Message:
Undo local diff in file we don't use.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/libX11/dist/m4/libtool.m4

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



CVS commit: src/sys/net/npf

2019-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 10:25:13 UTC 2019

Modified Files:
src/sys/net/npf: npf_conn.c

Log Message:
Introduce an npf_conn_destroy_idx() that can handle partially constructed
conn structures.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.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/npf/npf_conn.c
diff -u src/sys/net/npf/npf_conn.c:1.27 src/sys/net/npf/npf_conn.c:1.28
--- src/sys/net/npf/npf_conn.c:1.27	Mon Jul 22 20:52:01 2019
+++ src/sys/net/npf/npf_conn.c	Tue Aug  6 06:25:13 2019
@@ -107,7 +107,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.27 2019/07/23 00:52:01 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_conn.c,v 1.28 2019/08/06 10:25:13 christos Exp $");
 
 #include 
 #include 
@@ -143,6 +143,7 @@ CTASSERT(PFIL_ALL == (0x001 | 0x002));
 enum { CONN_TRACKING_OFF, CONN_TRACKING_ON };
 
 static nvlist_t *npf_conn_export(npf_t *, npf_conn_t *);
+static void npf_conn_destroy_idx(npf_t *, npf_conn_t *, unsigned);
 
 /*
  * npf_conn_sys{init,fini}: initialise/destroy connection tracking.
@@ -432,7 +433,7 @@ npf_conn_establish(npf_cache_t *npc, int
 
 	/* Initialize the protocol state. */
 	if (!npf_state_init(npc, >c_state)) {
-		npf_conn_destroy(npf, con);
+		npf_conn_destroy_idx(npf, con, idx);
 		return NULL;
 	}
 	KASSERT(npf_iscached(npc, NPC_IP46));
@@ -446,7 +447,7 @@ npf_conn_establish(npf_cache_t *npc, int
 	 */
 	if (!npf_conn_conkey(npc, fw, true) ||
 	!npf_conn_conkey(npc, bk, false)) {
-		npf_conn_destroy(npf, con);
+		npf_conn_destroy_idx(npf, con, idx);
 		return NULL;
 	}
 	con->c_ifid = global ? nbuf->nb_ifid : 0;
@@ -501,8 +502,12 @@ npf_conn_destroy(npf_t *npf, npf_conn_t 
 {
 	const npf_connkey_t *key = npf_conn_getforwkey(con);
 	const unsigned alen = NPF_CONNKEY_ALEN(key);
-	const unsigned idx __unused = NPF_CONNCACHE(alen);
+	npf_conn_destroy_idx(npf, con, NPF_CONNCACHE(alen));
+}
 
+static void
+npf_conn_destroy_idx(npf_t *npf, npf_conn_t *con, unsigned idx)
+{
 	KASSERT(con->c_refcnt == 0);
 
 	if (con->c_nat) {
@@ -894,7 +899,7 @@ npf_conn_import(npf_t *npf, npf_conndb_t
 	npf_conndb_enqueue(cd, con);
 	return 0;
 err:
-	npf_conn_destroy(npf, con);
+	npf_conn_destroy_idx(npf, con, idx);
 	return EINVAL;
 }
 



CVS commit: src/sys/net/npf

2019-08-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  6 10:25:13 UTC 2019

Modified Files:
src/sys/net/npf: npf_conn.c

Log Message:
Introduce an npf_conn_destroy_idx() that can handle partially constructed
conn structures.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.c

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



Re: CVS commit: src/sys/net/npf

2019-08-06 Thread Maxime Villard

Le 06/08/2019 à 12:25, Christos Zoulas a écrit :

Module Name:src
Committed By:   christos
Date:   Tue Aug  6 10:25:13 UTC 2019

Modified Files:
src/sys/net/npf: npf_conn.c

Log Message:
Introduce an npf_conn_destroy_idx() that can handle partially constructed
conn structures.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.c

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


Rmind said he had a fix and was testing it. Please revert this.


Re: CVS commit: src/sys/net/npf

2019-08-06 Thread Christos Zoulas
I did not see any messages about it, and the fix is fine until rmind comes up 
with something better.
It is not nice to have HEAD unusable for 2 weeks now (since July 22nd).

christos

> On Aug 6, 2019, at 1:26 PM, Maxime Villard  wrote:
> 
> Le 06/08/2019 à 12:25, Christos Zoulas a écrit :
>> Module Name: src
>> Committed By:christos
>> Date:Tue Aug  6 10:25:13 UTC 2019
>> Modified Files:
>>  src/sys/net/npf: npf_conn.c
>> Log Message:
>> Introduce an npf_conn_destroy_idx() that can handle partially constructed
>> conn structures.
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.27 -r1.28 src/sys/net/npf/npf_conn.c
>> Please note that diffs are not public domain; they are subject to the
>> copyright notices on the relevant files.
> 
> Rmind said he had a fix and was testing it. Please revert this.



CVS commit: src/sbin/drvctl

2019-08-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 10:45:14 UTC 2019

Modified Files:
src/sbin/drvctl: drvctl.8

Log Message:
add an example about reattaching USB devices


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/drvctl/drvctl.8

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



CVS commit: src/sbin/drvctl

2019-08-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 10:45:14 UTC 2019

Modified Files:
src/sbin/drvctl: drvctl.8

Log Message:
add an example about reattaching USB devices


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/drvctl/drvctl.8

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

Modified files:

Index: src/sbin/drvctl/drvctl.8
diff -u src/sbin/drvctl/drvctl.8:1.18 src/sbin/drvctl/drvctl.8:1.19
--- src/sbin/drvctl/drvctl.8:1.18	Sun Sep 11 02:59:11 2016
+++ src/sbin/drvctl/drvctl.8	Tue Aug  6 10:45:14 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: drvctl.8,v 1.18 2016/09/11 02:59:11 sevan Exp $
+.\" $NetBSD: drvctl.8,v 1.19 2019/08/06 10:45:14 mrg Exp $
 .\"
 .\" Copyright (c) 2004
 .\"	Matthias Drochner.  All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd September 11, 2016
+.Dd August 6, 2019
 .Dt DRVCTL 8
 .Os
 .Sh NAME
@@ -157,6 +157,24 @@ attribute:
 .Bd -literal -offset indent
 # drvctl -r -a ata_hl atabus1
 .Ed
+.Pp
+To scan for devices on a USB hub
+.Pa uhub3 ,
+that have not been discovered by normal methods (or were detached
+with the
+.Fl d
+option for
+.Nm ) ,
+need to use the
+.Qq usbifif
+or
+.Qq usbdevif
+attributes, try one or both of these:
+.Bd -literal -offset indent
+# drvctl -r -a usbifif uhub3
+# drvctl -r -a usbdevif uhub3
+.Ed
+.Pp
 .Sh SEE ALSO
 .Xr proplib 3 ,
 .Xr drvctl 4 ,



re: CVS commit: src/sys/uvm

2019-08-06 Thread matthew green
"Maxime Villard" writes:
> Module Name:  src
> Committed By: maxv
> Date: Tue Aug  6 08:10:27 UTC 2019
> 
> Modified Files:
>   src/sys/uvm: uvm_mmap.c
> 
> Log Message:
> Change 'npgs' from int to size_t. Otherwise the 64bit->32bit conversion
> could lead to npgs=0, which is not expected. It later triggers a panic
> in uvm_vsunlock().
> 
> Found by TriforceAFL (Akul Pillai).

ah, and so we begin the task of making UVM handle more than 
31 bits of page number :-)


.mrg.