CVS commit: src/share/man/man4

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 01:00:34 UTC 2020

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

Log Message:
Remove obsolete paragraph.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/hifn.4

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

Modified files:

Index: src/share/man/man4/hifn.4
diff -u src/share/man/man4/hifn.4:1.9 src/share/man/man4/hifn.4:1.10
--- src/share/man/man4/hifn.4:1.9	Fri Jun 15 23:11:56 2018
+++ src/share/man/man4/hifn.4	Sun May 17 01:00:34 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: hifn.4,v 1.9 2018/06/15 23:11:56 wiz Exp $
+.\"	$NetBSD: hifn.4,v 1.10 2020/05/17 01:00:34 riastradh Exp $
 .\"	$OpenBSD: hifn.4,v 1.32 2002/09/26 07:55:40 miod Exp $
 .\"	$FreeBSD: src/share/man/man4/hifn.4,v 1.1.2.2 2003/10/08 23:57:50 sam Exp $
 .\"
@@ -109,11 +109,6 @@ compression, the 9751-based cards are no
 .Pp
 Support for the 7955 and 7956 is incomplete; the asymmetric crypto
 facilities are to be added and the performance is suboptimal.
-.Pp
-Supplying data to the kernel
-.Xr rnd 4
-subsystem has been disabled, pending verification that the on-chip
-RNG is statistically adequate.
 .Sh BUGS
 The 7751 chip starts out at initialization by only supporting compression.
 A proprietary algorithm, which has been reverse engineered, is required to



CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:54:05 UTC 2020

Modified Files:
src/sys/dev/pci: hifn7751.c hifn7751var.h

Log Message:
Rework hifn(4) RNG logic.

Previously we would read 34 bits of entropy into the pool and stop,
never to try again.  This change finishes the conversion to an
on-demand source, although we still use a callout to (a) try again in
another second if the 7811 FIFO was emptied, and (b) wait at least
0.4 sec after we start the RNG to read anything from it as the
alleged documentation allegedly recommends.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/pci/hifn7751var.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.71 src/sys/dev/pci/hifn7751.c:1.72
--- src/sys/dev/pci/hifn7751.c:1.71	Sun May 17 00:53:09 2020
+++ src/sys/dev/pci/hifn7751.c	Sun May 17 00:54:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.71 2020/05/17 00:53:09 riastradh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.72 2020/05/17 00:54:05 riastradh Exp $	*/
 /*	$OpenBSD: hifn7751.c,v 1.179 2020/01/11 21:34:03 cheloha Exp $	*/
 
 /*
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.71 2020/05/17 00:53:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.72 2020/05/17 00:54:05 riastradh Exp $");
 
 #include 
 #include 
@@ -119,8 +119,8 @@ static int	hifn_dmamap_load_src(struct h
 static int	hifn_dmamap_load_dst(struct hifn_softc *,
  struct hifn_command *);
 static int	hifn_init_pubrng(struct hifn_softc *);
-static void	hifn_rng(void *);
-static void	hifn_rng_locked(void *);
+static void	hifn_rng(struct hifn_softc *);
+static void	hifn_rng_intr(void *);
 static void	hifn_tick(void *);
 static void	hifn_abort(struct hifn_softc *);
 static void	hifn_alloc_slot(struct hifn_softc *, int *, int *, int *,
@@ -535,10 +535,25 @@ static void
 hifn_rng_get(size_t bytes, void *priv)
 {
 	struct hifn_softc *sc = priv;
+	struct timeval delta = {0, 40};
+	struct timeval now, oktime, wait;
+
+	/*
+	 * Wait until 0.4 seconds after we start up the RNG to read
+	 * anything out of it.  If the time hasn't elapsed, schedule a
+	 * callout later on.
+	 */
+	microtime();
 
 	mutex_enter(>sc_mtx);
-	sc->sc_rng_need = bytes;
-	callout_reset(>sc_rngto, 0, hifn_rng, sc);
+	sc->sc_rng_needbits = MAX(sc->sc_rng_needbits, NBBY*bytes);
+	timeradd(>sc_rngboottime, , );
+	if (timercmp(, , <=)) {
+		hifn_rng(sc);
+	} else if (!callout_pending(>sc_rngto)) {
+		timersub(, , );
+		callout_schedule(>sc_rngto, MAX(1, tvtohz()));
+	}
 	mutex_exit(>sc_mtx);
 }
 
@@ -591,16 +606,12 @@ hifn_init_pubrng(struct hifn_softc *sc)
 		 * data that meet their worst-case estimate of 0.06
 		 * bits of random data per output register bit.
 		 */
-		DELAY(4000);
-
-		if (hz >= 100)
-			sc->sc_rnghz = hz / 100;
-		else
-			sc->sc_rnghz = 1;
+		microtime(>sc_rngboottime);
 		callout_init(>sc_rngto, CALLOUT_MPSAFE);
+		callout_setfunc(>sc_rngto, hifn_rng_intr, sc);
 		rndsource_setcb(>sc_rnd_source, hifn_rng_get, sc);
 		rnd_attach_source(>sc_rnd_source, device_xname(sc->sc_dv),
-		RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
+		RND_TYPE_RNG, RND_FLAG_DEFAULT|RND_FLAG_HASCB);
 	}
 
 	/* Enable public key engine, if available */
@@ -614,25 +625,20 @@ hifn_init_pubrng(struct hifn_softc *sc)
 }
 
 static void
-hifn_rng_locked(void *vsc)
+hifn_rng(struct hifn_softc *sc)
 {
-	struct hifn_softc *sc = vsc;
-	uint32_t num[64];
-	uint32_t sts;
-	int i;
-	size_t got, gotent;
+	uint32_t entropybits;
 
-	if (sc->sc_rng_need < 1) {
-		callout_stop(>sc_rngto);
-		return;
-	}
+	KASSERT(mutex_owned(>sc_mtx));
 
 	if (sc->sc_flags & HIFN_IS_7811) {
-		for (i = 0; i < 5; i++) {	/* XXX why 5? */
+		while (sc->sc_rng_needbits) {
+			uint32_t num[2];
+			uint32_t sts;
+
 			sts = READ_REG_1(sc, HIFN_1_7811_RNGSTS);
 			if (sts & HIFN_7811_RNGSTS_UFL) {
-printf("%s: RNG underflow: disabling\n",
-device_xname(sc->sc_dv));
+device_printf(sc->sc_dv, "RNG underflow\n");
 return;
 			}
 			if ((sts & HIFN_7811_RNGSTS_RDY) == 0)
@@ -644,23 +650,18 @@ hifn_rng_locked(void *vsc)
 			 */
 			num[0] = READ_REG_1(sc, HIFN_1_7811_RNGDAT);
 			num[1] = READ_REG_1(sc, HIFN_1_7811_RNGDAT);
-			got = 2 * sizeof(num[0]);
-			gotent = (got * NBBY) / HIFN_RNG_BITSPER;
-			rnd_add_data(>sc_rnd_source, num, got, gotent);
-			sc->sc_rng_need -= gotent;
+#ifdef HIFN_DEBUG
+			if (hifn_debug >= 2)
+hexdump(printf, "hifn", num, sizeof num);
+#endif
+			entropybits = NBBY*sizeof(num)/HIFN_RNG_BITSPER;
+			rnd_add_data(>sc_rnd_source, num, sizeof(num),
+			entropybits);
+			entropybits = MAX(entropybits, 1);
+			entropybits = MIN(entropybits, sc->sc_rng_needbits);
+			sc->sc_rng_needbits -= entropybits;
 		}
 	} else {
-		int nwords = 0;
-
-		if 

CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:53:10 UTC 2020

Modified Files:
src/sys/dev/pci: hifn7751.c hifn7751var.h

Log Message:
Tweak locking and use a pool cache for commands and dmamaps.

This is enough to get the crypto decelerator working in LOCKDEBUG;
previously it would crash the moment you looked at it.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/hifn7751var.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.70 src/sys/dev/pci/hifn7751.c:1.71
--- src/sys/dev/pci/hifn7751.c:1.70	Sun May 17 00:52:31 2020
+++ src/sys/dev/pci/hifn7751.c	Sun May 17 00:53:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.70 2020/05/17 00:52:31 riastradh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.71 2020/05/17 00:53:09 riastradh Exp $	*/
 /*	$OpenBSD: hifn7751.c,v 1.179 2020/01/11 21:34:03 cheloha Exp $	*/
 
 /*
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.70 2020/05/17 00:52:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.71 2020/05/17 00:53:09 riastradh Exp $");
 
 #include 
 #include 
@@ -55,10 +55,10 @@ __KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -138,6 +138,48 @@ static void	hifn_callback_comp(struct hi
 
 struct hifn_stats hifnstats;
 
+static int
+hifn_cmd_ctor(void *vsc, void *vcmd, int pflags)
+{
+	struct hifn_softc *sc = vsc;
+	struct hifn_command *cmd = vcmd;
+	int bflags = pflags & PR_WAITOK ? BUS_DMA_WAITOK : BUS_DMA_NOWAIT;
+	int error;
+
+	memset(cmd, 0, sizeof(*cmd));
+
+	error = bus_dmamap_create(sc->sc_dmat,
+	HIFN_MAX_DMALEN, MAX_SCATTER, HIFN_MAX_SEGLEN,
+	0, bflags, >src_map);
+	if (error)
+		goto fail0;
+
+	error = bus_dmamap_create(sc->sc_dmat,
+	HIFN_MAX_SEGLEN*MAX_SCATTER, MAX_SCATTER, HIFN_MAX_SEGLEN,
+	0, bflags, >dst_map_alloc);
+	if (error)
+		goto fail1;
+
+	/* Success!  */
+	cmd->dst_map = NULL;
+	return 0;
+
+fail2: __unused
+	bus_dmamap_destroy(sc->sc_dmat, cmd->dst_map_alloc);
+fail1:	bus_dmamap_destroy(sc->sc_dmat, cmd->src_map);
+fail0:	return error;
+}
+
+static void
+hifn_cmd_dtor(void *vsc, void *vcmd)
+{
+	struct hifn_softc *sc = vsc;
+	struct hifn_command *cmd = vcmd;
+
+	bus_dmamap_destroy(sc->sc_dmat, cmd->dst_map_alloc);
+	bus_dmamap_destroy(sc->sc_dmat, cmd->src_map);
+}
+
 static const struct hifn_product {
 	pci_vendor_id_t		hifn_vendor;
 	pci_product_id_t	hifn_product;
@@ -360,6 +402,11 @@ hifn_attach(device_t parent, device_t se
 		goto fail_intr;
 	}
 
+	sc->sc_cmd_cache = pool_cache_init(sizeof(struct hifn_command),
+	0, 0, 0, "hifncmd", NULL, IPL_VM,
+	_cmd_ctor, _cmd_dtor, sc);
+	pool_cache_setlowat(sc->sc_cmd_cache, sc->sc_maxses);
+
 	WRITE_REG_0(sc, HIFN_0_PUCNFG,
 	READ_REG_0(sc, HIFN_0_PUCNFG) | HIFN_PUCNFG_CHIPID);
 	ena = READ_REG_0(sc, HIFN_0_PUSTAT) & HIFN_PUSTAT_CHIPENA;
@@ -426,7 +473,9 @@ hifn_detach(device_t self, int flags)
 {
 	struct hifn_softc *sc = device_private(self);
 
+	mutex_enter(>sc_mtx);
 	hifn_abort(sc);
+	mutex_exit(>sc_mtx);
 
 	hifn_reset_board(sc, 1);
 
@@ -436,11 +485,11 @@ hifn_detach(device_t self, int flags)
 
 	rnd_detach_source(>sc_rnd_source);
 
-	mutex_enter(>sc_mtx);
 	callout_halt(>sc_tickto, NULL);
 	if (sc->sc_flags & (HIFN_HAS_PUBLIC | HIFN_HAS_RNG))
 		callout_halt(>sc_rngto, NULL);
-	mutex_exit(>sc_mtx);
+
+	pool_cache_destroy(sc->sc_cmd_cache);
 
 	bus_space_unmap(sc->sc_st1, sc->sc_sh1, sc->sc_iosz1);
 	bus_space_unmap(sc->sc_st0, sc->sc_sh0, sc->sc_iosz0);
@@ -1601,10 +1650,6 @@ hifn_crypto(struct hifn_softc *sc, struc
 	uint32_t cmdlen;
 	int	cmdi, resi, err = 0;
 
-	if (bus_dmamap_create(sc->sc_dmat, HIFN_MAX_DMALEN, MAX_SCATTER,
-	HIFN_MAX_SEGLEN, 0, BUS_DMA_NOWAIT, >src_map))
-		return (ENOMEM);
-
 	if (crp->crp_flags & CRYPTO_F_IMBUF) {
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, cmd->src_map,
 		cmd->srcu.src_m, BUS_DMA_NOWAIT)) {
@@ -1684,15 +1729,7 @@ hifn_crypto(struct hifn_softc *sc, struc
 			}
 			cmd->dstu.dst_m = m0;
 		}
-	}
-
-	if (cmd->dst_map == NULL) {
-		if (bus_dmamap_create(sc->sc_dmat,
-		HIFN_MAX_SEGLEN * MAX_SCATTER, MAX_SCATTER,
-		HIFN_MAX_SEGLEN, 0, BUS_DMA_NOWAIT, >dst_map)) {
-			err = ENOMEM;
-			goto err_srcmap;
-		}
+		cmd->dst_map = cmd->dst_map_alloc;
 		if (crp->crp_flags & CRYPTO_F_IMBUF) {
 			if (bus_dmamap_load_mbuf(sc->sc_dmat, cmd->dst_map,
 			cmd->dstu.dst_m, BUS_DMA_NOWAIT)) {
@@ -1840,15 +1877,9 @@ err_dstmap:
 	if (cmd->src_map != cmd->dst_map)
 		bus_dmamap_unload(sc->sc_dmat, cmd->dst_map);
 err_dstmap1:
-	if (cmd->src_map != cmd->dst_map)
-		bus_dmamap_destroy(sc->sc_dmat, cmd->dst_map);
 err_srcmap:
-	if (crp->crp_flags & CRYPTO_F_IMBUF &&
-	cmd->srcu.src_m != cmd->dstu.dst_m)

CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:52:31 UTC 2020

Modified Files:
src/sys/dev/pci: hifn7751.c hifn7751var.h

Log Message:
Merge updates from OpenBSD's hifn(4) crypto decelerator driver.

Highlights:

- Apply a ten-year-old fix to the driver's misuse of previously
  exposed ciphertext as IV for the next ciphertext with CBC.

  (Someone^TM should make sure there are no other drivers still doing
  this...)

- Various zeroing of buffers.

- Various minor cosmetic changes.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/hifn7751var.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.69 src/sys/dev/pci/hifn7751.c:1.70
--- src/sys/dev/pci/hifn7751.c:1.69	Sun May 17 00:50:24 2020
+++ src/sys/dev/pci/hifn7751.c	Sun May 17 00:52:31 2020
@@ -1,6 +1,5 @@
-/*	$NetBSD: hifn7751.c,v 1.69 2020/05/17 00:50:24 riastradh Exp $	*/
-/*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
-/*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.70 2020/05/17 00:52:31 riastradh Exp $	*/
+/*	$OpenBSD: hifn7751.c,v 1.179 2020/01/11 21:34:03 cheloha Exp $	*/
 
 /*
  * Invertex AEON / Hifn 7751 driver
@@ -44,11 +43,11 @@
  */
 
 /*
- * Driver for various  Hifn pre-HIPP encryption processors.
+ * Driver for various Hifn encryption processors.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.69 2020/05/17 00:50:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.70 2020/05/17 00:52:31 riastradh Exp $");
 
 #include 
 #include 
@@ -179,7 +178,6 @@ static const struct hifn_product {
 	  "Hifn 7956",
 	},
 
-
 	{ 0,			0,
 	  0,
 	  NULL
@@ -810,7 +808,7 @@ static struct pci2id {
 	}, {
 		/*
 		 * Other vendors share this PCI ID as well, such as
-		 * http://www.powercrypt.com, and obviously they also
+		 * powercrypt, and obviously they also
 		 * use the same key.
 		 */
 		PCI_VENDOR_HIFN,
@@ -831,7 +829,7 @@ hifn_enable_crypto(struct hifn_softc *sc
 	uint32_t dmacfg, ramcfg, encl, addr, i;
 	const char *offtbl = NULL;
 
-	for (i = 0; i < sizeof(pci2id)/sizeof(pci2id[0]); i++) {
+	for (i = 0; i < __arraycount(pci2id); i++) {
 		if (pci2id[i].pci_vendor == PCI_VENDOR(pciid) &&
 		pci2id[i].pci_prod == PCI_PRODUCT(pciid)) {
 			offtbl = pci2id[i].card_id;
@@ -1229,7 +1227,6 @@ hifn_writeramaddr(struct hifn_softc *sc,
 		printf("%s: writeramaddr -- "
 		"result[%d](addr %d) still valid\n",
 		device_xname(sc->sc_dv), resi, addr);
-		r = -1;
 		return (-1);
 	} else
 		r = 0;
@@ -1375,7 +1372,7 @@ hifn_write_command(struct hifn_command *
 	base_cmd->total_dest_count = htole16(dlen & HIFN_BASE_CMD_LENMASK_LO);
 	dlen >>= 16;
 	slen >>= 16;
-	base_cmd->session_num = htole16(cmd->session_num |
+	base_cmd->session_num = htole16(
 	((slen << HIFN_BASE_CMD_SRCLEN_S) & HIFN_BASE_CMD_SRCLEN_M) |
 	((dlen << HIFN_BASE_CMD_DSTLEN_S) & HIFN_BASE_CMD_DSTLEN_M));
 	buf_pos += sizeof(struct hifn_base_command);
@@ -2045,9 +2042,8 @@ hifn_newsession(void *arg, uint32_t *sid
 		return retval;
 
 	mutex_spin_enter(>sc_mtx);
-
 	for (i = 0; i < sc->sc_maxses; i++)
-		if (sc->sc_sessions[i].hs_state == HS_STATE_FREE)
+		if (isclr(sc->sc_sessions, i))
 			break;
 	if (i == sc->sc_maxses) {
 		retval = ENOMEM;
@@ -2068,10 +2064,6 @@ hifn_newsession(void *arg, uint32_t *sid
 		case CRYPTO_DES_CBC:
 		case CRYPTO_3DES_CBC:
 		case CRYPTO_AES_CBC:
-			cprng_fast(sc->sc_sessions[i].hs_iv,
-			c->cri_alg == CRYPTO_AES_CBC ?
-HIFN_AES_IV_LENGTH : HIFN_IV_LENGTH);
-			/*FALLTHROUGH*/
 		case CRYPTO_ARC4:
 			if (cry) {
 goto out;
@@ -2103,7 +2095,7 @@ hifn_newsession(void *arg, uint32_t *sid
 	}
 
 	*sidp = HIFN_SID(device_unit(sc->sc_dv), i);
-	sc->sc_sessions[i].hs_state = HS_STATE_USED;
+	setbit(sc->sc_sessions, i);
 
 	retval = 0;
 out:
@@ -2133,8 +2125,7 @@ hifn_freesession(void *arg, uint64_t tid
 		mutex_spin_exit(>sc_mtx);
 		return (EINVAL);
 	}
-
-	memset(>sc_sessions[session], 0, sizeof(sc->sc_sessions[session]));
+	clrbit(sc->sc_sessions, session);
 	mutex_spin_exit(>sc_mtx);
 	return (0);
 }
@@ -2144,7 +2135,7 @@ hifn_process(void *arg, struct cryptop *
 {
 	struct hifn_softc *sc = arg;
 	struct hifn_command *cmd = NULL;
-	int session, err, ivlen;
+	int session, err = 0, ivlen;
 	struct cryptodesc *crd1, *crd2, *maccrd, *enccrd;
 
 	if (crp == NULL || crp->crp_callback == NULL) {
@@ -2154,14 +2145,12 @@ hifn_process(void *arg, struct cryptop *
 
 	mutex_spin_enter(>sc_mtx);
 	session = HIFN_SESSION(crp->crp_sid);
-
-	if (sc == NULL || session >= sc->sc_maxses) {
+	if (session >= sc->sc_maxses) {
 		err = EINVAL;
 		goto errout;
 	}
 
-	cmd = (struct hifn_command *)malloc(sizeof(struct hifn_command),
-	M_DEVBUF, M_NOWAIT|M_ZERO);
+	cmd = malloc(sizeof(*cmd), 

CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:51:27 UTC 2020

Modified Files:
src/sys/dev/pci: hifn7751reg.h hifn7751var.h

Log Message:
Reduce diffs from OpenBSD hifn(4) header files.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/hifn7751reg.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/hifn7751var.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/hifn7751reg.h
diff -u src/sys/dev/pci/hifn7751reg.h:1.8 src/sys/dev/pci/hifn7751reg.h:1.9
--- src/sys/dev/pci/hifn7751reg.h:1.8	Sun Dec 11 12:22:49 2005
+++ src/sys/dev/pci/hifn7751reg.h	Sun May 17 00:51:27 2020
@@ -1,5 +1,5 @@
-/*	$NetBSD: hifn7751reg.h,v 1.8 2005/12/11 12:22:49 christos Exp $	*/
-/*	$OpenBSD: hifn7751reg.h,v 1.43 2003/06/02 15:58:41 deraadt Exp $	*/
+/*	$NetBSD: hifn7751reg.h,v 1.9 2020/05/17 00:51:27 riastradh Exp $	*/
+/*	$OpenBSD: hifn7751reg.h,v 1.46 2014/12/19 22:44:58 guenther Exp $	*/
 
 /*
  * Invertex AEON / Hifn 7751 driver
@@ -42,14 +42,14 @@
 #ifndef __DEV_PCI_HIFN7751REG_H__
 #define __DEV_PCI_HIFN7751REG_H__
 
-#include 
+#include 
 
 /*
  * Some PCI configuration space offset defines.  The names were made
  * identical to the names used by the Linux kernel.
  */
-#define HIFN_BAR0		(PCI_MAPREG_START + 0)	/* PUC register map */
-#define HIFN_BAR1		(PCI_MAPREG_START + 4)	/* DMA register map */
+#define	HIFN_BAR0		(PCI_MAPREG_START + 0)	/* PUC register map */
+#define	HIFN_BAR1		(PCI_MAPREG_START + 4)	/* DMA register map */
 #define	HIFN_RETRY_TIMEOUT	0x41
 #define	HIFN_TRDY_TIMEOUT	0x40
 
@@ -309,6 +309,9 @@ struct hifn_desc {
 #define	HIFN_MIPSRST_MIPSRST	0x0002	/* warm reset MIPS */
 #define	HIFN_MIPSRST_MIPSCOLD	0x0001	/* cold reset MIPS */
 
+/* PLL config register (HIFN_1_PLL) */
+#define	HIFN_PLL_7956		0x1d18	/* 7956 PLL config value */
+
 /* Revision ID */
 #define	HIFN_REVID_7811_PB3_2	0x0002	/* 7811PB3/2 */
 
@@ -358,11 +361,6 @@ struct hifn_desc {
 /* Random number generator config register (HIFN_1_RNG_CONFIG) */
 #define	HIFN_RNGCFG_ENA		0x0001	/* enable rng */
 
-/*
- * PLL config register
- */
-#define	HIFN_PLL_7956		0x1d18	/* 7956 PLL config value */
-
 /*
  * Structs for board commands
  *
@@ -411,18 +409,15 @@ struct hifn_crypt_command {
 #define	HIFN_CRYPT_CMD_MODE_CFB		0x0010		/*   CFB */
 #define	HIFN_CRYPT_CMD_MODE_OFB		0x0018		/*   OFB */
 #define	HIFN_CRYPT_CMD_CLR_CTX		0x0040		/* clear context */
+#define	HIFN_CRYPT_CMD_KSZ_MASK		0x0600		/* AES key size: */
+#define	HIFN_CRYPT_CMD_KSZ_128		0x		/*  128 bit */
+#define	HIFN_CRYPT_CMD_KSZ_192		0x0200		/*  192 bit */
+#define	HIFN_CRYPT_CMD_KSZ_256		0x0400		/*  256 bit */
 #define	HIFN_CRYPT_CMD_NEW_KEY		0x0800		/* expect new key */
 #define	HIFN_CRYPT_CMD_NEW_IV		0x1000		/* expect new iv */
-
 #define	HIFN_CRYPT_CMD_SRCLEN_M		0xc000
 #define	HIFN_CRYPT_CMD_SRCLEN_S		14
 
-
-#define	HIFN_CRYPT_CMD_KSZ_MASK		0x0600		/* AES key size: */
-#define	HIFN_CRYPT_CMD_KSZ_128		0x		/*   128 bit */
-#define	HIFN_CRYPT_CMD_KSZ_192		0x0200		/*   192 bit */
-#define	HIFN_CRYPT_CMD_KSZ_256		0x0400		/*   256 bit */
-
 /*
  * Structure to help build up the command data structure.
  */
@@ -517,11 +512,11 @@ struct hifn_crypt_result {
  * to set fields in the DMA Configuration Register.
  */
 #ifndef HIFN_POLL_FREQUENCY
-#define HIFN_POLL_FREQUENCY	0x1
+#define	HIFN_POLL_FREQUENCY	0x1
 #endif
 
 #ifndef HIFN_POLL_SCALAR
-#define HIFN_POLL_SCALAR	0x0
+#define	HIFN_POLL_SCALAR	0x0
 #endif
 
 #define	HIFN_MAX_SEGLEN 	0x		/* maximum dma segment len */

Index: src/sys/dev/pci/hifn7751var.h
diff -u src/sys/dev/pci/hifn7751var.h:1.13 src/sys/dev/pci/hifn7751var.h:1.14
--- src/sys/dev/pci/hifn7751var.h:1.13	Sun May 17 00:49:28 2020
+++ src/sys/dev/pci/hifn7751var.h	Sun May 17 00:51:27 2020
@@ -1,5 +1,5 @@
-/*	$NetBSD: hifn7751var.h,v 1.13 2020/05/17 00:49:28 riastradh Exp $	*/
-/*	$OpenBSD: hifn7751var.h,v 1.18 2000/06/02 22:36:45 deraadt Exp $	*/
+/*	$NetBSD: hifn7751var.h,v 1.14 2020/05/17 00:51:27 riastradh Exp $	*/
+/*	$OpenBSD: hifn7751var.h,v 1.48 2003/02/24 20:36:02 jason Exp $	*/
 
 /*
  * Invertex AEON / Hifn 7751 driver
@@ -288,13 +288,11 @@ struct hifn_command {
 	} dstu;
 	bus_dmamap_t dst_map;
 
-	u_short mac_header_skip, mac_process_len;
-	u_short crypt_header_skip, crypt_process_len;
-
 	struct hifn_softc *softc;
 	struct cryptop *crp;
-	struct cryptodesc *enccrd, *maccrd,  *compcrd;
-
+	struct cryptodesc *enccrd, *maccrd, *compcrd;
+	void (*cmd_callback)(struct hifn_softc *, struct hifn_command *,
+	uint8_t *);
 };
 
 /*



CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:50:24 UTC 2020

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

Log Message:
Remove bogus comment.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/pci/hifn7751.c

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

Modified files:

Index: src/sys/dev/pci/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.68 src/sys/dev/pci/hifn7751.c:1.69
--- src/sys/dev/pci/hifn7751.c:1.68	Sun May 17 00:49:28 2020
+++ src/sys/dev/pci/hifn7751.c	Sun May 17 00:50:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.68 2020/05/17 00:49:28 riastradh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.69 2020/05/17 00:50:24 riastradh Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.68 2020/05/17 00:49:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.69 2020/05/17 00:50:24 riastradh Exp $");
 
 #include 
 #include 
@@ -2068,12 +2068,6 @@ hifn_newsession(void *arg, uint32_t *sid
 		case CRYPTO_DES_CBC:
 		case CRYPTO_3DES_CBC:
 		case CRYPTO_AES_CBC:
-			/* Note that this is an initialization
-			   vector, not a cipher key; any function
-			   giving sufficient Hamming distance
-			   between outputs is fine.  Use of RC4
-			   to generate IVs has been FIPS140-2
-			   certified by several labs. */
 			cprng_fast(sc->sc_sessions[i].hs_iv,
 			c->cri_alg == CRYPTO_AES_CBC ?
 HIFN_AES_IV_LENGTH : HIFN_IV_LENGTH);



CVS commit: src/sys/dev/pci

2020-05-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 17 00:49:28 UTC 2020

Modified Files:
src/sys/dev/pci: hifn7751.c hifn7751var.h

Log Message:
De-#ifdef __OpenBSD__ify hifn7751.c.

Not really helpful; we can just use diff3 to merge updates.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/hifn7751var.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.67 src/sys/dev/pci/hifn7751.c:1.68
--- src/sys/dev/pci/hifn7751.c:1.67	Thu Apr 30 03:40:53 2020
+++ src/sys/dev/pci/hifn7751.c	Sun May 17 00:49:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.67 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.68 2020/05/17 00:49:28 riastradh Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,29 +48,24 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.67 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.68 2020/05/17 00:49:28 riastradh Exp $");
 
 #include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
-#include 
 #include 
+#include 
 #include 
-#include 
 #include 
-#include 
-
-#ifdef __OpenBSD__
-#include 
-#include 
-#else
-#include 
-#include 
+#include 
+#include 
 #include 
 #include 
-#endif
+#include 
+
+#include 
 
 #include 
 #include 
@@ -81,43 +76,20 @@ __KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v
 
 #undef HIFN_DEBUG
 
-#ifdef __NetBSD__
-#define M_DUP_PKTHDR m_copy_pkthdr	/* XXX */
-#endif
-
 #ifdef HIFN_DEBUG
 extern int hifn_debug;		/* patchable */
 int hifn_debug = 1;
 #endif
 
-#ifdef __OpenBSD__
-#define HAVE_CRYPTO_LZS		/* OpenBSD OCF supports CRYPTO_COMP_LZS */
-#endif
-
 /*
  * Prototypes and count for the pci_device structure
  */
-#ifdef __OpenBSD__
-static int hifn_probe((struct device *, void *, void *);
-#else
-static int hifn_probe(device_t, cfdata_t, void *);
-#endif
+static int hifn_match(device_t, cfdata_t, void *);
 static void hifn_attach(device_t, device_t, void *);
-#ifdef __NetBSD__
 static int hifn_detach(device_t, int);
 
 CFATTACH_DECL_NEW(hifn, sizeof(struct hifn_softc),
-hifn_probe, hifn_attach, hifn_detach, NULL);
-#else
-CFATTACH_DECL_NEW(hifn, sizeof(struct hifn_softc),
-hifn_probe, hifn_attach, NULL, NULL);
-#endif
-
-#ifdef __OpenBSD__
-struct cfdriver hifn_cd = {
-	0, "hifn", DV_DULL
-};
-#endif
+hifn_match, hifn_attach, hifn_detach, NULL);
 
 static void	hifn_reset_board(struct hifn_softc *, int);
 static void	hifn_reset_puc(struct hifn_softc *);
@@ -156,14 +128,14 @@ static void	hifn_alloc_slot(struct hifn_
 int *);
 static void	hifn_write_4(struct hifn_softc *, int, bus_size_t, uint32_t);
 static uint32_t hifn_read_4(struct hifn_softc *, int, bus_size_t);
-#ifdef	HAVE_CRYPTO_LZS
+#ifdef CRYPTO_LZS_COMP
 static int	hifn_compression(struct hifn_softc *, struct cryptop *,
  struct hifn_command *);
 static struct mbuf *hifn_mkmbuf_chain(int, struct mbuf *);
 static int	hifn_compress_enter(struct hifn_softc *, struct hifn_command *);
 static void	hifn_callback_comp(struct hifn_softc *, struct hifn_command *,
    uint8_t *);
-#endif	/* HAVE_CRYPTO_LZS */
+#endif	/* CRYPTO_LZS_COMP */
 
 struct hifn_stats hifnstats;
 
@@ -228,7 +200,7 @@ hifn_lookup(const struct pci_attach_args
 }
 
 static int
-hifn_probe(device_t parent, cfdata_t match, void *aux)
+hifn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 
@@ -249,12 +221,6 @@ hifn_attach(device_t parent, device_t se
 	const char *intrstr = NULL;
 	const char *hifncap;
 	char rbase;
-#ifdef __NetBSD__
-#define iosize0 sc->sc_iosz0
-#define iosize1 sc->sc_iosz1
-#else
-	bus_size_t iosize0, iosize1;
-#endif
 	uint32_t cmd;
 	uint16_t ena;
 	bus_dma_segment_t seg;
@@ -282,13 +248,13 @@ hifn_attach(device_t parent, device_t se
 	pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, cmd);
 
 	if (pci_mapreg_map(pa, HIFN_BAR0, PCI_MAPREG_TYPE_MEM, 0,
-	>sc_st0, >sc_sh0, NULL, )) {
+	>sc_st0, >sc_sh0, NULL, >sc_iosz0)) {
 		aprint_error_dev(sc->sc_dv, "can't map mem space %d\n", 0);
 		return;
 	}
 
 	if (pci_mapreg_map(pa, HIFN_BAR1, PCI_MAPREG_TYPE_MEM, 0,
-	>sc_st1, >sc_sh1, NULL, )) {
+	>sc_st1, >sc_sh1, NULL, >sc_iosz1)) {
 		aprint_error_dev(sc->sc_dv, "can't find mem space %d\n", 1);
 		goto fail_io0;
 	}
@@ -368,13 +334,8 @@ hifn_attach(device_t parent, device_t se
 		goto fail_mem;
 	}
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
-#ifdef	__OpenBSD__
-	sc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, hifn_intr, sc,
-	device_xname(self));
-#else
 	sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_NET, hifn_intr, sc,
 	device_xname(self));
-#endif
 	if (sc->sc_ih == NULL) 

CVS commit: src/tests/lib/libc/sys

2020-05-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 16 23:10:26 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_fork_wait.h

Log Message:
Ignore interception of SIGCHLD signals in the debugger

Set SIGPASS for SIGCHLD for the traced child in the following tests:
 - unrelated_tracer_fork*
 - unrelated_tracer_vfork*
 - unrelated_tracer_posix_spawn*

There is a race that SIGCHLD might be blocked during forking and dropped.

PR/55241 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/sys/t_ptrace_fork_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_fork_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.5 src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.6
--- src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.5	Sat May 16 22:07:06 2020
+++ src/tests/lib/libc/sys/t_ptrace_fork_wait.h	Sat May 16 23:10:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_fork_wait.h,v 1.5 2020/05/16 22:07:06 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_fork_wait.h,v 1.6 2020/05/16 23:10:26 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2020 The NetBSD Foundation, Inc.
@@ -337,6 +337,7 @@ unrelated_tracer_fork_body(const char *f
 	int status;
 #endif
 
+	sigset_t set;
 	struct ptrace_siginfo info;
 	ptrace_state_t state;
 	const int slen = sizeof(state);
@@ -453,6 +454,21 @@ unrelated_tracer_fork_body(const char *f
 		SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, tracee, , elen)
 		!= -1);
 
+		/*
+		 * Ignore interception of the SIGCHLD signals.
+		 *
+		 * SIGCHLD once blocked is discarded by the kernel as it has the
+		 * SA_IGNORE property. During the fork(2) operation all signals
+		 * can be shortly blocked and missed (unless there is a
+		 * registered signal handler in the traced child). This leads to
+		 * a race in this test if there would be an intention to catch
+		 * SIGCHLD.
+		 */
+		sigemptyset();
+		sigaddset(, SIGCHLD);
+		SYSCALL_REQUIRE(ptrace(PT_SET_SIGPASS, tracee, ,
+		sizeof(set)) != -1);
+
 		DPRINTF("Before resuming the child process where it left off "
 		"and without signal to be sent\n");
 		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
@@ -559,16 +575,6 @@ unrelated_tracer_fork_body(const char *f
 			wpid = TWAIT_GENERIC(tracee2, , 0));
 		}
 
-		DPRINTF("Before calling %s() for the tracee - expected stopped "
-		"SIGCHLD\n", TWAIT_FNAME);
-		TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, , 0), tracee);
-
-		validate_status_stopped(status, SIGCHLD);
-
-		DPRINTF("Before resuming the tracee process where it left off and "
-		"without signal to be sent\n");
-		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, tracee, (void *)1, 0) != -1);
-
 		DPRINTF("Before calling %s() for the tracee - expected exited\n",
 		TWAIT_FNAME);
 		TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(tracee, , 0), tracee);



CVS commit: src/sys/dev/ic

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 23:06:40 UTC 2020

Modified Files:
src/sys/dev/ic: hpet.c

Log Message:
Store initial TSC/HPET readings for hpet0 only.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/hpet.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/ic/hpet.c
diff -u src/sys/dev/ic/hpet.c:1.16 src/sys/dev/ic/hpet.c:1.17
--- src/sys/dev/ic/hpet.c:1.16	Fri May  8 22:01:54 2020
+++ src/sys/dev/ic/hpet.c	Sat May 16 23:06:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.16 2020/05/08 22:01:54 ad Exp $ */
+/* $NetBSD: hpet.c,v 1.17 2020/05/16 23:06:40 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.16 2020/05/08 22:01:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.17 2020/05/16 23:06:40 ad Exp $");
 
 #include 
 #include 
@@ -149,7 +149,7 @@ hpet_attach_subr(device_t dv)
 	sc->sc_adj = (int64_t)val * sc->sc_period / 1000;
 
 	/* Store attach-time values for computing TSC frequency later. */
-	if (cpu_hascounter()) {
+	if (cpu_hascounter() && sc == hpet0) {
 		(void)cpu_counter();
 		val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
 		hpet_attach_tsc = cpu_counter();



CVS commit: src/lib/libpthread

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 22:53:37 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c pthread_barrier.c pthread_cond.c
pthread_int.h pthread_mutex.c pthread_rwlock.c

Log Message:
- Try to eliminate a hang in "parked" I've been seeing while stress testing.
  Centralise wakeup of deferred waiters in pthread__clear_waiters() and use
  throughout libpthread.  Make fewer assumptions.  Be more conservative in
  pthread_mutex when dealing with pending waiters.

- Remove the "hint" argument everywhere since the kernel doesn't use it any
  more.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libpthread/pthread_barrier.c
cvs rdiff -u -r1.68 -r1.69 src/lib/libpthread/pthread_cond.c
cvs rdiff -u -r1.103 -r1.104 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.76 -r1.77 src/lib/libpthread/pthread_mutex.c
cvs rdiff -u -r1.39 -r1.40 src/lib/libpthread/pthread_rwlock.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.169 src/lib/libpthread/pthread.c:1.170
--- src/lib/libpthread/pthread.c:1.169	Fri May 15 14:30:23 2020
+++ src/lib/libpthread/pthread.c	Sat May 16 22:53:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.169 2020/05/15 14:30:23 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.170 2020/05/16 22:53:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.169 2020/05/15 14:30:23 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.170 2020/05/16 22:53:37 ad Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -105,7 +105,7 @@ static int pthread__diagassert;
 
 int pthread__concurrency;
 int pthread__nspins;
-int pthread__unpark_max = PTHREAD__UNPARK_MAX;
+size_t pthread__unpark_max = PTHREAD__UNPARK_MAX;
 int pthread__dbg;	/* set by libpthread_dbg if active */
 
 /*
@@ -191,9 +191,9 @@ pthread__init(void)
 {
 	pthread_t first;
 	char *p;
-	int i;
 	int mib[2];
 	unsigned int value;
+	ssize_t slen;
 	size_t len;
 	extern int __isthreaded;
 
@@ -223,16 +223,16 @@ pthread__init(void)
 
 	/* Initialize locks first; they're needed elsewhere. */
 	pthread__lockprim_init();
-	for (i = 0; i < NHASHLOCK; i++) {
+	for (int i = 0; i < NHASHLOCK; i++) {
 		pthread_mutex_init([i].mutex, NULL);
 	}
 
 	/* Fetch parameters. */
-	i = (int)_lwp_unpark_all(NULL, 0, NULL);
-	if (i == -1)
+	slen = _lwp_unpark_all(NULL, 0, NULL);
+	if (slen < 0)
 		err(EXIT_FAILURE, "_lwp_unpark_all");
-	if (i < pthread__unpark_max)
-		pthread__unpark_max = i;
+	if ((size_t)slen < pthread__unpark_max)
+		pthread__unpark_max = slen;
 
 	/* Basic data structure setup */
 	pthread_attr_init(_default_attr);
@@ -604,16 +604,57 @@ pthread_resume_np(pthread_t thread)
  * awoken (because cancelled, for instance) make sure we have no waiters
  * left.
  */
-static void
+void
 pthread__clear_waiters(pthread_t self)
 {
+	int rv;
 
-	if (self->pt_nwaiters != 0) {
-		(void)_lwp_unpark_all(self->pt_waiters, self->pt_nwaiters,
-		NULL);
-		self->pt_nwaiters = 0;
+	/* Zero waiters or one waiter in error case (pthread_exit()). */
+	if (self->pt_nwaiters == 0) {
+		if (self->pt_unpark != 0 && self->pt_willpark == 0) {
+			rv = (ssize_t)_lwp_unpark(self->pt_unpark, NULL);
+			self->pt_unpark = 0;
+			if (rv != 0 && errno != EALREADY && errno != EINTR &&
+			errno != ESRCH) {
+pthread__errorfunc(__FILE__, __LINE__, __func__,
+"_lwp_unpark failed");
+			}
+		}
+		return;
+	}
+
+	/* One waiter or two waiters (the second being a deferred wakeup). */
+	if (self->pt_nwaiters == 1) {
+		if (self->pt_unpark != 0) {
+			/* Fall through to multiple waiters case. */
+			self->pt_waiters[1] = self->pt_unpark;
+			self->pt_nwaiters = 2;
+			self->pt_unpark = 0;
+		} else if (self->pt_willpark) {
+			/* Defer to _lwp_park(). */
+			self->pt_unpark = self->pt_waiters[0];
+			self->pt_nwaiters = 0;
+			return;
+		} else {
+			/* Wake one now. */
+			rv = (ssize_t)_lwp_unpark(self->pt_waiters[0], NULL);
+			self->pt_nwaiters = 0;
+			if (rv != 0 && errno != EALREADY && errno != EINTR &&
+			errno != ESRCH) {
+pthread__errorfunc(__FILE__, __LINE__, __func__,
+"_lwp_unpark failed");
+			}
+			return;
+		}
+	}
+
+	/* Multiple waiters. */
+	rv = _lwp_unpark_all(self->pt_waiters, self->pt_nwaiters, NULL);
+	self->pt_nwaiters = 0;
+	if (rv != 0 && errno != EINTR) {
+		pthread__errorfunc(__FILE__, __LINE__, __func__,
+		"_lwp_unpark_all failed");
 	}
-	self->pt_willpark = 0;
 }
 
 void
@@ -630,6 +671,7 @@ pthread_exit(void *retval)
 	self = pthread__self();
 
 	/* Disable cancellability. */
+	self->pt_willpark = 0;
 	pthread_mutex_lock(>pt_lock);
 	self->pt_flags |= PT_FLAG_CS_DISABLED;
 	self->pt_cancel = 0;
@@ -660,10 +702,12 @@ pthread_exit(void *retval)
 	if (self->pt_flags & 

CVS commit: src/tests/lib/libc/sys

2020-05-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 16 22:07:06 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_fork_wait.h

Log Message:
Fix typo in test names

Noted by 


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_ptrace_fork_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_fork_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.4 src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.5
--- src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.4	Sat May 16 19:08:20 2020
+++ src/tests/lib/libc/sys/t_ptrace_fork_wait.h	Sat May 16 22:07:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_fork_wait.h,v 1.4 2020/05/16 19:08:20 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_fork_wait.h,v 1.5 2020/05/16 22:07:06 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2020 The NetBSD Foundation, Inc.
@@ -1600,14 +1600,14 @@ ATF_TC_BODY(name, tc)			\
 	fork2_body(fn, masked, ignored);\
 }
 
-FORK2_TEST(posix_spawn_singalmasked, "spawn", true, false)
-FORK2_TEST(posix_spawn_singalignored, "spawn", false, true)
-FORK2_TEST(fork_singalmasked, "fork", true, false)
-FORK2_TEST(fork_singalignored, "fork", false, true)
-FORK2_TEST(vfork_singalmasked, "vfork", true, false)
-FORK2_TEST(vfork_singalignored, "vfork", false, true)
-FORK2_TEST(vforkdone_singalmasked, "vforkdone", true, false)
-FORK2_TEST(vforkdone_singalignored, "vforkdone", false, true)
+FORK2_TEST(posix_spawn_signalmasked, "spawn", true, false)
+FORK2_TEST(posix_spawn_signalignored, "spawn", false, true)
+FORK2_TEST(fork_signalmasked, "fork", true, false)
+FORK2_TEST(fork_signalignored, "fork", false, true)
+FORK2_TEST(vfork_signalmasked, "vfork", true, false)
+FORK2_TEST(vfork_signalignored, "vfork", false, true)
+FORK2_TEST(vforkdone_signalmasked, "vforkdone", true, false)
+FORK2_TEST(vforkdone_signalignored, "vforkdone", false, true)
 #endif
 
 #define ATF_TP_ADD_TCS_PTRACE_WAIT_FORK() \
@@ -1725,11 +1725,11 @@ FORK2_TEST(vforkdone_singalignored, "vfo
 	ATF_TP_ADD_TC_HAVE_PID(tp, unrelated_tracer_vfork_kill_vforkerdone); \
 	ATF_TP_ADD_TC(tp, traceme_vfork_fork); \
 	ATF_TP_ADD_TC(tp, traceme_vfork_vfork); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, posix_spawn_singalmasked); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, posix_spawn_singalignored); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, fork_singalmasked); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, fork_singalignored); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, vfork_singalmasked); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, vfork_singalignored); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, vforkdone_singalmasked); \
-	ATF_TP_ADD_TC_HAVE_PID(tp, vforkdone_singalignored);
+	ATF_TP_ADD_TC_HAVE_PID(tp, posix_spawn_signalmasked); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, posix_spawn_signalignored); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, fork_signalmasked); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, fork_signalignored); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, vfork_signalmasked); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, vfork_signalignored); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, vforkdone_signalmasked); \
+	ATF_TP_ADD_TC_HAVE_PID(tp, vforkdone_signalignored);



CVS commit: src/share/man/man4

2020-05-16 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat May 16 20:27:38 UTC 2020

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

Log Message:
wsdisplay.4: correct ioctl name for WSDISPLAYIO_GET_FBINFO


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/share/man/man4/wsdisplay.4

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

Modified files:

Index: src/share/man/man4/wsdisplay.4
diff -u src/share/man/man4/wsdisplay.4:1.48 src/share/man/man4/wsdisplay.4:1.49
--- src/share/man/man4/wsdisplay.4:1.48	Sat Nov  2 19:22:36 2019
+++ src/share/man/man4/wsdisplay.4	Sat May 16 20:27:38 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: wsdisplay.4,v 1.48 2019/11/02 19:22:36 tnn Exp $
+.\" $NetBSD: wsdisplay.4,v 1.49 2020/05/16 20:27:38 tnn Exp $
 .\"
 .\" Copyright (c) 1999 Matthias Drochner.
 .\" Copyright (c) 2002 Ben Harris.
@@ -26,7 +26,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 2, 2019
+.Dd May 16, 2020
 .Dt WSDISPLAY 4
 .Os
 .Sh NAME
@@ -192,7 +192,7 @@ Their definitions are found in
 Retrieve the type of the display.
 The list of types is in
 .In dev/wscons/wsconsio.h .
-.It Dv WSDISPLAYIO_FBINFO Pq Li "struct wsdisplayio_fbinfo"
+.It Dv WSDISPLAYIO_GET_FBINFO Pq Li "struct wsdisplayio_fbinfo"
 Retrieve extended information about a framebuffer display,
 including the framebuffer's pixel packing layout.
 The returned structure is as follows:



CVS commit: src/sys/secmodel/suser

2020-05-16 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Sat May 16 19:12:38 UTC 2020

Modified Files:
src/sys/secmodel/suser: secmodel_suser.c

Log Message:
Make it clear that only KAUTH_MACHDEP_SVS_DISABLE is deprecated.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/secmodel/suser/secmodel_suser.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/secmodel/suser/secmodel_suser.c
diff -u src/sys/secmodel/suser/secmodel_suser.c:1.53 src/sys/secmodel/suser/secmodel_suser.c:1.54
--- src/sys/secmodel/suser/secmodel_suser.c:1.53	Mon May 11 19:36:40 2020
+++ src/sys/secmodel/suser/secmodel_suser.c	Sat May 16 19:12:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_suser.c,v 1.53 2020/05/11 19:36:40 alnsn Exp $ */
+/* $NetBSD: secmodel_suser.c,v 1.54 2020/05/16 19:12:38 alnsn Exp $ */
 /*-
  * Copyright (c) 2006 Elad Efrat 
  * All rights reserved.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.53 2020/05/11 19:36:40 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_suser.c,v 1.54 2020/05/16 19:12:38 alnsn Exp $");
 
 #include 
 #include 
@@ -846,6 +846,10 @@ secmodel_suser_machdep_cb(kauth_cred_t c
 	case KAUTH_MACHDEP_NVRAM:
 	case KAUTH_MACHDEP_UNMANAGEDMEM:
 	case KAUTH_MACHDEP_PXG:
+		if (isroot)
+			result = KAUTH_RESULT_ALLOW;
+		break;
+
 	case KAUTH_MACHDEP_SVS_DISABLE:
 		/* Deprecated. */
 		if (isroot)



CVS commit: src/tests/lib/libc/sys

2020-05-16 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat May 16 19:08:20 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_fork_wait.h

Log Message:
Ignore interception of SIGCHLD signals in the debugger

Set SIGPASS for SIGCHLD for the traced child in the following tests:

 - posix_spawn_singalmasked
 - posix_spawn_singalignored
 - fork_singalmasked
 - fork_singalignored
 - vfork_singalmasked
 - vfork_singalignored
 - vforkdone_singalmasked
 - vforkdone_singalignored

There is a race that SIGCHLD might be blocked during forking and dropped.

PR/55241 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_ptrace_fork_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_fork_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.3 src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.4
--- src/tests/lib/libc/sys/t_ptrace_fork_wait.h:1.3	Thu May 14 19:21:35 2020
+++ src/tests/lib/libc/sys/t_ptrace_fork_wait.h	Sat May 16 19:08:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_fork_wait.h,v 1.3 2020/05/14 19:21:35 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_fork_wait.h,v 1.4 2020/05/16 19:08:20 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2020 The NetBSD Foundation, Inc.
@@ -1250,6 +1250,7 @@ fork2_body(const char *fn, bool masked, 
 
 	int name[6];
 	const size_t namelen = __arraycount(name);
+	sigset_t set;
 	ki_sigset_t kp_sigmask;
 	ki_sigset_t kp_sigignore;
 
@@ -1341,6 +1342,19 @@ fork2_body(const char *fn, bool masked, 
 		event.pe_set_event |= PTRACE_VFORK_DONE;
 	SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, , elen) != -1);
 
+	/*
+	 * Ignore interception of the SIGCHLD signals.
+	 *
+	 * SIGCHLD once blocked is discarded by the kernel as it has the
+	 * SA_IGNORE property. During the fork(2) operation all signals can be
+	 * shortly blocked and missed (unless there is a registered signal
+	 * handler in the traced child). This leads to a race in this test if
+	 * there would be an intention to catch SIGCHLD.
+	 */
+	sigemptyset();
+	sigaddset(, SIGCHLD);
+	SYSCALL_REQUIRE(ptrace(PT_SET_SIGPASS, child, , sizeof(set)) != -1);
+
 	DPRINTF("Before resuming the child process where it left off and "
 	"without signal to be sent\n");
 	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
@@ -1560,16 +1574,6 @@ fork2_body(const char *fn, bool masked, 
 		wpid = TWAIT_GENERIC(child2, , 0));
 	}
 
-	DPRINTF("Before calling %s() for the child - expected stopped "
-	"SIGCHLD\n", TWAIT_FNAME);
-	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);
-
-	validate_status_stopped(status, SIGCHLD);
-
-	DPRINTF("Before resuming the child process where it left off and "
-	"without signal to be sent\n");
-	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
-
 	DPRINTF("Before calling %s() for the child - expected exited\n",
 	TWAIT_FNAME);
 	TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child);



CVS commit: src/distrib/sets/lists

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 19:05:06 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/man: mi

Log Message:
move the fido man pages from man to comp where they belong. I wonder about
the other section 3 man pages? Should they also move from man to comp?


To generate a diff of this commit:
cvs rdiff -u -r1.2327 -r1.2328 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.1689 -r1.1690 src/distrib/sets/lists/man/mi

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2327 src/distrib/sets/lists/comp/mi:1.2328
--- src/distrib/sets/lists/comp/mi:1.2327	Sat May 16 14:31:45 2020
+++ src/distrib/sets/lists/comp/mi	Sat May 16 15:05:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2327 2020/05/16 18:31:45 christos Exp $
+#	$NetBSD: mi,v 1.2328 2020/05/16 19:05:05 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -7101,6 +7101,28 @@
 ./usr/share/man/cat3/fgetwc.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fgetwln.0			comp-c-catman		.cat
 ./usr/share/man/cat3/fgetws.0			comp-c-catman		.cat
+./usr/share/man/cat3/fido_assert_allow_cred.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_assert_new.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_assert_set_authdata.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_assert_verify.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_bio_dev_get_info.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_bio_enroll_new.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_bio_info_new.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_bio_template.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_cbor_info_new.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_cred_exclude.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_cred_new.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_cred_set_authdata.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_cred_verify.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_credman_metadata_new.0	man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_get_assert.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_info_manifest.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_make_cred.0		man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_open.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_set_io_functions.0	man-util-catman	.cat
+./usr/share/man/cat3/fido_dev_set_pin.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_init.0			man-util-catman	.cat
+./usr/share/man/cat3/fido_strerr.0			man-util-catman	.cat
 ./usr/share/man/cat3/field_arg.0		comp-c-catman		.cat
 ./usr/share/man/cat3/field_back.0		comp-c-catman		.cat
 ./usr/share/man/cat3/field_buffer.0		comp-c-catman		.cat
@@ -15198,6 +15220,28 @@
 ./usr/share/man/html3/fgetwc.html		comp-c-htmlman		html
 ./usr/share/man/html3/fgetwln.html		comp-c-htmlman		html
 ./usr/share/man/html3/fgetws.html		comp-c-htmlman		html
+./usr/share/man/html3/fido_assert_allow_cred.html	man-util-htmlman	html
+./usr/share/man/html3/fido_assert_new.html		man-util-htmlman	html
+./usr/share/man/html3/fido_assert_set_authdata.html	man-util-htmlman	html
+./usr/share/man/html3/fido_assert_verify.html		man-util-htmlman	html
+./usr/share/man/html3/fido_bio_dev_get_info.html	man-util-htmlman	html
+./usr/share/man/html3/fido_bio_enroll_new.html		man-util-htmlman	html
+./usr/share/man/html3/fido_bio_info_new.html		man-util-htmlman	html
+./usr/share/man/html3/fido_bio_template.html		man-util-htmlman	html
+./usr/share/man/html3/fido_cbor_info_new.html		man-util-htmlman	html
+./usr/share/man/html3/fido_cred_exclude.html		man-util-htmlman	html
+./usr/share/man/html3/fido_cred_new.html		man-util-htmlman	html
+./usr/share/man/html3/fido_cred_set_authdata.html	man-util-htmlman	html
+./usr/share/man/html3/fido_cred_verify.html		man-util-htmlman	html
+./usr/share/man/html3/fido_credman_metadata_new.html	man-util-htmlman	html
+./usr/share/man/html3/fido_dev_get_assert.html		man-util-htmlman	html
+./usr/share/man/html3/fido_dev_info_manifest.html	man-util-htmlman	html
+./usr/share/man/html3/fido_dev_make_cred.html		man-util-htmlman	html
+./usr/share/man/html3/fido_dev_open.html		man-util-htmlman	html
+./usr/share/man/html3/fido_dev_set_io_functions.html	man-util-htmlman	html
+./usr/share/man/html3/fido_dev_set_pin.html		man-util-htmlman	html
+./usr/share/man/html3/fido_init.html			man-util-htmlman	html
+./usr/share/man/html3/fido_strerr.html			man-util-htmlman	html
 ./usr/share/man/html3/field_arg.html		comp-c-htmlman		html
 ./usr/share/man/html3/field_back.html		comp-c-htmlman		html
 ./usr/share/man/html3/field_buffer.html		comp-c-htmlman		html
@@ -23233,6 +23277,28 @@
 ./usr/share/man/man3/fgetwc.3			comp-c-man		.man
 ./usr/share/man/man3/fgetwln.3			comp-c-man		.man
 ./usr/share/man/man3/fgetws.3		

CVS commit: src/distrib/sets/lists

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 19:00:13 UTC 2020

Modified Files:
src/distrib/sets/lists/base: shl.mi
src/distrib/sets/lists/debug: shl.mi

Log Message:
bump libc


To generate a diff of this commit:
cvs rdiff -u -r1.886 -r1.887 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.247 -r1.248 src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.886 src/distrib/sets/lists/base/shl.mi:1.887
--- src/distrib/sets/lists/base/shl.mi:1.886	Fri May 15 19:32:27 2020
+++ src/distrib/sets/lists/base/shl.mi	Sat May 16 15:00:13 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.886 2020/05/15 23:32:27 christos Exp $
+# $NetBSD: shl.mi,v 1.887 2020/05/16 19:00:13 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -21,7 +21,7 @@
 ./lib/libblacklist.so.0.0			base-sys-shlib		dynamicroot
 ./lib/libc.so	base-sys-shlib		dynamicroot
 ./lib/libc.so.12base-sys-shlib		dynamicroot
-./lib/libc.so.12.216base-sys-shlib		dynamicroot
+./lib/libc.so.12.217base-sys-shlib		dynamicroot
 ./lib/libcrypt.sobase-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1base-sys-shlib		dynamicroot
 ./lib/libcrypt.so.1.0base-sys-shlib		dynamicroot
@@ -249,7 +249,7 @@
 ./usr/lib/libc++.so.1.0base-sys-shlib		compatfile,libcxx
 ./usr/lib/libc.sobase-sys-shlib		compatfile
 ./usr/lib/libc.so.12base-sys-shlib		compatfile
-./usr/lib/libc.so.12.216			base-sys-shlib		compatfile
+./usr/lib/libc.so.12.217			base-sys-shlib		compatfile
 ./usr/lib/libcbor.sobase-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0base-sys-shlib		compatfile
 ./usr/lib/libcbor.so.0.5			base-sys-shlib		compatfile

Index: src/distrib/sets/lists/debug/shl.mi
diff -u src/distrib/sets/lists/debug/shl.mi:1.247 src/distrib/sets/lists/debug/shl.mi:1.248
--- src/distrib/sets/lists/debug/shl.mi:1.247	Fri May 15 19:32:28 2020
+++ src/distrib/sets/lists/debug/shl.mi	Sat May 16 15:00:13 2020
@@ -1,9 +1,9 @@
-# $NetBSD: shl.mi,v 1.247 2020/05/15 23:32:28 christos Exp $
+# $NetBSD: shl.mi,v 1.248 2020/05/16 19:00:13 christos Exp $
 ./usr/lib/libbfd_g.a		comp-c-debuglib	debuglib,compatfile,binutils
 ./usr/libdata/debug/lib		base-sys-usr	debug,dynamicroot,compatdir
 ./usr/libdata/debug/lib/libavl.so.0.0.debug			comp-zfs-debug	debug,dynamicroot,zfs
 ./usr/libdata/debug/lib/libblacklist.so.0.0.debug		comp-sys-debug	debug,dynamicroot
-./usr/libdata/debug/lib/libc.so.12.216.debug			comp-sys-debug	debug,dynamicroot
+./usr/libdata/debug/lib/libc.so.12.217.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypt.so.1.0.debug			comp-sys-debug	debug,dynamicroot
 ./usr/libdata/debug/lib/libcrypto.so.12.0.debug			comp-sys-debug	debug,dynamicroot,openssl=10
 ./usr/libdata/debug/lib/libcrypto.so.14.0.debug			comp-sys-debug	debug,dynamicroot,openssl=11
@@ -82,7 +82,7 @@
 ./usr/libdata/debug/usr/lib/libbsdmalloc.so.0.0.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libbz2.so.1.1.debug			comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libc++.so.1.0.debug			comp-sys-debug	debug,compatfile,libcxx
-./usr/libdata/debug/usr/lib/libc.so.12.216.debug		comp-sys-debug	debug,compatfile
+./usr/libdata/debug/usr/lib/libc.so.12.217.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcbor.so.0.5.debug		comp-sys-debug	debug,compatfile
 ./usr/libdata/debug/usr/lib/libcom_err.so.8.0.debug		comp-krb5-debug	debug,compatfile,kerberos
 ./usr/libdata/debug/usr/lib/libcrypt.so.1.0.debug		comp-sys-debug	debug,compatfile



CVS commit: src/lib/libc

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 18:59:23 UTC 2020

Modified Files:
src/lib/libc: shlib_version

Log Message:
bump for ACLS


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/lib/libc/shlib_version

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/shlib_version
diff -u src/lib/libc/shlib_version:1.287 src/lib/libc/shlib_version:1.288
--- src/lib/libc/shlib_version:1.287	Fri May 15 10:57:33 2020
+++ src/lib/libc/shlib_version	Sat May 16 14:59:23 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.287 2020/05/15 14:57:33 joerg Exp $
+#	$NetBSD: shlib_version,v 1.288 2020/05/16 18:59:23 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -54,4 +54,4 @@
 # - move statfs() to libcompat since we have statvfs()
 # - the syscall stubs for the (obsolete) lfs syscalls should be removed
 major=12
-minor=216
+minor=217



CVS commit: src/sys/sys

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 18:58:56 UTC 2020

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

Log Message:
Welcome to 9.99.63 (ACLS)


To generate a diff of this commit:
cvs rdiff -u -r1.665 -r1.666 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.665 src/sys/sys/param.h:1.666
--- src/sys/sys/param.h:1.665	Thu May 14 09:34:46 2020
+++ src/sys/sys/param.h	Sat May 16 14:58:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.665 2020/05/14 13:34:46 kamil Exp $	*/
+/*	$NetBSD: param.h,v 1.666 2020/05/16 18:58:56 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999006200	/* NetBSD 9.99.62 */
+#define	__NetBSD_Version__	999006300	/* NetBSD 9.99.63 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/doc

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 18:37:32 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Mention ACL support.


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2689 src/doc/CHANGES:1.2690
--- src/doc/CHANGES:1.2689	Thu May 14 17:13:46 2020
+++ src/doc/CHANGES	Sat May 16 14:37:32 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2689 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2690 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -204,3 +204,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	ptrace(2): Add PT_SET_SIGPASS and PT_GET_SIGPASS. [kamil 20200514]
 	evbarm: Added support for EFI RNG firwmare random number generator
 		[riastradh 20200514]
+	ACL: Add FFS support for ACLS via extended attributes, from FreeBSD.
+		[christos 20200516]



CVS commit: src/sys/arch/sparc/include

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 17:52:42 UTC 2020

Modified Files:
src/sys/arch/sparc/include: cpu.h types.h

Log Message:
PR port-sparc/55261: sparc still panics running ATF tests

Reinstate the cpu_info change and remove __HAVE_CPU_DATA_FIRST to fix
build failure.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/sparc/include/types.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/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.107 src/sys/arch/sparc/include/cpu.h:1.108
--- src/sys/arch/sparc/include/cpu.h:1.107	Sat May 16 17:37:28 2020
+++ src/sys/arch/sparc/include/cpu.h	Sat May 16 17:52:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.107 2020/05/16 17:37:28 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.108 2020/05/16 17:52:42 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,8 +175,6 @@ struct xpmsg {
  */
 
 struct cpu_info {
-	struct cpu_data ci_data;	/* MI per-cpu data */
-
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -395,6 +393,8 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
+
+	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */

Index: src/sys/arch/sparc/include/types.h
diff -u src/sys/arch/sparc/include/types.h:1.66 src/sys/arch/sparc/include/types.h:1.67
--- src/sys/arch/sparc/include/types.h:1.66	Sat Jan 23 22:31:20 2016
+++ src/sys/arch/sparc/include/types.h	Sat May 16 17:52:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.66 2016/01/23 22:31:20 christos Exp $ */
+/*	$NetBSD: types.h,v 1.67 2020/05/16 17:52:42 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -123,7 +123,6 @@ typedef unsigned long int	__register_t;
 #define	__HAVE_NEW_STYLE_BUS_H
 #define	__HAVE_SYSCALL_INTERN
 #define	__GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
-#define __HAVE_CPU_DATA_FIRST
 #define	__HAVE_CPU_VMSPACE_EXEC
 #define	__HAVE_RAS
 



CVS commit: src/sys/kern

2020-05-16 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat May 16 17:42:07 UTC 2020

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

Log Message:
Add __diagused, amd64 kernel ALL compiles again.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_kcov.c

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

Modified files:

Index: src/sys/kern/subr_kcov.c
diff -u src/sys/kern/subr_kcov.c:1.14 src/sys/kern/subr_kcov.c:1.15
--- src/sys/kern/subr_kcov.c:1.14	Fri May 15 13:09:02 2020
+++ src/sys/kern/subr_kcov.c	Sat May 16 17:42:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kcov.c,v 1.14 2020/05/15 13:09:02 maxv Exp $	*/
+/*	$NetBSD: subr_kcov.c,v 1.15 2020/05/16 17:42:06 hannken Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -274,7 +274,7 @@ kcov_remote_enter(uint64_t subsystem, ui
 	struct lwp *l = curlwp;
 	kcov_remote_t *kr;
 	kcov_t *kd;
-	u_int refs;
+	u_int refs __diagused;
 
 	kr = kcov_remote_find(subsystem, id);
 	if (__predict_false(kr == NULL)) {
@@ -296,7 +296,7 @@ kcov_remote_leave(uint64_t subsystem, ui
 {
 	struct lwp *l = curlwp;
 	kcov_remote_t *kr;
-	u_int refs;
+	u_int refs __diagused;
 
 	kr = kcov_remote_find(subsystem, id);
 	if (__predict_false(kr == NULL)) {



CVS commit: src/sys/arch/sparc/include

2020-05-16 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 16 17:37:28 UTC 2020

Modified Files:
src/sys/arch/sparc/include: cpu.h

Log Message:
Back out previous - it doesn't work.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/sparc/include/cpu.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/arch/sparc/include/cpu.h
diff -u src/sys/arch/sparc/include/cpu.h:1.106 src/sys/arch/sparc/include/cpu.h:1.107
--- src/sys/arch/sparc/include/cpu.h:1.106	Fri May 15 18:45:08 2020
+++ src/sys/arch/sparc/include/cpu.h	Sat May 16 17:37:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.106 2020/05/15 18:45:08 ad Exp $ */
+/*	$NetBSD: cpu.h,v 1.107 2020/05/16 17:37:28 ad Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -175,6 +175,8 @@ struct xpmsg {
  */
 
 struct cpu_info {
+	struct cpu_data ci_data;	/* MI per-cpu data */
+
 	/*
 	 * Primary Inter-processor message area.  Keep this aligned
 	 * to a cache line boundary if possible, as the structure
@@ -393,8 +395,6 @@ struct cpu_info {
 	struct evcnt ci_xpmsg_bogus;
 	struct evcnt ci_intrcnt[16];
 	struct evcnt ci_sintrcnt[16];
-
-	struct cpu_data ci_data;	/* MI per-cpu data */
 };
 
 #endif /* _KERNEL || _KMEMUSER */



CVS commit: src/libexec/ld.elf_so

2020-05-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 16 16:43:15 UTC 2020

Modified Files:
src/libexec/ld.elf_so: headers.c

Log Message:
Fix debug build


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/libexec/ld.elf_so/headers.c

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

Modified files:

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.68 src/libexec/ld.elf_so/headers.c:1.69
--- src/libexec/ld.elf_so/headers.c:1.68	Wed Mar  4 01:21:17 2020
+++ src/libexec/ld.elf_so/headers.c	Sat May 16 16:43:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.68 2020/03/04 01:21:17 thorpej Exp $	 */
+/*	$NetBSD: headers.c,v 1.69 2020/05/16 16:43:15 skrll Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.68 2020/03/04 01:21:17 thorpej Exp $");
+__RCSID("$NetBSD: headers.c,v 1.69 2020/05/16 16:43:15 skrll Exp $");
 #endif /* not lint */
 
 #include 
@@ -240,7 +240,7 @@ _rtld_digest_dynamic(const char *execnam
 >nbuckets_s2_gnu);
 
 dbg(("found GNU Hash: buckets=%p "
- "nbuckets=%lu chains=%p nchains=%u "
+ "nbuckets=%u chains=%p nchains=%lu "
  "bloom=%p mask_bm=%u shift2=%u "
  "symndx=%u",
 obj->buckets_gnu, obj->nbuckets_gnu,



CVS commit: src/libexec/ld.elf_so/arch/hppa

2020-05-16 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat May 16 16:43:00 UTC 2020

Modified Files:
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c

Log Message:
Avoid compiler warnings about uninitialised symnum


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
diff -u src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.46 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.47
--- src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c:1.46	Sun May 10 06:42:38 2020
+++ src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c	Sat May 16 16:43:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $	*/
+/*	$NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: hppa_reloc.c,v 1.46 2020/05/10 06:42:38 skrll Exp $");
+__RCSID("$NetBSD: hppa_reloc.c,v 1.47 2020/05/16 16:43:00 skrll Exp $");
 #endif /* not lint */
 
 #include 
@@ -420,12 +420,12 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 	for (rela = obj->rela; rela < obj->relalim; rela++) {
 		Elf_Addr*where;
 		Elf_Addr tmp;
-		unsigned long	 symnum;
 
 		where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
 
+		unsigned long symnum = ELF_R_SYM(rela->r_info);
 		/* First, handle DIR32 and PLABEL32 without symbol. */
-		if (ELF_R_SYM(rela->r_info) == 0) {
+		if (symnum == 0) {
 			switch (ELF_R_TYPE(rela->r_info)) {
 			default:
 break;
@@ -474,7 +474,6 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 		case R_TYPE(TLS_TPREL32):
 		case R_TYPE(TLS_DTPMOD32):
 		case R_TYPE(TLS_DTPOFF32):
-			symnum = ELF_R_SYM(rela->r_info);
 			if (last_symnum != symnum) {
 last_symnum = symnum;
 if (ELF_R_TYPE(rela->r_info) == R_TYPE(DIR32)) {



CVS commit: src/lib/libc/include

2020-05-16 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 16 16:16:59 UTC 2020

Modified Files:
src/lib/libc/include: futex_private.h

Log Message:
Avoid pulling in "namespace.h" here, as it can have unintended
effects on consumers of this header.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/include/futex_private.h

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

Modified files:

Index: src/lib/libc/include/futex_private.h
diff -u src/lib/libc/include/futex_private.h:1.1 src/lib/libc/include/futex_private.h:1.2
--- src/lib/libc/include/futex_private.h:1.1	Sun Apr 26 18:53:32 2020
+++ src/lib/libc/include/futex_private.h	Sat May 16 16:16:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: futex_private.h,v 1.1 2020/04/26 18:53:32 thorpej Exp $	*/
+/*	$NetBSD: futex_private.h,v 1.2 2020/05/16 16:16:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -32,33 +32,32 @@
 #ifndef __LIBC_FUTEX_PRIVATE
 #define __LIBC_FUTEX_PRIVATE
 
-#if defined(_LIBC)
-#include "namespace.h"
-#endif
-
 #include 
 #include 
 #include 
 #include 
 
+/* XXX Avoid pulling in namespace.h. */
+extern int _syscall(int, ...);
+
 static inline int __unused
 __futex(volatile int *uaddr, int op, int val, const struct timespec *timeout,
 	volatile int *uaddr2, int val2, int val3)
 {
-	return syscall(SYS___futex, uaddr, op, val, timeout, uaddr2,
+	return _syscall(SYS___futex, uaddr, op, val, timeout, uaddr2,
 			val2, val3);
 }
 
 static inline int __unused
 __futex_set_robust_list(void *head, size_t len)
 {
-	return syscall(SYS___futex_set_robust_list, head, len);
+	return _syscall(SYS___futex_set_robust_list, head, len);
 }
 
 static inline int __unused
 __futex_get_robust_list(lwpid_t lwpid, void **headp, size_t *lenp)
 {
-	return syscall(SYS___futex_get_robust_list, lwpid, headp, lenp);
+	return _syscall(SYS___futex_get_robust_list, lwpid, headp, lenp);
 }
 
 #endif /* __LIBC_FUTEX_PRIVATE */



CVS commit: src

2020-05-16 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat May 16 13:46:12 UTC 2020

Modified Files:
src/distrib/sets/lists/man: mi
src/share/man/man4: Makefile usb.4
src/sys/arch/algor/conf: P4032 P5064 P6032
src/sys/arch/alpha/conf: GENERIC
src/sys/arch/amd64/conf: ALL XEN3_DOM0
src/sys/arch/cats/conf: GENERIC
src/sys/arch/evbarm/conf: HDL_G HPT5325 MINI2440 MMNET_GENERIC
MPCSA_GENERIC POGO SHEEVAPLUG SMDK2410 TS7200 TWINTAIL
src/sys/arch/evbppc/conf: OPENBLOCKS266_OPT PMPPC
src/sys/arch/hpcmips/conf: GENERIC TX3922 VR41XX
src/sys/arch/hppa/conf: GENERIC
src/sys/arch/i386/conf: ALL GENERIC_TINY INSTALL_FLOPPY XEN3PAE_DOM0
src/sys/arch/landisk/conf: GENERIC
src/sys/arch/ofppc/conf: GENERIC
src/sys/arch/playstation2/conf: DEBUG
src/sys/arch/prep/conf: GENERIC
src/sys/arch/x68k/conf: GENERIC
src/sys/dev: DEVNAMES
src/sys/dev/usb: FILES TODO.usbmp files.usb usbdevices.config
Removed Files:
src/share/man/man4: uyap.4
src/sys/dev/usb: ezload.c ezload.h uyap.c uyap_firmware.h

Log Message:
Remove uyap, USB YAP phone firmware loader.

And the associated ezload EZ-USB code, which is only used by uyap.
It could theoretically be used by other drivers, but none of them are
in tree.

I suspect that this device isn't in use, as phone technology has improved
a lot since 2001 when uyap(4) was added to the tree.

Proposed with no objections on netbsd-users on 13 April 2020


To generate a diff of this commit:
cvs rdiff -u -r1.1687 -r1.1688 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.704 -r1.705 src/share/man/man4/Makefile
cvs rdiff -u -r1.111 -r1.112 src/share/man/man4/usb.4
cvs rdiff -u -r1.5 -r0 src/share/man/man4/uyap.4
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/algor/conf/P4032
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/algor/conf/P5064
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/algor/conf/P6032
cvs rdiff -u -r1.401 -r1.402 src/sys/arch/alpha/conf/GENERIC
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.178 -r1.179 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.180 -r1.181 src/sys/arch/cats/conf/GENERIC
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/evbarm/conf/HDL_G
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/evbarm/conf/HPT5325
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbarm/conf/MINI2440
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/evbarm/conf/MPCSA_GENERIC
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/conf/POGO
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbarm/conf/SHEEVAPLUG
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/evbarm/conf/SMDK2410
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/evbarm/conf/TS7200
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/evbarm/conf/TWINTAIL
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/evbppc/conf/OPENBLOCKS266_OPT
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/evbppc/conf/PMPPC
cvs rdiff -u -r1.241 -r1.242 src/sys/arch/hpcmips/conf/GENERIC
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/hpcmips/conf/TX3922
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/hpcmips/conf/VR41XX
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/hppa/conf/GENERIC
cvs rdiff -u -r1.491 -r1.492 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.167 -r1.168 src/sys/arch/i386/conf/GENERIC_TINY
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/i386/conf/INSTALL_FLOPPY
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/conf/XEN3PAE_DOM0
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/landisk/conf/GENERIC
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/ofppc/conf/GENERIC
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/playstation2/conf/DEBUG
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/prep/conf/GENERIC
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/x68k/conf/GENERIC
cvs rdiff -u -r1.327 -r1.328 src/sys/dev/DEVNAMES
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/usb/FILES
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/TODO.usbmp
cvs rdiff -u -r1.18 -r0 src/sys/dev/usb/ezload.c
cvs rdiff -u -r1.6 -r0 src/sys/dev/usb/ezload.h
cvs rdiff -u -r1.174 -r1.175 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/usbdevices.config
cvs rdiff -u -r1.24 -r0 src/sys/dev/usb/uyap.c
cvs rdiff -u -r1.8 -r0 src/sys/dev/usb/uyap_firmware.h

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1687 src/distrib/sets/lists/man/mi:1.1688
--- src/distrib/sets/lists/man/mi:1.1687	Sun Apr 12 01:10:53 2020
+++ src/distrib/sets/lists/man/mi	Sat May 16 13:46:10 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1687 2020/04/12 01:10:53 simonb Exp $
+# $NetBSD: mi,v 1.1688 2020/05/16 13:46:10 maya Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1958,7 +1958,7 @@
 ./usr/share/man/cat4/uvisor.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uvscom.0			man-sys-catman		.cat
 ./usr/share/man/cat4/uxrcom.0			man-sys-catman		.cat

CVS commit: src/tests/rump/modautoload

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 12:54:27 UTC 2020

Modified Files:
src/tests/rump/modautoload: Makefile

Log Message:
Do the same thing with linker flags instead of directly specifying the archives.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/rump/modautoload/Makefile

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

Modified files:

Index: src/tests/rump/modautoload/Makefile
diff -u src/tests/rump/modautoload/Makefile:1.10 src/tests/rump/modautoload/Makefile:1.11
--- src/tests/rump/modautoload/Makefile:1.10	Sat May 16 08:44:42 2020
+++ src/tests/rump/modautoload/Makefile	Sat May 16 08:54:27 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2020/05/16 12:44:42 christos Exp $
+#	$NetBSD: Makefile,v 1.11 2020/05/16 12:54:27 christos Exp $
 #
 
 .include 
@@ -15,11 +15,9 @@ SRCS.t_modautoload+=	t_modautoload.c
 # subdirectory -- otherwise the LDADD lines would get a little hairy.
 LDFLAGS+=	-Wl,-E
 LDADD+= \
--Wl,--whole-archive \
-${DESTDIR}/usr/lib/librumpvfs_nofifofs.a \
-${DESTDIR}/usr/lib/librumpvfs.a \
-${DESTDIR}/usr/lib/librump.a \
--Wl,--no-whole-archive
+-Wl,--whole-archive -Wl,-Bstatic \
+	-lrumpvfs_nofifofs -lrumpvfs -lrump \
+-Wl,-Bdynamic -Wl,--no-whole-archive
 
 LDADD+=		-lrumpuser -lpthread
 DPADD+=		${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER}



CVS commit: src/usr.bin/rump_server

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 12:46:57 UTC 2020

Modified Files:
src/usr.bin/rump_server: Makefile

Log Message:
More nofifo


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/rump_server/Makefile

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

Modified files:

Index: src/usr.bin/rump_server/Makefile
diff -u src/usr.bin/rump_server/Makefile:1.13 src/usr.bin/rump_server/Makefile:1.14
--- src/usr.bin/rump_server/Makefile:1.13	Sat Jun  1 02:59:18 2019
+++ src/usr.bin/rump_server/Makefile	Sat May 16 08:46:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2019/06/01 06:59:18 kre Exp $
+#	$NetBSD: Makefile,v 1.14 2020/05/16 12:46:57 christos Exp $
 #
 
 .PATH: ${.CURDIR}/../rump_allserver
@@ -7,7 +7,10 @@ PROG=		rump_server
 SRCS=		rump_allserver.c
 NOMAN=		installed by ../rump_allserver
 
-LDADD+=		-Wl,--whole-archive -lrumpkern_sysproxy -lrump -lrumpvfs \
-		-lrumpuser -Wl,--no-whole-archive -lpthread
+LDADD+= \
+-Wl,--whole-archive \
+	-lrumpkern_sysproxy -lrump -lrumpvfs_nofifofs -lrumpvfs -lrumpuser \
+-Wl,--no-whole-archive
+LDADD+= -lpthread
 
 .include 



CVS commit: src/tests/rump/modautoload

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 12:44:42 UTC 2020

Modified Files:
src/tests/rump/modautoload: Makefile

Log Message:
more nofifofs


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/rump/modautoload/Makefile

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

Modified files:

Index: src/tests/rump/modautoload/Makefile
diff -u src/tests/rump/modautoload/Makefile:1.9 src/tests/rump/modautoload/Makefile:1.10
--- src/tests/rump/modautoload/Makefile:1.9	Sat Aug 17 00:04:28 2019
+++ src/tests/rump/modautoload/Makefile	Sat May 16 08:44:42 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2019/08/17 04:04:28 kamil Exp $
+#	$NetBSD: Makefile,v 1.10 2020/05/16 12:44:42 christos Exp $
 #
 
 .include 
@@ -14,9 +14,13 @@ SRCS.t_modautoload+=	t_modautoload.c
 # on amd64.  This is the reason we keep this test in its own
 # subdirectory -- otherwise the LDADD lines would get a little hairy.
 LDFLAGS+=	-Wl,-E
-LDADD+=		-Wl,--whole-archive	${DESTDIR}/usr/lib/librumpvfs.a	\
-	${DESTDIR}/usr/lib/librump.a	\
-		-Wl,--no-whole-archive
+LDADD+= \
+-Wl,--whole-archive \
+${DESTDIR}/usr/lib/librumpvfs_nofifofs.a \
+${DESTDIR}/usr/lib/librumpvfs.a \
+${DESTDIR}/usr/lib/librump.a \
+-Wl,--no-whole-archive
+
 LDADD+=		-lrumpuser -lpthread
 DPADD+=		${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER}
 



CVS commit: src/usr.sbin/npf/npftest

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 12:42:11 UTC 2020

Modified Files:
src/usr.sbin/npf/npftest: Makefile

Log Message:
more nofifofs lossage


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/npf/npftest/Makefile

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

Modified files:

Index: src/usr.sbin/npf/npftest/Makefile
diff -u src/usr.sbin/npf/npftest/Makefile:1.12 src/usr.sbin/npf/npftest/Makefile:1.13
--- src/usr.sbin/npf/npftest/Makefile:1.12	Mon May 13 13:55:09 2019
+++ src/usr.sbin/npf/npftest/Makefile	Sat May 16 08:42:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2019/05/13 17:55:09 bad Exp $
+# $NetBSD: Makefile,v 1.13 2020/05/16 12:42:11 christos Exp $
 #
 # Public Domain
 #
@@ -17,8 +17,8 @@ LIBNPFTEST!=	cd ${.CURDIR}/libnpftest &&
 DPADD+=		${LIBNPFTEST}/libnpftest.a
 LDADD+=		-L${LIBNPFTEST} -lnpftest
 
-LDADD+=		-lrump -lrumpvfs -lrumpuser -lrumpnet -lrumpnet_net
-LDADD+=		-lrumpdev_bpf
+LDADD+=		-lrump -lrumpvfs_nofifofs -lrumpvfs -lrumpuser
+LDADD+=		-lrumpnet -lrumpnet_net	-lrumpdev_bpf
 
 .include 
 



CVS commit: src/usr.sbin/puffs

2020-05-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 16 12:30:36 UTC 2020

Modified Files:
src/usr.sbin/puffs: Makefile.inc

Log Message:
Oops forgot to commit this.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/puffs/Makefile.inc

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

Modified files:

Index: src/usr.sbin/puffs/Makefile.inc
diff -u src/usr.sbin/puffs/Makefile.inc:1.15 src/usr.sbin/puffs/Makefile.inc:1.16
--- src/usr.sbin/puffs/Makefile.inc:1.15	Sat Jan 23 16:22:50 2016
+++ src/usr.sbin/puffs/Makefile.inc	Sat May 16 08:30:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.15 2016/01/23 21:22:50 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2020/05/16 12:30:35 christos Exp $
 
 WARNS?=	4
 
@@ -43,7 +43,7 @@ LDADD+=		-lrumpfs_${MOUNTNAME}
 LDADD+=		-lrumpdev_disk -lrumpdev
 .endif
 
-LDADD+=		-lp2k -lukfs -lrumpvfs -lrump -lrumpuser -lpuffs -lutil
+LDADD+=		-lp2k -lukfs -lrumpvfs_nofifofs -lrumpvfs -lrump -lrumpuser -lpuffs -lutil
 LDADD+=		-lpthread
 
 DPADD+=		${LIBP2K} ${LIBUKFS} ${LIBRUMPVFS} ${LIBRUMP} ${LIBRUMPUSER}



CVS commit: src/sys/arch/sparc64/dev

2020-05-16 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sat May 16 07:16:14 UTC 2020

Modified Files:
src/sys/arch/sparc64/dev: tadpmu.c tadpmureg.h tadpmuvar.h

Log Message:
Extend the monitoring to battery state, with capacity based on voltage.
Add more PMU definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/dev/tadpmu.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/tadpmureg.h \
src/sys/arch/sparc64/dev/tadpmuvar.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/arch/sparc64/dev/tadpmu.c
diff -u src/sys/arch/sparc64/dev/tadpmu.c:1.4 src/sys/arch/sparc64/dev/tadpmu.c:1.5
--- src/sys/arch/sparc64/dev/tadpmu.c:1.4	Sun Oct 14 05:08:39 2018
+++ src/sys/arch/sparc64/dev/tadpmu.c	Sat May 16 07:16:14 2020
@@ -1,4 +1,4 @@
-/*/* $NetBSD: tadpmu.c,v 1.4 2018/10/14 05:08:39 macallan Exp $ */
+/*/* $NetBSD: tadpmu.c,v 1.5 2020/05/16 07:16:14 jdc Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz 
@@ -26,7 +26,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-/* a driver for the PMU found in Tadpole Wiper and possibly SPARCle laptops */
+/* a driver for the PMU found in Tadpole Viper and SPARCle laptops */
 
 #include "opt_tadpmu.h"
 #ifdef HAVE_TADPMU
@@ -56,13 +56,16 @@
 static bus_space_tag_t tadpmu_iot;
 static bus_space_handle_t tadpmu_hcmd;
 static bus_space_handle_t tadpmu_hdata;
-static struct sysmon_envsys *tadpmu_sme;
-static envsys_data_t tadpmu_sensors[5];
+static struct sysmon_envsys *tadpmu_sens_sme;
+static struct sysmon_envsys *tadpmu_acad_sme;
+static struct sysmon_envsys *tadpmu_batt_sme;
+static envsys_data_t tadpmu_sensors[8];
 static uint8_t idata = 0xff;
 static uint8_t ivalid = 0;
+static uint8_t ev_data = 0;
 static wchan_t tadpmu, tadpmuev;
-static struct sysmon_pswitch tadpmu_pbutton, tadpmu_lidswitch;
-static kmutex_t tadpmu_lock;
+static struct sysmon_pswitch tadpmu_pbutton, tadpmu_lidswitch, tadpmu_dcpower;
+static kmutex_t tadpmu_lock, data_lock;
 static lwp_t *tadpmu_thread;
 static int tadpmu_dying = 0;
 
@@ -202,10 +205,52 @@ tadpmu_send(uint8_t v)
 	}
 }
 
+static uint32_t
+tadpmu_battery_capacity(uint8_t gstat)
+{
+	uint8_t res;
+
+	if (gstat == GENSTAT_STATE_BATTERY_FULL) {
+		return ENVSYS_BATTERY_CAPACITY_NORMAL;
+	}
+
+	mutex_enter(_lock);
+	tadpmu_flush();
+	tadpmu_send_cmd(CMD_READ_VBATT);
+	res = tadpmu_recv();
+	mutex_exit(_lock);
+
+	if (gstat & GENSTAT_STATE_BATTERY_DISCHARGE) {
+		if (res < TADPMU_BATT_DIS_CAP_CRIT)
+			return ENVSYS_BATTERY_CAPACITY_CRITICAL;
+		if (res < TADPMU_BATT_DIS_CAP_WARN)
+			return ENVSYS_BATTERY_CAPACITY_WARNING;
+		if (res < TADPMU_BATT_DIS_CAP_LOW)
+			return ENVSYS_BATTERY_CAPACITY_LOW;
+		else
+			return ENVSYS_BATTERY_CAPACITY_NORMAL;
+	} else if (gstat == GENSTAT_STATE_BATTERY_CHARGE) {
+		if (res < TADPMU_BATT_CHG_CAP_CRIT)
+			return ENVSYS_BATTERY_CAPACITY_CRITICAL;
+		else if (res < TADPMU_BATT_CHG_CAP_WARN)
+			return ENVSYS_BATTERY_CAPACITY_WARNING;
+		else if (res < TADPMU_BATT_CHG_CAP_LOW)
+			return ENVSYS_BATTERY_CAPACITY_LOW;
+		else
+			return ENVSYS_BATTERY_CAPACITY_NORMAL;
+	} else {
+		DPRINTF("%s unknown battery state %02x\n",
+		__func__, gstat);
+		return ENVSYS_BATTERY_CAPACITY_NORMAL;
+	}
+}
+
+/* The data to read is calculated from the command and the units */
 static void
 tadpmu_sensors_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
 {
 	int res;
+
 	if (edata->private > 0) {
 		mutex_enter(_lock);
 		tadpmu_flush();
@@ -214,8 +259,27 @@ tadpmu_sensors_refresh(struct sysmon_env
 		mutex_exit(_lock);
 		if (edata->units == ENVSYS_STEMP) {
 			edata->value_cur = res * 100 + 27315;
+		} else if (edata->units == ENVSYS_SVOLTS_DC) {
+			edata->value_cur = res * 10;
+		} else if (edata->units == ENVSYS_BATTERY_CHARGE) {
+			if (res & GENSTAT_BATTERY_CHARGING)
+edata->value_cur = ENVSYS_INDICATOR_TRUE;
+			else
+edata->value_cur = ENVSYS_INDICATOR_FALSE;
+		} else if (edata->units == ENVSYS_BATTERY_CAPACITY) {
+			edata->value_cur = tadpmu_battery_capacity(res);
 		} else {
-			edata->value_cur = res;
+			if (edata->units == ENVSYS_INDICATOR &&
+			edata->private == CMD_READ_GENSTAT) {
+if (res & GENSTAT_DC_PRESENT)
+	edata->value_cur =
+	ENVSYS_INDICATOR_TRUE;
+else
+	edata->value_cur =
+	ENVSYS_INDICATOR_FALSE;
+			} else {
+edata->value_cur = res;
+			}
 		}
 		edata->state = ENVSYS_SVALID;
 	} else {
@@ -226,27 +290,73 @@ tadpmu_sensors_refresh(struct sysmon_env
 static void
 tadpmu_events(void *cookie)
 {
-	uint8_t res, ores = 0;
+	uint8_t events, gs, vb;
+
 	while (!tadpmu_dying) {
 		mutex_enter(_lock);
 		tadpmu_flush();
 		tadpmu_send_cmd(CMD_READ_GENSTAT);
-		res = tadpmu_recv();
+		gs = tadpmu_recv();
+		tadpmu_send_cmd(CMD_READ_VBATT);
+		vb = tadpmu_recv();
 		mutex_exit(_lock);
-		res &= GENSTAT_LID_CLOSED;
-		if (res != ores) {
-			ores = res;
+
+		mutex_enter(_lock);
+		events =