CVS commit: src/doc

2023-12-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec 23 07:36:54 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
postfix-3.7.9 out


To generate a diff of this commit:
cvs rdiff -u -r1.1970 -r1.1971 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1970 src/doc/3RDPARTY:1.1971
--- src/doc/3RDPARTY:1.1970	Fri Dec 22 17:25:53 2023
+++ src/doc/3RDPARTY	Sat Dec 23 07:36:54 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1970 2023/12/22 17:25:53 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1971 2023/12/23 07:36:54 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1230,7 +1230,7 @@ now to do a new import.
 
 Package:	Postfix
 Version:	3.7.3
-Current Vers:	3.7.8/3.8.4
+Current Vers:	3.7.9/3.8.4
 Maintainer:	Wietse Venema 
 Archive Site:
 Home Page:	http://www.postfix.org/



CVS commit: src/doc

2023-12-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Dec 23 07:36:54 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
postfix-3.7.9 out


To generate a diff of this commit:
cvs rdiff -u -r1.1970 -r1.1971 src/doc/3RDPARTY

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



CVS commit: src/sys/arch

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:53:47 UTC 2023

Modified Files:
src/sys/arch/sun2/sun2: pmap.c
src/sys/arch/sun3/sun3: pmap.c

Log Message:
pv_link(): Seed pv_flags for the page with PG_MOD and PG_REF if
the caller pre-set those bits in the PTE (which pmap_enter() does,
based on hints from uvm_fault()), avoiding the slow path in
pmap_is_{referenced,modified}().


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sun2/sun2/pmap.c
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/sun3/sun3/pmap.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/sun2/sun2/pmap.c
diff -u src/sys/arch/sun2/sun2/pmap.c:1.50 src/sys/arch/sun2/sun2/pmap.c:1.51
--- src/sys/arch/sun2/sun2/pmap.c:1.50	Fri Jun  2 08:51:47 2023
+++ src/sys/arch/sun2/sun2/pmap.c	Fri Dec 22 19:53:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.50 2023/06/02 08:51:47 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.51 2023/12/22 19:53:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.50 2023/06/02 08:51:47 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.51 2023/12/22 19:53:47 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pmap_debug.h"
@@ -1349,15 +1349,15 @@ pv_link(pmap_t pmap, int pte, vaddr_t va
 			panic("pv_link: duplicate entry for PA=0x%lx", pa);
 	}
 #endif
-#ifdef HAVECACHE
 
+	/* Only the non-cached bit is of interest here. */
+	int flags = (pte & (PG_NC | PG_MODREF)) >> PV_SHIFT;
+	*pv_flags |= flags;
+
+#ifdef HAVECACHE
 	/*
 	 * Does this new mapping cause VAC alias problems?
 	 */
-	/* Only the non-cached bit is of interest here. */
-	int flags = (pte & PG_NC) ? PV_NC : 0;
-
-	*pv_flags |= flags;
 	if ((*pv_flags & PV_NC) == 0) {
 		for (pv = *head; pv != NULL; pv = pv->pv_next) {
 			if (BADALIAS(va, pv->pv_va)) {

Index: src/sys/arch/sun3/sun3/pmap.c
diff -u src/sys/arch/sun3/sun3/pmap.c:1.175 src/sys/arch/sun3/sun3/pmap.c:1.176
--- src/sys/arch/sun3/sun3/pmap.c:1.175	Sun Dec 17 13:28:59 2023
+++ src/sys/arch/sun3/sun3/pmap.c	Fri Dec 22 19:53:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.175 2023/12/17 13:28:59 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.176 2023/12/22 19:53:47 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.175 2023/12/17 13:28:59 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.176 2023/12/22 19:53:47 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pmap_debug.h"
@@ -1356,15 +1356,14 @@ pv_link(pmap_t pmap, int pte, vaddr_t va
 			panic("pv_link: duplicate entry for PA=0x%lx", pa);
 	}
 #endif
-#ifdef HAVECACHE
 
+	flags = (pte & (PG_NC | PG_MODREF)) >> PV_SHIFT;
+	*pv_flags |= flags;
+
+#ifdef HAVECACHE
 	/*
 	 * Does this new mapping cause VAC alias problems?
 	 */
-
-	/* Only the non-cached bit is of interest here. */
-	flags = (pte & PG_NC) ? PV_NC : 0;
-	*pv_flags |= flags;
 	if ((*pv_flags & PV_NC) == 0) {
 		for (pv = *head; pv != NULL; pv = pv->pv_next) {
 			if (BADALIAS(va, pv->pv_va)) {



CVS commit: src/sys/arch

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:53:47 UTC 2023

Modified Files:
src/sys/arch/sun2/sun2: pmap.c
src/sys/arch/sun3/sun3: pmap.c

Log Message:
pv_link(): Seed pv_flags for the page with PG_MOD and PG_REF if
the caller pre-set those bits in the PTE (which pmap_enter() does,
based on hints from uvm_fault()), avoiding the slow path in
pmap_is_{referenced,modified}().


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/sun2/sun2/pmap.c
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/sun3/sun3/pmap.c

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



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:14:57 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
pmap_is_modified(): If we fall into the slow path and encounter a modified
page during PV list walk, set PG_M in the pvh_attrs to avoid falling into
the slow path again.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.200 src/sys/arch/vax/vax/pmap.c:1.201
--- src/sys/arch/vax/vax/pmap.c:1.200	Fri Dec 22 17:55:49 2023
+++ src/sys/arch/vax/vax/pmap.c	Fri Dec 22 19:14:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $	   */
+/*	$NetBSD: pmap.c,v 1.201 2023/12/22 19:14:57 thorpej Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.201 2023/12/22 19:14:57 thorpej Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -1474,6 +1474,7 @@ pmap_is_modified(struct vm_page *pg)
 		if (pte[0].pg_m | pte[1].pg_m | pte[2].pg_m | pte[3].pg_m
 		| pte[4].pg_m | pte[5].pg_m | pte[6].pg_m | pte[7].pg_m) {
 			rv = true;
+			SET(pv->pv_attr, PG_M);
 			break;
 		}
 	} while ((pv = pv->pv_next) != NULL);



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 19:14:57 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
pmap_is_modified(): If we fall into the slow path and encounter a modified
page during PV list walk, set PG_M in the pvh_attrs to avoid falling into
the slow path again.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/vax/pmap.c

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



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 17:55:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
rmspace(): when a PT page is put back onto the free list, invalidate
it's VA in the TB.

rmptep(): Add a comment that the no TIBS is needed for newly-freed PT
pages here because all of the callers perform a TBIA.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/pmap.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/vax/vax/pmap.c
diff -u src/sys/arch/vax/vax/pmap.c:1.199 src/sys/arch/vax/vax/pmap.c:1.200
--- src/sys/arch/vax/vax/pmap.c:1.199	Thu Dec 21 09:09:43 2023
+++ src/sys/arch/vax/vax/pmap.c	Fri Dec 22 17:55:49 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $	   */
+/*	$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $	   */
 /*
  * Copyright (c) 1994, 1998, 1999, 2003 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2023/12/21 09:09:43 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.200 2023/12/22 17:55:49 thorpej Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -633,6 +633,7 @@ rmspace(struct pmap *pm)
 		}
 		free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 		*ptpp = 0;
+		mtpr((vaddr_t)br, PR_TBIS);
 	}
 	lr = pm->pm_p1lr/NPTEPG;
 	for (i = lr; i < NPTEPERREG/NPTEPG; i++) {
@@ -647,6 +648,7 @@ rmspace(struct pmap *pm)
 		}
 		free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 		*ptpp = 0;
+		mtpr((vaddr_t)br, PR_TBIS);
 	}
 
 	if (pm->pm_p0lr != 0)
@@ -772,6 +774,7 @@ rmptep(struct pte *pte)
 #endif
 	free_ptpstruct pte *)ptpp)->pg_pfn << VAX_PGSHIFT));
 	*ptpp = 0;
+	/* N.B. callers all do a TBIA, so TBIS not needed here. */
 }
 
 static int



CVS commit: src/sys/arch/vax/vax

2023-12-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Dec 22 17:55:49 UTC 2023

Modified Files:
src/sys/arch/vax/vax: pmap.c

Log Message:
rmspace(): when a PT page is put back onto the free list, invalidate
it's VA in the TB.

rmptep(): Add a comment that the no TIBS is needed for newly-freed PT
pages here because all of the callers perform a TBIA.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/vax/vax/pmap.c

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



CVS commit: src/doc

2023-12-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Dec 22 17:25:53 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
postfix-3.8.4 out


To generate a diff of this commit:
cvs rdiff -u -r1.1969 -r1.1970 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1969 src/doc/3RDPARTY:1.1970
--- src/doc/3RDPARTY:1.1969	Wed Dec 20 17:19:15 2023
+++ src/doc/3RDPARTY	Fri Dec 22 17:25:53 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1969 2023/12/20 17:19:15 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1970 2023/12/22 17:25:53 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1230,7 +1230,7 @@ now to do a new import.
 
 Package:	Postfix
 Version:	3.7.3
-Current Vers:	3.7.8/3.8.3
+Current Vers:	3.7.8/3.8.4
 Maintainer:	Wietse Venema 
 Archive Site:
 Home Page:	http://www.postfix.org/



CVS commit: src/doc

2023-12-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Dec 22 17:25:53 UTC 2023

Modified Files:
src/doc: 3RDPARTY

Log Message:
postfix-3.8.4 out


To generate a diff of this commit:
cvs rdiff -u -r1.1969 -r1.1970 src/doc/3RDPARTY

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



CVS commit: [netbsd-10] src/doc

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 13:51:13 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #513 and #514


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.174 -r1.1.2.175 src/doc/CHANGES-10.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-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.174 src/doc/CHANGES-10.0:1.1.2.175
--- src/doc/CHANGES-10.0:1.1.2.174	Tue Dec 19 12:39:01 2023
+++ src/doc/CHANGES-10.0	Fri Dec 22 13:51:13 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.174 2023/12/19 12:39:01 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.175 2023/12/22 13:51:13 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -14424,3 +14424,13 @@ sys/arch/netwinder/conf/std.netwinder		1
 	netwinder: make GENERIC kernel bootable again.
 	[uwe, ticket #510]
 
+Makefile	1.338
+
+	Makefile: Run `postinstall -d /', not `postinstall -d //'.
+	[riastradh, ticket #513]
+
+sys/arch/xen/xen/xennetback_xenbus.c		1.124 (patch)
+
+	xennet(4) backend: sanity check the fragments we get from the guest.
+	[bouyer, ticket #514]
+



CVS commit: [netbsd-10] src/doc

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 13:51:13 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #513 and #514


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.174 -r1.1.2.175 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/sys/arch/xen/xen

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 13:48:59 UTC 2023

Modified Files:
src/sys/arch/xen/xen [netbsd-10]: xennetback_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #514):

sys/arch/xen/xen/xennetback_xenbus.c: revision 1.124 (patch)

sanity check the fragments we get from the guest and reject the whole packet
if it fails. Make sure we don't KASSERT() on data we get from the frontend.


To generate a diff of this commit:
cvs rdiff -u -r1.108.4.2 -r1.108.4.3 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.108.4.2 src/sys/arch/xen/xen/xennetback_xenbus.c:1.108.4.3
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.108.4.2	Fri Aug  4 19:53:43 2023
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Fri Dec 22 13:48:59 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.108.4.2 2023/08/04 19:53:43 martin Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.108.4.3 2023/12/22 13:48:59 martin Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.108.4.2 2023/08/04 19:53:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.108.4.3 2023/12/22 13:48:59 martin Exp $");
 
 #include 
 #include 
@@ -615,7 +615,7 @@ xennetback_tx_response(struct xnetback_i
 }
 
 static const char *
-xennetback_tx_check_packet(const netif_tx_request_t *txreq)
+xennetback_tx_check_packet(const netif_tx_request_t *txreq, bool first)
 {
 	if (__predict_false((txreq->flags & NETTXF_more_data) == 0 &&
 	txreq->offset + txreq->size > PAGE_SIZE))
@@ -624,6 +624,10 @@ xennetback_tx_check_packet(const netif_t
 	if (__predict_false(txreq->size > ETHER_MAX_LEN_JUMBO))
 		return "bigger then jumbo";
 
+	if (first &&
+	__predict_false(txreq->size < ETHER_HDR_LEN))
+		return "too short";
+
 	return NULL;
 }
 
@@ -788,7 +792,11 @@ xennetback_tx_m0len_fragment(struct xnet
 	*cntp = 1;
 	do {
 		txreq = RING_GET_REQUEST(>xni_txring, req_cons);
-		KASSERT(m0_len > txreq->size);
+		if (m0_len <= txreq->size || *cntp > XEN_NETIF_NR_SLOTS_MIN)
+			return -1;
+		if (RING_REQUEST_CONS_OVERFLOW(>xni_txring, req_cons))
+			return -1;
+			
 		m0_len -= txreq->size;
 		req_cons++;
 		(*cntp)++;
@@ -808,8 +816,9 @@ xennetback_evthandler(void *arg)
 	RING_IDX req_cons;
 	int queued = 0, m0_len = 0;
 	struct xnetback_xstate *xst;
-	const bool discard = ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+	const bool nupnrun = ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
 	(IFF_UP | IFF_RUNNING));
+	bool discard = 0;
 
 	XENPRINTF(("xennetback_evthandler "));
 	req_cons = xneti->xni_txring.req_cons;
@@ -827,9 +836,10 @@ xennetback_evthandler(void *arg)
 		XENPRINTF(("%s pkt size %d\n", xneti->xni_if.if_xname,
 		txreq.size));
 		req_cons++;
-		if (__predict_false(discard)) {
+		if (__predict_false(nupnrun || discard)) {
 			/* interface not up, drop all requests */
 			if_statinc(ifp, if_iqdrops);
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
 			continue;
@@ -838,10 +848,12 @@ xennetback_evthandler(void *arg)
 		/*
 		 * Do some sanity checks, and queue copy of the data.
 		 */
-		const char *msg = xennetback_tx_check_packet();
+		const char *msg = xennetback_tx_check_packet(,
+		m0 == NULL);
 		if (__predict_false(msg != NULL)) {
 			printf("%s: packet with size %d is %s\n",
 			ifp->if_xname, txreq.size, msg);
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_ERROR);
 			if_statinc(ifp, if_ierrors);
@@ -859,6 +871,7 @@ mbuf_fail:
 			xennetback_tx_copy_abort(ifp, xneti, queued);
 			queued = 0;
 			m0 = NULL;
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
 			if_statinc(ifp, if_ierrors);
@@ -876,6 +889,14 @@ mbuf_fail:
 			int cnt;
 			m0_len = xennetback_tx_m0len_fragment(xneti,
 			txreq.size, req_cons, );
+			if (m0_len < 0) {
+m_freem(m);
+discard = 1;
+xennetback_tx_response(xneti, txreq.id,
+NETIF_RSP_DROPPED);
+if_statinc(ifp, if_ierrors);
+continue;
+			}
 			m->m_len = m0_len;
 			KASSERT(cnt <= XEN_NETIF_NR_SLOTS_MIN);
 
@@ -884,7 +905,6 @@ mbuf_fail:
  * Flush queue if too full to fit this
  * new packet whole.
  */
-KASSERT(m0 == NULL);
 xennetback_tx_copy_process(ifp, xneti, queued);
 queued = 0;
 			}



CVS commit: [netbsd-10] src/sys/arch/xen/xen

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 13:48:59 UTC 2023

Modified Files:
src/sys/arch/xen/xen [netbsd-10]: xennetback_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #514):

sys/arch/xen/xen/xennetback_xenbus.c: revision 1.124 (patch)

sanity check the fragments we get from the guest and reject the whole packet
if it fails. Make sure we don't KASSERT() on data we get from the frontend.


To generate a diff of this commit:
cvs rdiff -u -r1.108.4.2 -r1.108.4.3 src/sys/arch/xen/xen/xennetback_xenbus.c

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



CVS commit: [netbsd-10] src

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 11:33:31 UTC 2023

Modified Files:
src [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #513):

Makefile: revision 1.338

Makefile: Run `postinstall -d /', not `postinstall -d //'.

This happens when doing `build.sh install=/'.  The message is less
confusing and it makes postinstall's job simpler for detecting when
it's installing to / rather than somewhere else.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.335.2.1 src/Makefile

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.335 src/Makefile:1.335.2.1
--- src/Makefile:1.335	Sun Aug 21 07:10:03 2022
+++ src/Makefile	Fri Dec 22 11:33:31 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.335 2022/08/21 07:10:03 lukem Exp $
+#	$NetBSD: Makefile,v 1.335.2.1 2023/12/22 11:33:31 martin Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -190,23 +190,23 @@ _POSTINSTALL_X11=-x ${X11SRCDIR:Q}
 
 postinstall-check: .PHONY
 	@echo "   === Post installation checks ==="
-	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ check; if [ $$? -gt 1 ]; then exit 1; fi
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ check; if [ $$? -gt 1 ]; then exit 1; fi
 	@echo "   "
 
 postinstall-fix: .NOTMAIN .PHONY
 	@echo "   === Post installation fixes ==="
-	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix
 	@echo "   ==="
 
 postinstall-fix-obsolete: .NOTMAIN .PHONY
 	@echo "   === Removing obsolete files ==="
-	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete
 	@echo "   ==="
 
 postinstall-fix-obsolete_stand: .NOTMAIN .PHONY
 	@echo "   === Removing obsolete files ==="
-	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand
-	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR}/ fix obsolete_stand_debug
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand
+	${_POSTINSTALL_ENV} ${HOST_SH} ${_POSTINSTALL} -s ${.CURDIR} ${_POSTINSTALL_X11} -d ${DESTDIR:C/^\/$//}/ fix obsolete_stand_debug
 	@echo "   ==="
 
 



CVS commit: [netbsd-10] src

2023-12-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 22 11:33:31 UTC 2023

Modified Files:
src [netbsd-10]: Makefile

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #513):

Makefile: revision 1.338

Makefile: Run `postinstall -d /', not `postinstall -d //'.

This happens when doing `build.sh install=/'.  The message is less
confusing and it makes postinstall's job simpler for detecting when
it's installing to / rather than somewhere else.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.335.2.1 src/Makefile

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



CVS commit: src/sys/arch/xen/xen

2023-12-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Dec 22 10:22:00 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
sanity check the fragments we get from the guest and reject the whole packet
if it fails. Make sure we don't KASSERT() on data we get from the frontend.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.123 src/sys/arch/xen/xen/xennetback_xenbus.c:1.124
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.123	Wed Aug  9 08:38:57 2023
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Fri Dec 22 10:22:00 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.123 2023/08/09 08:38:57 riastradh Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.124 2023/12/22 10:22:00 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.123 2023/08/09 08:38:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.124 2023/12/22 10:22:00 bouyer Exp $");
 
 #include 
 #include 
@@ -613,7 +613,7 @@ xennetback_tx_response(struct xnetback_i
 }
 
 static const char *
-xennetback_tx_check_packet(const netif_tx_request_t *txreq)
+xennetback_tx_check_packet(const netif_tx_request_t *txreq, bool first)
 {
 	if (__predict_false((txreq->flags & NETTXF_more_data) == 0 &&
 	txreq->offset + txreq->size > PAGE_SIZE))
@@ -622,6 +622,10 @@ xennetback_tx_check_packet(const netif_t
 	if (__predict_false(txreq->size > ETHER_MAX_LEN_JUMBO))
 		return "bigger then jumbo";
 
+	if (first &&
+	__predict_false(txreq->size < ETHER_HDR_LEN))
+		return "too short";
+
 	return NULL;
 }
 
@@ -786,7 +790,11 @@ xennetback_tx_m0len_fragment(struct xnet
 	*cntp = 1;
 	do {
 		txreq = RING_GET_REQUEST(>xni_txring, req_cons);
-		KASSERT(m0_len > txreq->size);
+		if (m0_len <= txreq->size || *cntp > XEN_NETIF_NR_SLOTS_MIN)
+			return -1;
+		if (RING_REQUEST_CONS_OVERFLOW(>xni_txring, req_cons))
+			return -1;
+			
 		m0_len -= txreq->size;
 		req_cons++;
 		(*cntp)++;
@@ -805,8 +813,9 @@ xennetback_evthandler(void *arg)
 	int receive_pending;
 	int queued = 0, m0_len = 0;
 	struct xnetback_xstate *xst;
-	const bool discard = ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+	const bool nupnrun = ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
 	(IFF_UP | IFF_RUNNING));
+	bool discard = 0;
 
 	XENPRINTF(("xennetback_evthandler "));
 again:
@@ -824,9 +833,10 @@ again:
 		XENPRINTF(("%s pkt size %d\n", xneti->xni_if.if_xname,
 		txreq.size));
 		xneti->xni_txring.req_cons++;
-		if (__predict_false(discard)) {
+		if (__predict_false(nupnrun || discard)) {
 			/* interface not up, drop all requests */
 			if_statinc(ifp, if_iqdrops);
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
 			continue;
@@ -835,10 +845,12 @@ again:
 		/*
 		 * Do some sanity checks, and queue copy of the data.
 		 */
-		const char *msg = xennetback_tx_check_packet();
+		const char *msg = xennetback_tx_check_packet(,
+		m0 == NULL);
 		if (__predict_false(msg != NULL)) {
 			printf("%s: packet with size %d is %s\n",
 			ifp->if_xname, txreq.size, msg);
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_ERROR);
 			if_statinc(ifp, if_ierrors);
@@ -856,6 +868,7 @@ mbuf_fail:
 			xennetback_tx_copy_abort(ifp, xneti, queued);
 			queued = 0;
 			m0 = NULL;
+			discard = (txreq.flags & NETTXF_more_data) != 0;
 			xennetback_tx_response(xneti, txreq.id,
 			NETIF_RSP_DROPPED);
 			if_statinc(ifp, if_ierrors);
@@ -873,6 +886,14 @@ mbuf_fail:
 			int cnt;
 			m0_len = xennetback_tx_m0len_fragment(xneti,
 			txreq.size, xneti->xni_txring.req_cons, );
+			if (m0_len < 0) {
+m_freem(m);
+discard = 1;
+xennetback_tx_response(xneti, txreq.id,
+NETIF_RSP_DROPPED);
+if_statinc(ifp, if_ierrors);
+continue;
+			}
 			m->m_len = m0_len;
 			KASSERT(cnt <= XEN_NETIF_NR_SLOTS_MIN);
 
@@ -881,7 +902,6 @@ mbuf_fail:
  * Flush queue if too full to fit this
  * new packet whole.
  */
-KASSERT(m0 == NULL);
 xennetback_tx_copy_process(ifp, xneti, queued);
 queued = 0;
 			}



CVS commit: src/sys/arch/xen/xen

2023-12-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Fri Dec 22 10:22:00 UTC 2023

Modified Files:
src/sys/arch/xen/xen: xennetback_xenbus.c

Log Message:
sanity check the fragments we get from the guest and reject the whole packet
if it fails. Make sure we don't KASSERT() on data we get from the frontend.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/xen/xen/xennetback_xenbus.c

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



CVS commit: src/sys/arch/riscv/riscv

2023-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 22 08:41:59 UTC 2023

Modified Files:
src/sys/arch/riscv/riscv: db_interface.c riscv_machdep.c

Log Message:
Minor stylistic changes. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/riscv/riscv/riscv_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/riscv/riscv/db_interface.c
diff -u src/sys/arch/riscv/riscv/db_interface.c:1.4 src/sys/arch/riscv/riscv/db_interface.c:1.5
--- src/sys/arch/riscv/riscv/db_interface.c:1.4	Sun Sep  3 08:48:20 2023
+++ src/sys/arch/riscv/riscv/db_interface.c	Fri Dec 22 08:41:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.4 2023/09/03 08:48:20 skrll Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.5 2023/12/22 08:41:59 skrll Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.4 2023/09/03 08:48:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.5 2023/12/22 08:41:59 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -88,8 +88,6 @@ paddr_t kvtophys(vaddr_t);
 int
 kdb_trap(int type, db_regs_t *regs)
 {
-	int s;
-
 	switch (type) {
 	case CAUSE_BREAKPOINT:	/* breakpoint */
 		printf("kernel: breakpoint\n");
@@ -106,7 +104,7 @@ kdb_trap(int type, db_regs_t *regs)
 		break;
 	}
 
-	s = splhigh();
+	const int s = splhigh();
 	struct cpu_info * const ci = curcpu();
 
 #if defined(MULTIPROCESSOR)
@@ -130,9 +128,9 @@ kdb_trap(int type, db_regs_t *regs)
 	ddb_regs = *regs;
 	ci->ci_ddb_regs = _regs;
 	db_active++;
-	cnpollc(1);
+	cnpollc(true);
 	db_trap(type, 0 /*code*/);
-	cnpollc(0);
+	cnpollc(false);
 	db_active--;
 	ci->ci_ddb_regs = NULL;
 	*regs = ddb_regs;

Index: src/sys/arch/riscv/riscv/riscv_machdep.c
diff -u src/sys/arch/riscv/riscv/riscv_machdep.c:1.34 src/sys/arch/riscv/riscv/riscv_machdep.c:1.35
--- src/sys/arch/riscv/riscv/riscv_machdep.c:1.34	Sun Sep  3 08:48:20 2023
+++ src/sys/arch/riscv/riscv/riscv_machdep.c	Fri Dec 22 08:41:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: riscv_machdep.c,v 1.34 2023/09/03 08:48:20 skrll Exp $	*/
+/*	$NetBSD: riscv_machdep.c,v 1.35 2023/12/22 08:41:59 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2019, 2022 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_riscv_debug.h"
 
 #include 
-__RCSID("$NetBSD: riscv_machdep.c,v 1.34 2023/09/03 08:48:20 skrll Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.35 2023/12/22 08:41:59 skrll Exp $");
 
 #include 
 
@@ -460,13 +460,13 @@ cpu_reboot(int howto, char *bootstr)
 		printf("\n");
 		printf("The operating system has halted.\n");
 		printf("Please press any key to reboot.\n\n");
-		cnpollc(1);	/* for proper keyboard command handling */
+		cnpollc(true);	/* for proper keyboard command handling */
 		if (cngetc() == 0) {
 			/* no console attached, so just hlt */
 			printf("No keyboard - cannot reboot after all.\n");
 			goto spin;
 		}
-		cnpollc(0);
+		cnpollc(false);
 	}
 
 	printf("rebooting...\n");



CVS commit: src/sys/arch/riscv/riscv

2023-12-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Dec 22 08:41:59 UTC 2023

Modified Files:
src/sys/arch/riscv/riscv: db_interface.c riscv_machdep.c

Log Message:
Minor stylistic changes. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/riscv/riscv/db_interface.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/riscv/riscv/riscv_machdep.c

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