CVS commit: src/libexec/ld.elf_so

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 10:34:30 UTC 2019

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

Log Message:
improve error message


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/libexec/ld.elf_so/rtld.c

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



CVS commit: src/libexec/ld.elf_so

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 10:34:30 UTC 2019

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

Log Message:
improve error message


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/libexec/ld.elf_so/rtld.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/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.198 src/libexec/ld.elf_so/rtld.c:1.199
--- src/libexec/ld.elf_so/rtld.c:1.198	Sun Sep 15 13:40:46 2019
+++ src/libexec/ld.elf_so/rtld.c	Thu Oct  3 10:34:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.198 2019/09/15 13:40:46 kamil Exp $	 */
+/*	$NetBSD: rtld.c,v 1.199 2019/10/03 10:34:30 tnn Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.198 2019/09/15 13:40:46 kamil Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.199 2019/10/03 10:34:30 tnn Exp $");
 #endif /* not lint */
 
 #include 
@@ -1674,7 +1674,7 @@ _rtld_shared_enter(void)
 		if (cur == (self | RTLD_EXCLUSIVE_MASK)) {
 			if (_rtld_mutex_may_recurse)
 return;
-			_rtld_error("dead lock detected");
+			_rtld_error("%s: dead lock detected", __FUNCTION__);
 			_rtld_die();
 		}
 		waiter = atomic_swap_uint(&_rtld_waiter_shared, self);
@@ -1738,7 +1738,7 @@ _rtld_exclusive_enter(sigset_t *mask)
 		membar_sync();
 		cur = _rtld_mutex;
 		if (cur == locked_value) {
-			_rtld_error("dead lock detected");
+			_rtld_error("%s: dead lock detected", __FUNCTION__);
 			_rtld_die();
 		}
 		if (cur)



CVS commit: src/sys/dev/sdmmc

2019-10-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Oct  3 10:53:34 UTC 2019

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.h

Log Message:
More register definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sdmmc/if_bwfm_sdio.h

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



CVS commit: src/sys/dev/sdmmc

2019-10-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Oct  3 10:53:34 UTC 2019

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.h

Log Message:
More register definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.h
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.h:1.1 src/sys/dev/sdmmc/if_bwfm_sdio.h:1.2
--- src/sys/dev/sdmmc/if_bwfm_sdio.h:1.1	Sun Sep  1 05:51:45 2019
+++ src/sys/dev/sdmmc/if_bwfm_sdio.h	Thu Oct  3 10:53:34 2019
@@ -41,6 +41,11 @@
 #define BWFM_SDIO_FUNC1_SBADDRLOW		0x1000A
 #define BWFM_SDIO_FUNC1_SBADDRMID		0x1000B
 #define BWFM_SDIO_FUNC1_SBADDRHIGH		0x1000C
+#define BWFM_SDIO_FUNC1_FRAMECTRL		0x1000D
+#define  BWFM_SDIO_FUNC1_FRAMECTRL_RF_TERM		(1 << 0)
+#define  BWFM_SDIO_FUNC1_FRAMECTRL_WF_TERM		(1 << 1)
+#define  BWFM_SDIO_FUNC1_FRAMECTRL_CRC4WOOS		(1 << 2)
+#define  BWFM_SDIO_FUNC1_FRAMECTRL_ABORTALL		(1 << 3)
 #define BWFM_SDIO_FUNC1_CHIPCLKCSR		0x1000E
 #define  BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_ALP			0x01
 #define  BWFM_SDIO_FUNC1_CHIPCLKCSR_FORCE_HT			0x02
@@ -65,6 +70,11 @@
 		(BWFM_SDIO_FUNC1_CHIPCLKCSR_ALPAV(regval) && \
 		 (alponly ? 1 : BWFM_SDIO_FUNC1_CHIPCLKCSR_HTAV(regval)))
 #define BWFM_SDIO_FUNC1_SDIOPULLUP		0x1000F
+#define BWFM_SDIO_FUNC1_WFRAMEBCLO		0x10019
+#define BWFM_SDIO_FUNC1_WFRAMEBCHI		0x1001A
+#define BWFM_SDIO_FUNC1_RFRAMEBCLO		0x1001B
+#define BWFM_SDIO_FUNC1_RFRAMEBCHI		0x1001C
+#define BWFM_SDIO_FUNC1_MESBUSYCTRL		0x1001D
 #define BWFM_SDIO_FUNC1_WAKEUPCTRL		0x1001E
 #define  BWFM_SDIO_FUNC1_WAKEUPCTRL_HTWAIT		(1 << 1)
 #define BWFM_SDIO_FUNC1_SLEEPCSR		0x1001F



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

2019-10-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Oct  3 11:24:27 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c

Log Message:
remove debug printfs, add more compat strings.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/broadcom/bcm2835_gpio.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.14 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.15
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.14	Tue Oct  1 23:32:52 2019
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Thu Oct  3 11:24:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.14 2019/10/01 23:32:52 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.15 2019/10/03 11:24:27 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.14 2019/10/01 23:32:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.15 2019/10/03 11:24:27 mlelstv Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -241,7 +241,12 @@ bcm283x_pinctrl_set_config(device_t dev,
 static int
 bcmgpio_match(device_t parent, cfdata_t cf, void *aux)
 {
-	const char * const compatible[] = { "brcm,bcm2835-gpio", NULL };
+	const char * const compatible[] = {
+		"brcm,bcm2835-gpio",
+		"brcm,bcm2838-gpio",
+		"brcm,bcm2711-gpio",
+		NULL
+	};
 	struct fdt_attach_args * const faa = aux;
 
 	return of_match_compatible(faa->faa_phandle, compatible);
@@ -815,7 +820,6 @@ bcm283x_pin_setpull(const struct bcmgpio
 		mask = 1 << (pin % BCM2835_GPIO_GPPUD_PINS_PER_REGISTER);
 		regid = (pin / BCM2835_GPIO_GPPUD_PINS_PER_REGISTER);
 
-printf("2835: pin=%u, pud=%u, regid=%u, mask=%08x\n",pin,pud,regid,mask);
 		bus_space_write_4(sc->sc_iot, sc->sc_ioh,
 		BCM2835_GPIO_GPPUD, pud);
 		delay(1);
@@ -841,7 +845,6 @@ printf("2835: pin=%u, pud=%u, regid=%u, 
 			pud = BCM2838_GPIO_GPPUD_PULLOFF;
 			break;
 		}
-printf("2838: pin=%u, pud=%u, regid=%u, mask=%08x\n",pin,pud,regid,mask);
 
 		reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
 		BCM2838_GPIO_GPPUPPDN(regid));



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

2019-10-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Oct  3 11:24:27 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c

Log Message:
remove debug printfs, add more compat strings.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/broadcom/bcm2835_gpio.c

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



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

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 13:49:33 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Rework interrupt handling to reduce the number of wakeups required for
each command. Fix SDIO interrupt handling while here.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/sunxi/sunxi_mmc.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.37 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.38
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.37	Thu Sep  5 17:25:23 2019
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Thu Oct  3 13:49:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.37 2019/09/05 17:25:23 bouyer Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.38 2019/10/03 13:49:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.37 2019/09/05 17:25:23 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.38 2019/10/03 13:49:33 jmcneill Exp $");
 
 #include 
 #include 
@@ -98,6 +98,7 @@ static void	sunxi_mmc_attach_i(device_t)
 static int	sunxi_mmc_intr(void *);
 static int	sunxi_mmc_dmabounce_setup(struct sunxi_mmc_softc *);
 static int	sunxi_mmc_idma_setup(struct sunxi_mmc_softc *);
+static void	sunxi_mmc_dma_complete(struct sunxi_mmc_softc *, struct sdmmc_command *);
 
 static int	sunxi_mmc_host_reset(sdmmc_chipset_handle_t);
 static uint32_t	sunxi_mmc_host_ocr(sdmmc_chipset_handle_t);
@@ -153,7 +154,6 @@ struct sunxi_mmc_softc {
 	void *sc_ih;
 	kmutex_t sc_intr_lock;
 	kcondvar_t sc_intr_cv;
-	kcondvar_t sc_idst_cv;
 
 	int sc_mmc_width;
 	int sc_mmc_present;
@@ -175,10 +175,6 @@ struct sunxi_mmc_softc {
 	void *sc_dmabounce_buf;
 	size_t sc_dmabounce_buflen;
 
-	uint32_t sc_intr_rint;
-	uint32_t sc_intr_card;
-	uint32_t sc_idma_idst;
-
 	struct clk *sc_clk_ahb;
 	struct clk *sc_clk_mmc;
 	struct clk *sc_clk_output;
@@ -198,6 +194,12 @@ struct sunxi_mmc_softc {
 
 	bool sc_non_removable;
 	bool sc_broken_cd;
+
+	uint32_t sc_intr_card;
+	struct sdmmc_command *sc_curcmd;
+	bool sc_wait_dma;
+	bool sc_wait_cmd;
+	bool sc_wait_data;
 };
 
 CFATTACH_DECL_NEW(sunxi_mmc, sizeof(struct sunxi_mmc_softc),
@@ -351,8 +353,7 @@ sunxi_mmc_attach(device_t parent, device
 	sc->sc_bst = faa->faa_bst;
 	sc->sc_dmat = faa->faa_dmat;
 	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_BIO);
-	cv_init(&sc->sc_intr_cv, "awinmmcirq");
-	cv_init(&sc->sc_idst_cv, "awinmmcdma");
+	cv_init(&sc->sc_intr_cv, "sunximmcirq");
 
 	if (bus_space_map(sc->sc_bst, addr, size, 0, &sc->sc_bsh) != 0) {
 		aprint_error(": couldn't map registers\n");
@@ -598,78 +599,89 @@ static int
 sunxi_mmc_intr(void *priv)
 {
 	struct sunxi_mmc_softc *sc = priv;
-	uint32_t idst, rint, imask;
+	struct sdmmc_command *cmd;
+	uint32_t idst, mint, imask;
 
 	mutex_enter(&sc->sc_intr_lock);
 	idst = MMC_READ(sc, SUNXI_MMC_IDST);
-	rint = MMC_READ(sc, SUNXI_MMC_RINT);
-	if (!idst && !rint) {
+	mint = MMC_READ(sc, SUNXI_MMC_MINT);
+	if (!idst && !mint) {
 		mutex_exit(&sc->sc_intr_lock);
 		return 0;
 	}
 	MMC_WRITE(sc, SUNXI_MMC_IDST, idst);
-	MMC_WRITE(sc, SUNXI_MMC_RINT, rint);
-
-	DPRINTF(sc->sc_dev, "mmc intr idst=%08X rint=%08X\n",
-	idst, rint);
+	MMC_WRITE(sc, SUNXI_MMC_RINT, mint);
 
-	if (idst != 0) {
-		MMC_WRITE(sc, SUNXI_MMC_IDIE, 0);
-		sc->sc_idma_idst |= idst;
-		cv_broadcast(&sc->sc_idst_cv);
-	}
+	cmd = sc->sc_curcmd;
 
-	if ((rint & ~SUNXI_MMC_INT_SDIO_INT) != 0) {
-		imask = MMC_READ(sc, SUNXI_MMC_IMASK);
-		MMC_WRITE(sc, SUNXI_MMC_IMASK, imask & SUNXI_MMC_INT_SDIO_INT);
-		sc->sc_intr_rint |= (rint & ~SUNXI_MMC_INT_SDIO_INT);
-		cv_broadcast(&sc->sc_intr_cv);
-	}
+	DPRINTF(sc->sc_dev, "mmc intr idst=%08X mint=%08X\n",
+	idst, mint);
 
-	if ((rint & SUNXI_MMC_INT_SDIO_INT) != 0) {
+	/* Handle SDIO card interrupt */
+	if ((mint & SUNXI_MMC_INT_SDIO_INT) != 0) {
 		imask = MMC_READ(sc, SUNXI_MMC_IMASK);
 		MMC_WRITE(sc, SUNXI_MMC_IMASK, imask & ~SUNXI_MMC_INT_SDIO_INT);
 		sdmmc_card_intr(sc->sc_sdmmc_dev);
 	}
 
-	mutex_exit(&sc->sc_intr_lock);
+	/* Error interrupts take priority over command and transfer interrupts */
+	if (cmd != NULL && (mint & SUNXI_MMC_INT_ERROR) != 0) {
+		imask = MMC_READ(sc, SUNXI_MMC_IMASK);
+		MMC_WRITE(sc, SUNXI_MMC_IMASK, imask & ~SUNXI_MMC_INT_ERROR);
+		if ((mint & SUNXI_MMC_INT_RESP_TIMEOUT) != 0) {
+			cmd->c_error = ETIMEDOUT;
+			/* Wait for command to complete */
+			sc->sc_wait_data = sc->sc_wait_dma = false;
+			if (cmd->c_opcode != SD_IO_SEND_OP_COND &&
+			cmd->c_opcode != SD_IO_RW_DIRECT)
+device_printf(sc->sc_dev, "host controller timeout, mint=0x%08x\n", mint);
+		} else {
+			device_printf(sc->sc_dev, "host controller error, mint=0x%08x\n", mint);
+			cmd->c_error = EIO;
+			SET(cmd->c_flags, SCF_ITSDONE);
+			goto done;
+		}
+	}
 
-	re

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

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 13:49:33 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Rework interrupt handling to reduce the number of wakeups required for
each command. Fix SDIO interrupt handling while here.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/sunxi/sunxi_mmc.c

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



CVS commit: src/sys/net

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 14:41:14 UTC 2019

Modified Files:
src/sys/net: if_media.h

Log Message:
Add IFM_IEEE80211_VHT subtype, IFM_IEEE80211_11AC operating mode, and missing 
descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/net/if_media.h

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

Modified files:

Index: src/sys/net/if_media.h
diff -u src/sys/net/if_media.h:1.65 src/sys/net/if_media.h:1.66
--- src/sys/net/if_media.h:1.65	Fri May 17 07:37:12 2019
+++ src/sys/net/if_media.h	Thu Oct  3 14:41:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media.h,v 1.65 2019/05/17 07:37:12 msaitoh Exp $	*/
+/*	$NetBSD: if_media.h,v 1.66 2019/10/03 14:41:14 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc.
@@ -373,6 +373,7 @@
 #define	IFM_IEEE80211_OFDM27	23	/* OFDM 27Mbps */
 /* NB: not enough bits to express MCS fully */
 #define	IFM_IEEE80211_MCS	24	/* HT MCS rate */
+#define	IFM_IEEE80211_VHT	25	/* VHT MCS rate */
 
 /* IFM_OMASK bits */
 #define	IFM_IEEE80211_ADHOC	0x0100	/* Operate in Adhoc mode */
@@ -390,6 +391,7 @@
 #define	IFM_IEEE80211_FH	0x0004	/* 2 GHz, GFSK mode */
 #define	IFM_IEEE80211_11NA	0x0005	/* 5Ghz, HT mode */
 #define	IFM_IEEE80211_11NG	0x0006	/* 2Ghz, HT mode */
+#define	IFM_IEEE80211_11AC	0x0007	/* 2Ghz/5Ghz, VHT mode */
 
 
 /*
@@ -628,6 +630,8 @@ struct ifmedia_description {
 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM3,	"OFDM/3Mbps" },		\
 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM4,	"OFDM/4.5Mbps" },	\
 	{ IFM_IEEE80211 | IFM_IEEE80211_OFDM27, "OFDM/27Mbps" },	\
+	{ IFM_IEEE80211 | IFM_IEEE80211_MCS, "HT" },			\
+	{ IFM_IEEE80211 | IFM_IEEE80211_VHT, "VHT" },			\
 	\
 	{ 0, NULL },			\
 }
@@ -641,6 +645,7 @@ struct ifmedia_description {
 	{ IFM_IEEE80211 | IFM_IEEE80211_FH,	"fh" },			\
 	{ IFM_IEEE80211 | IFM_IEEE80211_11NA,	"11na" },		\
 	{ IFM_IEEE80211 | IFM_IEEE80211_11NG,	"11ng" },		\
+	{ IFM_IEEE80211 | IFM_IEEE80211_11AC,	"11ac" },		\
 	{ 0, NULL },			\
 }
 



CVS commit: src/sys/net

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 14:41:14 UTC 2019

Modified Files:
src/sys/net: if_media.h

Log Message:
Add IFM_IEEE80211_VHT subtype, IFM_IEEE80211_11AC operating mode, and missing 
descriptions


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/net/if_media.h

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



CVS commit: src/sys/dev/ic

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 14:42:20 UTC 2019

Modified Files:
src/sys/dev/ic: bwfm.c bwfmreg.h

Log Message:
If firmware is connected in HT or VHT mode, report it to SIOCGIFMEDIA


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/bwfmreg.h

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



CVS commit: src/sys/dev/ic

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 14:42:20 UTC 2019

Modified Files:
src/sys/dev/ic: bwfm.c bwfmreg.h

Log Message:
If firmware is connected in HT or VHT mode, report it to SIOCGIFMEDIA


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/bwfmreg.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/ic/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.16 src/sys/dev/ic/bwfm.c:1.17
--- src/sys/dev/ic/bwfm.c:1.16	Mon Sep  2 07:25:48 2019
+++ src/sys/dev/ic/bwfm.c	Thu Oct  3 14:42:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.16 2019/09/02 07:25:48 mlelstv Exp $ */
+/* $NetBSD: bwfm.c,v 1.17 2019/10/03 14:42:20 jmcneill Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -112,6 +112,7 @@ int	 bwfm_fwvar_var_set_int(struct bwfm_
 struct ieee80211_channel *bwfm_bss2chan(struct bwfm_softc *, struct bwfm_bss_info *);
 void	 bwfm_scan(struct bwfm_softc *);
 void	 bwfm_connect(struct bwfm_softc *);
+void	 bwfm_get_sta_info(struct bwfm_softc *, struct ifmediareq *);
 
 void	 bwfm_rx(struct bwfm_softc *, struct mbuf *);
 void	 bwfm_rx_event(struct bwfm_softc *, struct mbuf *);
@@ -512,6 +513,12 @@ bwfm_ioctl(struct ifnet *ifp, u_long cmd
 		}
 		break;
 
+	case SIOCGIFMEDIA:
+		error = ieee80211_ioctl(ic, cmd, data);
+		if (error == 0 && ic->ic_state == IEEE80211_S_RUN)
+			bwfm_get_sta_info(sc, (struct ifmediareq *)data);
+		break;
+
 	default:
 		error = ieee80211_ioctl(ic, cmd, data);
 	}
@@ -1789,6 +1796,50 @@ bwfm_connect(struct bwfm_softc *sc)
 }
 
 void
+bwfm_get_sta_info(struct bwfm_softc *sc, struct ifmediareq *ifmr)
+{
+	struct ieee80211com *ic = &sc->sc_ic;
+	struct ieee80211_node *ni = ic->ic_bss;
+	struct bwfm_sta_info sta;
+	uint32_t flags, txrate;
+
+	memset(&sta, 0, sizeof(sta));
+	memcpy(&sta, ni->ni_macaddr, sizeof(ni->ni_macaddr));
+
+	if (bwfm_fwvar_var_get_data(sc, "sta_info", &sta, sizeof(sta)))
+		return;
+
+	if (!IEEE80211_ADDR_EQ(ni->ni_macaddr, sta.ea))
+		return;
+
+	if (le16toh(sta.ver) < 4)
+		return;
+
+	flags = le32toh(sta.flags);
+	if ((flags & BWFM_STA_SCBSTATS) == 0)
+		return;
+
+	txrate = le32toh(sta.tx_rate);
+	if (txrate == 0x)
+		return;
+
+	if ((flags & BWFM_STA_VHT_CAP) != 0) {
+		ifmr->ifm_active &= ~IFM_TMASK;
+		ifmr->ifm_active |= IFM_IEEE80211_VHT;
+		ifmr->ifm_active &= ~IFM_MMASK;
+		ifmr->ifm_active |= IFM_IEEE80211_11AC;
+	} else if ((flags & BWFM_STA_N_CAP) != 0) {
+		ifmr->ifm_active &= ~IFM_TMASK;
+		ifmr->ifm_active |= IFM_IEEE80211_MCS;
+		ifmr->ifm_active &= ~IFM_MMASK;
+		if (IEEE80211_IS_CHAN_2GHZ(ic->ic_curchan))
+			ifmr->ifm_active |= IFM_IEEE80211_11NG;
+		else
+			ifmr->ifm_active |= IFM_IEEE80211_11NA;
+	}
+}
+
+void
 bwfm_rx(struct bwfm_softc *sc, struct mbuf *m)
 {
 	struct ieee80211com *ic = &sc->sc_ic;

Index: src/sys/dev/ic/bwfmreg.h
diff -u src/sys/dev/ic/bwfmreg.h:1.4 src/sys/dev/ic/bwfmreg.h:1.5
--- src/sys/dev/ic/bwfmreg.h:1.4	Sun Sep  1 05:40:39 2019
+++ src/sys/dev/ic/bwfmreg.h	Thu Oct  3 14:42:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmreg.h,v 1.4 2019/09/01 05:40:39 mlelstv Exp $ */
+/* $NetBSD: bwfmreg.h,v 1.5 2019/10/03 14:42:20 jmcneill Exp $ */
 /* $OpenBSD: bwfmreg.h,v 1.16 2018/02/07 21:44:09 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -391,6 +391,137 @@ struct bwfm_bss_info {
 	uint16_t snr;
 };
 
+#define BWFM_MAXRATES_IN_SET		BWFM_MCSSET_LEN
+#define BWFM_ANT_MAX			4
+#define BWFM_VHT_CAP_MCS_MAP_NSS_MAX	8
+#define BWFM_HE_CAP_MCS_MAP_NSS_MAX	BWFM_VHT_CAP_MCS_MAP_NSS_MAX
+
+struct bwfm_sta_rateset_v5 {
+	uint32_t count;
+	/* rates in 500kbps units w/hi bit set if basic */
+	uint8_t rates[BWFM_MAXRATES_IN_SET];
+	uint8_t mcs[BWFM_MCSSET_LEN];
+	uint16_t vht_mcs[BWFM_VHT_CAP_MCS_MAP_NSS_MAX];
+};
+
+struct bwfm_sta_rateset_v7 {
+	uint16_t version;
+	uint16_t len;
+	uint32_t count;
+	/* rates in 500kbps units w/hi bit set if basic */
+	uint8_t rates[BWFM_MAXRATES_IN_SET];
+	uint8_t mcs[BWFM_MCSSET_LEN];
+	uint16_t vht_mcs[BWFM_VHT_CAP_MCS_MAP_NSS_MAX];
+	uint16_t he_mcs[BWFM_HE_CAP_MCS_MAP_NSS_MAX];
+};
+
+struct bwfm_sta_info {
+	uint16_t ver;
+	uint16_t len;
+	uint16_t cap;		/* sta's advertised capabilities */
+
+	uint32_t flags;
+#define BWFM_STA_BRCM		0x0001 /* Running a Broadcom driver */
+#define BWFM_STA_WME		0x0002 /* WMM association */
+#define BWFM_STA_NONERP		0x0004 /* No ERP */
+#define BWFM_STA_AUTHE		0x0008 /* Authenticated */
+#define BWFM_STA_ASSOC		0x0010 /* Associated */
+#define BWFM_STA_AUTHO		0x0020 /* Authorized */
+#define BWFM_STA_WDS		0x0040 /* Wireless Distribution System */
+#define BWFM_STA_WDS_LINKUP	0x0080 /* WDS traffic/probes flowing */
+#define BWFM_STA_PS		0x0100 /* STA in power save mode, says AP */
+#define BWFM_STA_APSD_BE	0x0200 /* APSD for AC_BE

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

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 15:10:32 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Do not print timeout message when SCF_TOUT_OK flag is set


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/sunxi/sunxi_mmc.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.38 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.39
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.38	Thu Oct  3 13:49:33 2019
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Thu Oct  3 15:10:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.38 2019/10/03 13:49:33 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.39 2019/10/03 15:10:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.38 2019/10/03 13:49:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.39 2019/10/03 15:10:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -633,7 +633,8 @@ sunxi_mmc_intr(void *priv)
 			/* Wait for command to complete */
 			sc->sc_wait_data = sc->sc_wait_dma = false;
 			if (cmd->c_opcode != SD_IO_SEND_OP_COND &&
-			cmd->c_opcode != SD_IO_RW_DIRECT)
+			cmd->c_opcode != SD_IO_RW_DIRECT &&
+			!ISSET(cmd->c_flags, SCF_TOUT_OK))
 device_printf(sc->sc_dev, "host controller timeout, mint=0x%08x\n", mint);
 		} else {
 			device_printf(sc->sc_dev, "host controller error, mint=0x%08x\n", mint);



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

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 15:10:32 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Do not print timeout message when SCF_TOUT_OK flag is set


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/arm/sunxi/sunxi_mmc.c

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



CVS commit: src

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  3 15:21:44 UTC 2019

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
- Add definitions of AMD's CPUID Fn8000_001f Encrypted Memory features.
- Add definition of AMD's CPUID Fn8000_000a %edx bit 11 "GMET".
- Define CPUID_AMD_SVM_PFThreshold correctly.
- Modify comment a bit for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.106 -r1.107 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.153 src/sys/arch/x86/include/specialreg.h:1.154
--- src/sys/arch/x86/include/specialreg.h:1.153	Thu Sep 26 06:42:52 2019
+++ src/sys/arch/x86/include/specialreg.h	Thu Oct  3 15:21:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.153 2019/09/26 06:42:52 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.154 2019/10/03 15:21:44 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -646,7 +646,7 @@
 	"\31" "FXSR"	"\32" "FFXSR"	"\33" "P1GB"	"\34" "RDTSCP"	\
 			"\36" "LONG"	"\37" "3DNOW2"	"\40" "3DNOW"
 
-/* AMD Fn8001 extended features - %ecx */
+/* AMD Fn8000_0001 extended features - %ecx */
 /* 	CPUID_LAHF			   LAHF/SAHF instruction */
 #define CPUID_CMPLEGACY	0x0002	/* Compare Legacy */
 #define CPUID_SVM	0x0004	/* Secure Virtual Machine */
@@ -745,7 +745,7 @@
 	"\21IBRS_ALWAYSON" "\22STIBP_ALWAYSON" "\23PREFER_IBRS"	"\24B19" \
 	"\31SSBD"	"\32VIRT_SSBD"	"\33SSB_NO"
 
-/* AMD Fn800a %edx features (SVM features) */
+/* AMD Fn8000_000a %edx features (SVM features) */
 #define CPUID_AMD_SVM_NP		0x0001
 #define CPUID_AMD_SVM_LbrVirt		0x0002
 #define CPUID_AMD_SVM_SVML		0x0004
@@ -755,7 +755,8 @@
 #define CPUID_AMD_SVM_FlushByASID	0x0040
 #define CPUID_AMD_SVM_DecodeAssist	0x0080
 #define CPUID_AMD_SVM_PauseFilter	0x0400
-#define CPUID_AMD_SVM_PFThreshold	0x0x001000 /* PAUSE filter threshold */
+#define CPUID_AMD_SVM_GMET		0x0800
+#define CPUID_AMD_SVM_PFThreshold	0x1000 /* PAUSE filter threshold */
 #define CPUID_AMD_SVM_AVIC		0x2000 /* AMD Virtual intr. ctrl */
 #define CPUID_AMD_SVM_V_VMSAVE_VMLOAD	0x8000 /* Virtual VM{SAVE/LOAD} */
 #define CPUID_AMD_SVM_vGIF		0x0001 /* Virtualized GIF */
@@ -763,13 +764,13 @@
 	"\1" "NP"	"\2" "LbrVirt"	"\3" "SVML"	"\4" "NRIPS"	\
 	"\5" "TSCRate"	"\6" "VMCBCleanBits" \
 			"\7" "FlushByASID" "\10" "DecodeAssist"	\
-	"\11" "B08"	"\12" "B09"	"\13" "PauseFilter" "\14" "B11" \
+	"\11" "B08"	"\12" "B09"	"\13" "PauseFilter" "\14" "GMET" \
 	"\15" "PFThreshold" "\16" "AVIC" "\17" "B14"			\
 		"\20" "V_VMSAVE_VMLOAD"	\
 	"\21" "VGIF"
 
 /*
- * AMD Fn8000_0001d  Cache Topology Information.
+ * AMD Fn8000_0001d Cache Topology Information.
  * It's almost the same as Intel Deterministic Cache Parameter Leaf(0x04)
  * except the following:
  *	No Cores/package (%eax bit 31..26)
@@ -777,6 +778,24 @@
  */
 
 /*
+ * AMD Fn8000_0001f Encrypted Memory Capabilities.
+ * %eax: flags
+ * %ebx:  5-0: Cbit Position
+ *   11-6: PhysAddrReduction
+ * %ecx: 31-0: NumEncryptedGuests
+ * %edx: 31-0: MinSevNoEsAsid
+ */
+#define CPUID_AMD_ENCMEM_SME	__BIT(0)   /* Secure Memory Encryption */
+#define CPUID_AMD_ENCMEM_SEV	__BIT(1)   /* Secure Encrypted Virtualiz. */
+#define CPUID_AMD_ENCMEM_PGFLMSR __BIT(2)  /* Page Flush MSR */
+#define CPUID_AMD_ENCMEM_SEVES	__BIT(3)   /* SEV Encrypted State */
+#define CPUID_AMD_ENCMEM_VTE	__BIT(16)  /* Virtual Transparent Encryption */
+
+#define CPUID_AMD_ENCMEM_FLAGS	 "\20"	  \
+	"\1" "NP"	"\2" "SEV"	"\3" "PageFlushMsr"	"\4" "SEV-ES" \
+	"\21" "VTE"
+
+/*
  * Centaur Extended Feature flags
  */
 #define CPUID_VIA_HAS_RNG	0x0004	/* Random number generator */

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.106 src/usr.sbin/cpuctl/arch/i386.c:1.107
--- src/usr.sbin/cpuctl/arch/i386.c:1.106	Mon Sep  9 05:36:21 2019
+++ src/usr.sbin/cpuctl/arch/i386.c	Thu Oct  3 15:21:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.106 2019/09/09 05:36:21 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.107 2019/10/03 15:21:44 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.106 2019/09/09 05:36:21 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.107 2019/10/03 15:21:44 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -2312,6 +2312,11 @@ identifycpu(int fd, const char *cpuname)
 			print_bits(cpuname, "SVM features",
 			CPUID_AMD_SVM_FLAGS, descs[3]);
 		}
+		if (ci->ci_max_ext_cpuid >= 0x801f) {
+			x86_cpuid(0x801f, descs);
+			print_bits(cpuname, "Encrypted Memory features",
+			CPUID_

CVS commit: src

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  3 15:21:44 UTC 2019

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
- Add definitions of AMD's CPUID Fn8000_001f Encrypted Memory features.
- Add definition of AMD's CPUID Fn8000_000a %edx bit 11 "GMET".
- Define CPUID_AMD_SVM_PFThreshold correctly.
- Modify comment a bit for consistency.


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.106 -r1.107 src/usr.sbin/cpuctl/arch/i386.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

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  3 15:36:24 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c
src/sys/arch/arm/mpcore: mpcorereg.h

Log Message:
s/0x0x/0x/


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/acorn32/acorn32/rpc_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/mpcore/mpcorereg.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/acorn32/acorn32/rpc_machdep.c
diff -u src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.93 src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.94
--- src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.93	Tue Jul 16 14:41:43 2019
+++ src/sys/arch/acorn32/acorn32/rpc_machdep.c	Thu Oct  3 15:36:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_machdep.c,v 1.93 2019/07/16 14:41:43 skrll Exp $	*/
+/*	$NetBSD: rpc_machdep.c,v 1.94 2019/10/03 15:36:24 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2000-2002 Reinoud Zandijk.
@@ -55,7 +55,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.93 2019/07/16 14:41:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.94 2019/10/03 15:36:24 msaitoh Exp $");
 
 #include 
 #include 
@@ -518,7 +518,7 @@ initarm(void *cookie)
 #endif
 	for (loop = 0, physmem = 0; loop < bootconfig.dramblocks; ++loop) {
 #ifdef VERBOSE_INIT_ARM
-		printf("0x0x%x + 0x%0x, type = 0x%08x\n", bootconfig.dram[loop].address,
+		printf("0x%x + 0x%0x, type = 0x%08x\n", bootconfig.dram[loop].address,
  bootconfig.dram[loop].pages * PAGE_SIZE,
  bootconfig.dram[loop].flags);
 #endif

Index: src/sys/arch/arm/mpcore/mpcorereg.h
diff -u src/sys/arch/arm/mpcore/mpcorereg.h:1.1 src/sys/arch/arm/mpcore/mpcorereg.h:1.2
--- src/sys/arch/arm/mpcore/mpcorereg.h:1.1	Thu Mar 10 07:47:15 2011
+++ src/sys/arch/arm/mpcore/mpcorereg.h	Thu Oct  3 15:36:24 2019
@@ -32,7 +32,7 @@
  */
 #define	MPCORE_PMR_SCU 	0x
 #define	MPCORE_PMR_CII 	0x0100	/* CPU Interrupt Interface (for current core) */
-#define	MPCORE_PMR_CII_CORE(n)	(0x0x200 + 0x100 * (n))	/* for core N */
+#define	MPCORE_PMR_CII_CORE(n)	(0x200 + 0x100 * (n))	/* for core N */
 #define	MPCORE_PMR_CII_SIZE	0x100
 #define	MPCORE_PMR_TIMER	0x600	/* for current core */
 #define	MPCORE_PMR_TIMER_CORE(n)	(0x700 + 0x100 * (n))	/* for core N */



CVS commit: src/sys/arch

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Oct  3 15:36:24 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c
src/sys/arch/arm/mpcore: mpcorereg.h

Log Message:
s/0x0x/0x/


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/acorn32/acorn32/rpc_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/mpcore/mpcorereg.h

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



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

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:10:23 UTC 2019

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

Log Message:
realloc(ptr, 0) != { free(ptr); return NULL; }
http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/jemalloc/dist/src/jemalloc.c

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



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

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:10:23 UTC 2019

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

Log Message:
realloc(ptr, 0) != { free(ptr); return NULL; }
http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/jemalloc/dist/src/jemalloc.c

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

Modified files:

Index: src/external/bsd/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.8
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7	Thu Mar 14 17:49:32 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Thu Oct  3 12:10:23 2019
@@ -2328,6 +2328,8 @@ je_realloc(void *ptr, size_t size) {
 	LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size);
 
 	if (unlikely(size == 0)) {
+#if 0
+	// http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400
 		if (ptr != NULL) {
 			/* realloc(ptr, 0) is equivalent to free(ptr). */
 			UTRACE(ptr, 0, 0);
@@ -2343,6 +2345,7 @@ je_realloc(void *ptr, size_t size) {
 			LOG("core.realloc.exit", "result: %p", NULL);
 			return NULL;
 		}
+#endif
 		size = 1;
 	}
 



CVS commit: src/lib/libintl

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:35:57 UTC 2019

Modified Files:
src/lib/libintl: gettext.c

Log Message:
provide sizes so that we don't truncate accidentally.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libintl/gettext.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/libintl/gettext.c
diff -u src/lib/libintl/gettext.c:1.30 src/lib/libintl/gettext.c:1.31
--- src/lib/libintl/gettext.c:1.30	Mon Feb  4 03:21:11 2019
+++ src/lib/libintl/gettext.c	Thu Oct  3 12:35:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: gettext.c,v 1.30 2019/02/04 08:21:11 mrg Exp $	*/
+/*	$NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 Citrus Project,
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: gettext.c,v 1.30 2019/02/04 08:21:11 mrg Exp $");
+__RCSID("$NetBSD: gettext.c,v 1.31 2019/10/03 16:35:57 christos Exp $");
 
 #include 
 #include 
@@ -229,6 +229,7 @@ lookup_category(int category)
 	return NULL;
 }
 
+#define MAXBUFLEN	1024
 /*
  * XPG syntax: language[_territory[.codeset]][@modifier]
  * XXX boundary check on "result" is lacking
@@ -236,9 +237,9 @@ lookup_category(int category)
 static const char *
 split_locale(const char *lname)
 {
-	char buf[BUFSIZ], tmp[BUFSIZ];
+	char buf[MAXBUFLEN], tmp[2 * MAXBUFLEN];
 	char *l, *t, *c, *m;
-	static char result[BUFSIZ];
+	static char result[4 * MAXBUFLEN];
 
 	memset(result, 0, sizeof(result));
 



CVS commit: src/lib/libintl

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:35:57 UTC 2019

Modified Files:
src/lib/libintl: gettext.c

Log Message:
provide sizes so that we don't truncate accidentally.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/libintl/gettext.c

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



CVS commit: src/lib/libintl

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:37:45 UTC 2019

Modified Files:
src/lib/libintl: plural_parser.c

Log Message:
Since ch gets reassigned, it is not certain that it will be & or | again,
so return an illegal token if it is not instead of telling the compiler
that this is impossible.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libintl/plural_parser.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/libintl/plural_parser.c
diff -u src/lib/libintl/plural_parser.c:1.2 src/lib/libintl/plural_parser.c:1.3
--- src/lib/libintl/plural_parser.c:1.2	Wed Jan 17 18:24:22 2007
+++ src/lib/libintl/plural_parser.c	Thu Oct  3 12:37:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: plural_parser.c,v 1.2 2007/01/17 23:24:22 hubertf Exp $	*/
+/*	$NetBSD: plural_parser.c,v 1.3 2019/10/03 16:37:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005 Citrus Project,
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: plural_parser.c,v 1.2 2007/01/17 23:24:22 hubertf Exp $");
+__RCSID("$NetBSD: plural_parser.c,v 1.3 2019/10/03 16:37:45 christos Exp $");
 
 #include 
 #include 
@@ -188,8 +188,9 @@ retry:
 			return T_LAND;
 		case '|':
 			return T_LOR;
+		default:
+			return T_ILTOKEN;
 		}
-		/*NOTREACHED*/
 	case '=': case '!': case '<': case '>':
 		prevch = ch;
 		ch = _memstream_getc(&tcx->memstream);



CVS commit: src/lib/libintl

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 16:37:45 UTC 2019

Modified Files:
src/lib/libintl: plural_parser.c

Log Message:
Since ch gets reassigned, it is not certain that it will be & or | again,
so return an illegal token if it is not instead of telling the compiler
that this is impossible.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libintl/plural_parser.c

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:07:51 UTC 2019

Modified Files:
src/sys/arch/luna68k/dev [netbsd-9]: lunafb.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #271):

sys/arch/luna68k/dev/lunafb.c: revision 1.41

Correct size of framebuffer; page offset appears only once,
not every color depths.

Pointed out by Araki Ken. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/luna68k/dev/lunafb.c

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:07:51 UTC 2019

Modified Files:
src/sys/arch/luna68k/dev [netbsd-9]: lunafb.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #271):

sys/arch/luna68k/dev/lunafb.c: revision 1.41

Correct size of framebuffer; page offset appears only once,
not every color depths.

Pointed out by Araki Ken. Thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/arch/luna68k/dev/lunafb.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/luna68k/dev/lunafb.c
diff -u src/sys/arch/luna68k/dev/lunafb.c:1.40 src/sys/arch/luna68k/dev/lunafb.c:1.40.2.1
--- src/sys/arch/luna68k/dev/lunafb.c:1.40	Tue Jul 23 14:34:11 2019
+++ src/sys/arch/luna68k/dev/lunafb.c	Thu Oct  3 17:07:51 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: lunafb.c,v 1.40 2019/07/23 14:34:11 rin Exp $ */
+/* $NetBSD: lunafb.c,v 1.40.2.1 2019/10/03 17:07:51 martin Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.40 2019/07/23 14:34:11 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunafb.c,v 1.40.2.1 2019/10/03 17:07:51 martin Exp $");
 
 #include 
 #include 
@@ -308,8 +308,8 @@ omfbmmap(void *v, void *vs, off_t offset
 #endif
 	case WSDISPLAYIO_MODE_DUMBFB:
 		if (offset >= 0 &&
-		offset < (m68k_page_offset(OMFB_FB_RADDR) +
-		dc->dc_rowbytes * dc->dc_ht) * dc->dc_depth)
+		offset < m68k_page_offset(OMFB_FB_RADDR) +
+		dc->dc_rowbytes * dc->dc_ht * dc->dc_depth)
 			cookie = m68k_btop(m68k_trunc_page(OMFB_FB_RADDR) +
 			offset);
 		break;



CVS commit: src/lib/libskey

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:08:27 UTC 2019

Modified Files:
src/lib/libskey: put.c

Log Message:
use strlcpy here; the destination string is passed to strtok_r, and if it
is not NUL terminated, bad things can happen.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libskey/put.c

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



CVS commit: src/lib/libskey

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:08:27 UTC 2019

Modified Files:
src/lib/libskey: put.c

Log Message:
use strlcpy here; the destination string is passed to strtok_r, and if it
is not NUL terminated, bad things can happen.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libskey/put.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/libskey/put.c
diff -u src/lib/libskey/put.c:1.13 src/lib/libskey/put.c:1.14
--- src/lib/libskey/put.c:1.13	Fri Feb  4 11:14:55 2005
+++ src/lib/libskey/put.c	Thu Oct  3 13:08:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: put.c,v 1.13 2005/02/04 16:14:55 perry Exp $	*/
+/*	$NetBSD: put.c,v 1.14 2019/10/03 17:08:26 christos Exp $	*/
 
 /* S/KEY v1.1b (put.c)
  *
@@ -12,7 +12,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: put.c,v 1.13 2005/02/04 16:14:55 perry Exp $");
+__RCSID("$NetBSD: put.c,v 1.14 2019/10/03 17:08:26 christos Exp $");
 
 #include 
 #include 
@@ -2129,7 +2129,7 @@ int etob(char *out, const char *e)
   if (e == NULL)
 return -1;
 
-  strncpy (input, e, sizeof (input));
+  strlcpy (input, e, sizeof (input));
   memset (b, 0, sizeof (b));
   memset (out, 0, 8);
   for (i = 0, p = 0; i < 6; i++, p += 11)



CVS commit: src/lib/libbluetooth

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:10:16 UTC 2019

Modified Files:
src/lib/libbluetooth: bt_dev.c

Log Message:
Use strlcpy to NUL terminate the name string here. The kernel already
uses strlcpy() to set values in this field. We leave the kernel's strncmp()
alone to maintain compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.c

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



CVS commit: src/lib/libbluetooth

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:10:16 UTC 2019

Modified Files:
src/lib/libbluetooth: bt_dev.c

Log Message:
Use strlcpy to NUL terminate the name string here. The kernel already
uses strlcpy() to set values in this field. We leave the kernel's strncmp()
alone to maintain compatibility.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libbluetooth/bt_dev.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/libbluetooth/bt_dev.c
diff -u src/lib/libbluetooth/bt_dev.c:1.3 src/lib/libbluetooth/bt_dev.c:1.4
--- src/lib/libbluetooth/bt_dev.c:1.3	Mon Nov 22 14:59:04 2010
+++ src/lib/libbluetooth/bt_dev.c	Thu Oct  3 13:10:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $	*/
+/*	$NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 Iain Hibbert
@@ -59,7 +59,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: bt_dev.c,v 1.3 2010/11/22 19:59:04 plunky Exp $");
+__RCSID("$NetBSD: bt_dev.c,v 1.4 2019/10/03 17:10:16 christos Exp $");
 
 #include 
 #include 
@@ -92,7 +92,7 @@ bt_devaddr(const char *name, bdaddr_t *a
 		return bt_devname(NULL, addr);
 
 	memset(&btr, 0, sizeof(btr));
-	strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
+	strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
 
 	s = socket(PF_BLUETOOTH, SOCK_RAW, BTPROTO_HCI);
 	if (s == -1)
@@ -781,7 +781,7 @@ bt__devinfo(int s, const char *name, str
 	struct btreq			btr;
 
 	memset(&btr, 0, sizeof(btr));
-	strncpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
+	strlcpy(btr.btr_name, name, HCI_DEVNAME_SIZE);
 
 	if (ioctl(s, SIOCGBTINFO, &btr) == -1)
 		return -1;



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:12:53 UTC 2019

Modified Files:
src/sys/net [netbsd-9]: route.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #272):

sys/net/route.c: revision 1.222
sys/net/route.c: revision 1.224
sys/net/route.c: revision 1.225

Stop passing a large const structure by value, in order to avoid
possible kernel stack overflow; const pointer is suffice here.
Pointed out by the lgtm bot and kamil.
OK ozaki-r

 -

Fix a ifa_release() leak for a specific struct rt_addrinfo.
ok by ozaki-r@n.o

 -

Revert route.c:r1.224 to fix net/arp/t_arp and net/ndp/t_ndp failure.
And refactor a little. Discussed with ozaki-r@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.219.2.1 -r1.219.2.2 src/sys/net/route.c

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:12:53 UTC 2019

Modified Files:
src/sys/net [netbsd-9]: route.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #272):

sys/net/route.c: revision 1.222
sys/net/route.c: revision 1.224
sys/net/route.c: revision 1.225

Stop passing a large const structure by value, in order to avoid
possible kernel stack overflow; const pointer is suffice here.
Pointed out by the lgtm bot and kamil.
OK ozaki-r

 -

Fix a ifa_release() leak for a specific struct rt_addrinfo.
ok by ozaki-r@n.o

 -

Revert route.c:r1.224 to fix net/arp/t_arp and net/ndp/t_ndp failure.
And refactor a little. Discussed with ozaki-r@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.219.2.1 -r1.219.2.2 src/sys/net/route.c

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

Modified files:

Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.219.2.1 src/sys/net/route.c:1.219.2.2
--- src/sys/net/route.c:1.219.2.1	Tue Sep 24 03:10:35 2019
+++ src/sys/net/route.c	Thu Oct  3 17:12:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.219.2.1 2019/09/24 03:10:35 martin Exp $	*/
+/*	$NetBSD: route.c,v 1.219.2.2 2019/10/03 17:12:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.219.2.1 2019/09/24 03:10:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.219.2.2 2019/10/03 17:12:53 martin Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -1387,47 +1387,48 @@ rt_setgate(struct rtentry *rt, const str
 }
 
 static struct ifaddr *
-rt_update_get_ifa(const struct rt_addrinfo info, const struct rtentry *rt,
+rt_update_get_ifa(const struct rt_addrinfo *info, const struct rtentry *rt,
 struct ifnet **ifp, struct psref *psref_ifp, struct psref *psref)
 {
 	struct ifaddr *ifa = NULL;
 
 	*ifp = NULL;
-	if (info.rti_info[RTAX_IFP] != NULL) {
-		ifa = ifa_ifwithnet_psref(info.rti_info[RTAX_IFP], psref);
+	if (info->rti_info[RTAX_IFP] != NULL) {
+		ifa = ifa_ifwithnet_psref(info->rti_info[RTAX_IFP], psref);
 		if (ifa == NULL)
 			goto next;
 		*ifp = ifa->ifa_ifp;
 		if_acquire(*ifp, psref_ifp);
-		if (info.rti_info[RTAX_IFA] == NULL &&
-		info.rti_info[RTAX_GATEWAY] == NULL)
-			goto next;
+		if (info->rti_info[RTAX_IFA] == NULL &&
+		info->rti_info[RTAX_GATEWAY] == NULL)
+			goto out;
 		ifa_release(ifa, psref);
-		if (info.rti_info[RTAX_IFA] == NULL) {
+		if (info->rti_info[RTAX_IFA] == NULL) {
 			/* route change   -ifp  */
-			ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_GATEWAY],
-			*ifp, psref);
+			ifa = ifaof_ifpforaddr_psref(
+			info->rti_info[RTAX_GATEWAY], *ifp, psref);
 		} else {
 			/* route change  -ifp  -ifa  */
-			ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+			ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA],
+			psref);
 			if (ifa != NULL)
 goto out;
-			ifa = ifaof_ifpforaddr_psref(info.rti_info[RTAX_IFA],
+			ifa = ifaof_ifpforaddr_psref(info->rti_info[RTAX_IFA],
 			*ifp, psref);
 		}
 		goto out;
 	}
 next:
-	if (info.rti_info[RTAX_IFA] != NULL) {
+	if (info->rti_info[RTAX_IFA] != NULL) {
 		/* route change   -ifa  */
-		ifa = ifa_ifwithaddr_psref(info.rti_info[RTAX_IFA], psref);
+		ifa = ifa_ifwithaddr_psref(info->rti_info[RTAX_IFA], psref);
 		if (ifa != NULL)
 			goto out;
 	}
-	if (info.rti_info[RTAX_GATEWAY] != NULL) {
+	if (info->rti_info[RTAX_GATEWAY] != NULL) {
 		/* route change   */
 		ifa = ifa_ifwithroute_psref(rt->rt_flags, rt_getkey(rt),
-		info.rti_info[RTAX_GATEWAY], psref);
+		info->rti_info[RTAX_GATEWAY], psref);
 	}
 out:
 	if (ifa != NULL && *ifp == NULL) {
@@ -1487,7 +1488,7 @@ rt_update(struct rtentry *rt, struct rt_
 	 * flags may also be different; ifp may be specified
 	 * by ll sockaddr when protocol address is ambiguous
 	 */
-	new_ifa = rt_update_get_ifa(*info, rt, &new_ifp, &psref_new_ifp,
+	new_ifa = rt_update_get_ifa(info, rt, &new_ifp, &psref_new_ifp,
 	&psref_new_ifa);
 	if (new_ifa != NULL) {
 		ifa_release(ifa, &psref_ifa);



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:14:48 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64 files.evbarm

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #273):

sys/arch/evbarm/conf/files.evbarm: revision 1.33
sys/arch/evbarm/conf/GENERIC64: revision 1.108

Increase maxusers to 64 for 64-bit kernels


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.1 -r1.103.2.2 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/evbarm/conf/files.evbarm

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:14:48 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf [netbsd-9]: GENERIC64 files.evbarm

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #273):

sys/arch/evbarm/conf/files.evbarm: revision 1.33
sys/arch/evbarm/conf/GENERIC64: revision 1.108

Increase maxusers to 64 for 64-bit kernels


To generate a diff of this commit:
cvs rdiff -u -r1.103.2.1 -r1.103.2.2 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.32 -r1.32.4.1 src/sys/arch/evbarm/conf/files.evbarm

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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.103.2.1 src/sys/arch/evbarm/conf/GENERIC64:1.103.2.2
--- src/sys/arch/evbarm/conf/GENERIC64:1.103.2.1	Mon Sep 23 07:04:40 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Thu Oct  3 17:14:47 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.103.2.1 2019/09/23 07:04:40 martin Exp $
+#	$NetBSD: GENERIC64,v 1.103.2.2 2019/10/03 17:14:47 martin Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -8,6 +8,8 @@ include	"arch/evbarm/conf/std.generic64"
 include "arch/evbarm/conf/files.generic64"
 include	"arch/evbarm/conf/GENERIC.common"
 
+maxusers	64
+
 #
 # FDT files supported by this kernel - add to DTSSUBDIR and DTS as
 # appropriate

Index: src/sys/arch/evbarm/conf/files.evbarm
diff -u src/sys/arch/evbarm/conf/files.evbarm:1.32 src/sys/arch/evbarm/conf/files.evbarm:1.32.4.1
--- src/sys/arch/evbarm/conf/files.evbarm:1.32	Sun Oct 21 00:42:06 2018
+++ src/sys/arch/evbarm/conf/files.evbarm	Thu Oct  3 17:14:47 2019
@@ -1,10 +1,10 @@
-#	$NetBSD: files.evbarm,v 1.32 2018/10/21 00:42:06 jmcneill Exp $
+#	$NetBSD: files.evbarm,v 1.32.4.1 2019/10/03 17:14:47 martin Exp $
 #
 # First try for arm-specific configuration info
 #
 
 maxpartitions	8
-maxusers	2 8 64
+maxusers	2 8 128
 
 # Maintain Interrupt statistics
 defflag			IRQSTATS



CVS commit: [netbsd-9] src/sys/external/bsd/ipf/netinet

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:18:32 UTC 2019

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-9]: fil.c ip_fil_netbsd.c

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

sys/external/bsd/ipf/netinet/fil.c: revision 1.31
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.32
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.33

Fix 2 bugs, reported by Edgar Fuss on tech-net@
- pfil_run_hooks() can be called recursively, so we have to
  #define FASTROUTE_RECURSION in fil.c
- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
  to set *mpp to NULL so the caller won't try to free it again.

fix double space in comment


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.31 -r1.31.4.1 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.1 src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.2
--- src/sys/external/bsd/ipf/netinet/fil.c:1.29.2.1	Fri Aug  9 19:18:47 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c	Thu Oct  3 17:18:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.29.2.1 2019/08/09 19:18:47 martin Exp $	*/
+/*	$NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.1 2019/08/09 19:18:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.29.2.2 2019/10/03 17:18:32 martin Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -155,6 +155,8 @@ extern	int	opts;
 extern	int	blockreason;
 #endif /* _KERNEL */
 
+#define FASTROUTE_RECURSION
+
 #define	LBUMP(x)	softc->x++
 #define	LBUMPD(x, y)	do { softc->x.y++; DT(y); } while (0)
 

Index: src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c
diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.31 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.31.4.1
--- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.31	Fri Aug 10 07:16:13 2018
+++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	Thu Oct  3 17:18:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil_netbsd.c,v 1.31 2018/08/10 07:16:13 maxv Exp $	*/
+/*	$NetBSD: ip_fil_netbsd.c,v 1.31.4.1 2019/10/03 17:18:32 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -8,7 +8,7 @@
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.31 2018/08/10 07:16:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.31.4.1 2019/10/03 17:18:32 martin Exp $");
 #else
 static const char sccsid[] = "@(#)ip_fil.c	2.41 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp";
@@ -1493,6 +1493,8 @@ ipf_fastroute6(struct mbuf *m0, struct m
 # else
 			error = nd6_output(ifp, ifp, m0, dst6, rt);
 # endif
+			if (error)
+*mpp = NULL; /* m0 has been freed */
 		} else {
 			error = EMSGSIZE;
 		}



CVS commit: [netbsd-9] src/sys/external/bsd/ipf/netinet

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:18:32 UTC 2019

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-9]: fil.c ip_fil_netbsd.c

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

sys/external/bsd/ipf/netinet/fil.c: revision 1.31
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.32
sys/external/bsd/ipf/netinet/ip_fil_netbsd.c: revision 1.33

Fix 2 bugs, reported by Edgar Fuss on tech-net@
- pfil_run_hooks() can be called recursively, so we have to
  #define FASTROUTE_RECURSION in fil.c
- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
  to set *mpp to NULL so the caller won't try to free it again.

fix double space in comment


To generate a diff of this commit:
cvs rdiff -u -r1.29.2.1 -r1.29.2.2 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.31 -r1.31.4.1 \
src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:20:33 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #275):

sys/kern/sysv_shm.c: revision 1.139

in shmdt(), wait until shmat() completes before detaching.


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

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:20:33 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #275):

sys/kern/sysv_shm.c: revision 1.139

in shmdt(), wait until shmat() completes before detaching.


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

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

Modified files:

Index: src/sys/kern/sysv_shm.c
diff -u src/sys/kern/sysv_shm.c:1.135.2.2 src/sys/kern/sysv_shm.c:1.135.2.3
--- src/sys/kern/sysv_shm.c:1.135.2.2	Fri Sep 13 06:25:26 2019
+++ src/sys/kern/sysv_shm.c	Thu Oct  3 17:20:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysv_shm.c,v 1.135.2.2 2019/09/13 06:25:26 martin Exp $	*/
+/*	$NetBSD: sysv_shm.c,v 1.135.2.3 2019/10/03 17:20:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2007 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.135.2.2 2019/09/13 06:25:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysv_shm.c,v 1.135.2.3 2019/10/03 17:20:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -87,6 +87,7 @@ struct shmmap_entry {
 	SLIST_ENTRY(shmmap_entry) next;
 	vaddr_t va;
 	int shmid;
+	bool busy;
 };
 
 int			shm_nused		__cacheline_aligned;
@@ -313,8 +314,10 @@ sys_shmdt(struct lwp *l, const struct sy
 	struct uvm_object *uobj;
 	struct shmid_ds *shmseg;
 	size_t size;
+	int segnum;
 
 	mutex_enter(&shm_lock);
+restart:
 	/* In case of reallocation, we will wait for completion */
 	while (__predict_false(shm_realloc_state))
 		cv_wait(&shm_realloc_cv, &shm_lock);
@@ -346,12 +349,18 @@ sys_shmdt(struct lwp *l, const struct sy
 		}
 	}
 
+	segnum = IPCID_TO_IX(shmmap_se->shmid);
+	if (shmmap_se->busy) {
+		cv_wait(&shm_cv[segnum], &shm_lock);
+		goto restart;
+	}
+
 	SHMPRINTF(("shmdt: vm %p: remove %d @%lx\n",
 	p->p_vmspace, shmmap_se->shmid, shmmap_se->va));
 
 	/* Delete the entry from shm map */
 	uobj = shm_delete_mapping(shmmap_s, shmmap_se);
-	shmseg = &shmsegs[IPCID_TO_IX(shmmap_se->shmid)];
+	shmseg = &shmsegs[segnum];
 	size = (shmseg->shm_segsz + PGOFSET) & ~PGOFSET;
 	mutex_exit(&shm_lock);
 
@@ -386,10 +395,13 @@ sys_shmat(struct lwp *l, const struct sy
 	vaddr_t attach_va;
 	vm_prot_t prot;
 	vsize_t size;
+	int segnum;
 
 	/* Allocate a new map entry and set it */
 	shmmap_se = kmem_alloc(sizeof(struct shmmap_entry), KM_SLEEP);
 	shmmap_se->shmid = SCARG(uap, shmid);
+	shmmap_se->busy = true;
+	segnum = IPCID_TO_IX(shmmap_se->shmid);
 
 	mutex_enter(&shm_lock);
 	/* In case of reallocation, we will wait for completion */
@@ -466,11 +478,13 @@ sys_shmat(struct lwp *l, const struct sy
 	/* Set the new address, and update the time */
 	mutex_enter(&shm_lock);
 	shmmap_se->va = attach_va;
+	shmmap_se->busy = false;
 	shmseg->shm_atime = time_second;
 	shm_realloc_disable--;
 	retval[0] = attach_va;
 	SHMPRINTF(("shmat: vm %p: add %d @%lx\n",
 	p->p_vmspace, shmmap_se->shmid, attach_va));
+	cv_broadcast(&shm_cv[segnum]);
 err:
 	cv_broadcast(&shm_realloc_cv);
 	mutex_exit(&shm_lock);
@@ -484,6 +498,7 @@ err_detach:
 	mutex_enter(&shm_lock);
 	uobj = shm_delete_mapping(shmmap_s, shmmap_se);
 	shm_realloc_disable--;
+	cv_broadcast(&shm_cv[segnum]);
 	cv_broadcast(&shm_realloc_cv);
 	mutex_exit(&shm_lock);
 	if (uobj != NULL) {



CVS commit: [netbsd-9] src/sys

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:23:12 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic [netbsd-9]: meson_pinctrl.c
src/sys/arch/arm/broadcom [netbsd-9]: bcm2835_gpio.c
src/sys/arch/arm/nvidia [netbsd-9]: tegra_pinmux.c
src/sys/arch/arm/rockchip [netbsd-9]: rk3328_iomux.c rk3399_iomux.c
src/sys/arch/arm/samsung [netbsd-9]: exynos_pinctrl.c
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gpio.c
src/sys/dev/fdt [netbsd-9]: fdt_pinctrl.c fdtbus.c fdtvar.h
src/sys/dev/i2c [netbsd-9]: axppmic.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #276):

sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.14
sys/arch/arm/rockchip/rk3399_iomux.c: revision 1.6
sys/dev/fdt/fdtvar.h: revision 1.54
sys/arch/arm/broadcom/bcm2835_gpio.c: revision 1.14
sys/dev/i2c/axppmic.c: revision 1.26
sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.4
sys/arch/arm/rockchip/rk3328_iomux.c: revision 1.3
sys/dev/fdt/fdt_pinctrl.c: revision 1.10
sys/arch/arm/amlogic/meson_pinctrl.c: revision 1.6
sys/dev/fdt/fdtbus.c: revision 1.30
sys/arch/arm/sunxi/sunxi_gpio.c: revision 1.27

Add support for devices with separate "init" and "default" pinctrl states.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/amlogic/meson_pinctrl.c
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.2.4.1 -r1.2.4.2 src/sys/arch/arm/nvidia/tegra_pinmux.c
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/arm/rockchip/rk3328_iomux.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/arm/rockchip/rk3399_iomux.c
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/arch/arm/sunxi/sunxi_gpio.c
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.52 -r1.52.2.1 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/i2c/axppmic.c

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



CVS commit: [netbsd-9] src/sys

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:23:12 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic [netbsd-9]: meson_pinctrl.c
src/sys/arch/arm/broadcom [netbsd-9]: bcm2835_gpio.c
src/sys/arch/arm/nvidia [netbsd-9]: tegra_pinmux.c
src/sys/arch/arm/rockchip [netbsd-9]: rk3328_iomux.c rk3399_iomux.c
src/sys/arch/arm/samsung [netbsd-9]: exynos_pinctrl.c
src/sys/arch/arm/sunxi [netbsd-9]: sunxi_gpio.c
src/sys/dev/fdt [netbsd-9]: fdt_pinctrl.c fdtbus.c fdtvar.h
src/sys/dev/i2c [netbsd-9]: axppmic.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #276):

sys/arch/arm/samsung/exynos_pinctrl.c: revision 1.14
sys/arch/arm/rockchip/rk3399_iomux.c: revision 1.6
sys/dev/fdt/fdtvar.h: revision 1.54
sys/arch/arm/broadcom/bcm2835_gpio.c: revision 1.14
sys/dev/i2c/axppmic.c: revision 1.26
sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.4
sys/arch/arm/rockchip/rk3328_iomux.c: revision 1.3
sys/dev/fdt/fdt_pinctrl.c: revision 1.10
sys/arch/arm/amlogic/meson_pinctrl.c: revision 1.6
sys/dev/fdt/fdtbus.c: revision 1.30
sys/arch/arm/sunxi/sunxi_gpio.c: revision 1.27

Add support for devices with separate "init" and "default" pinctrl states.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.6.1 src/sys/arch/arm/amlogic/meson_pinctrl.c
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.2.4.1 -r1.2.4.2 src/sys/arch/arm/nvidia/tegra_pinmux.c
cvs rdiff -u -r1.2 -r1.2.6.1 src/sys/arch/arm/rockchip/rk3328_iomux.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/arm/rockchip/rk3399_iomux.c
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/arch/arm/sunxi/sunxi_gpio.c
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.29 -r1.29.2.1 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.52 -r1.52.2.1 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/i2c/axppmic.c

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

Modified files:

Index: src/sys/arch/arm/amlogic/meson_pinctrl.c
diff -u src/sys/arch/arm/amlogic/meson_pinctrl.c:1.5 src/sys/arch/arm/amlogic/meson_pinctrl.c:1.5.6.1
--- src/sys/arch/arm/amlogic/meson_pinctrl.c:1.5	Fri Apr 19 19:07:56 2019
+++ src/sys/arch/arm/amlogic/meson_pinctrl.c	Thu Oct  3 17:23:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $ */
+/* $NetBSD: meson_pinctrl.c,v 1.5.6.1 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.5 2019/04/19 19:07:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.5.6.1 2019/10/03 17:23:11 martin Exp $");
 
 #include 
 #include 
@@ -575,8 +575,6 @@ meson_pinctrl_attach(device_t parent, de
 	aprint_naive("\n");
 	aprint_normal(": %s\n", sc->sc_conf->name);
 
-	fdtbus_pinctrl_configure();
-
 	meson_pinctrl_initgpio(sc);
 }
 

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.12 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.12.2.1
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.12	Fri May 10 08:28:50 2019
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Thu Oct  3 17:23:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.12.2.1 2019/10/03 17:23:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.12.2.1 2019/10/03 17:23:11 martin Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -348,8 +348,6 @@ bcmgpio_attach(device_t parent, device_t
 		&bcm283x_pinctrl_funcs);
 	}
 
-	fdtbus_pinctrl_configure();
-
 	fdtbus_register_interrupt_controller(self, phandle,
 	&bcmgpio_fdt_intrfuncs);
 

Index: src/sys/arch/arm/nvidia/tegra_pinmux.c
diff -u src/sys/arch/arm/nvidia/tegra_pinmux.c:1.2.4.1 src/sys/arch/arm/nvidia/tegra_pinmux.c:1.2.4.2
--- src/sys/arch/arm/nvidia/tegra_pinmux.c:1.2.4.1	Sat Sep 28 12:21:29 2019
+++ src/sys/arch/arm/nvidia/tegra_pinmux.c	Thu Oct  3 17:23:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_pinmux.c,v 1.2.4.1 2019/09/28 12:21:29 martin Exp $ */
+/* $NetBSD: tegra_pinmux.c,v 1.2.4.2 2019/10/03 17:23:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_tegra.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.2.4.1 2019/09/28 12:21:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_pinmux.c,v 1.2.4.2 2019/10/03 17:23:11 martin Exp $");
 
 #include 
 #include 
@@ -285,8 +285,6 @@ tegra_pinmux_attac

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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:26:00 UTC 2019

Modified Files:
src/sys/arch/i386/stand/pxeboot [netbsd-9]: Makefile start_pxe.S

Log Message:
Pull up following revision(s) (requested by manu in ticket #277):

sys/arch/i386/stand/pxeboot/start_pxe.S: revision 1.7
sys/arch/i386/stand/pxeboot/Makefile: revision 1.28

Incrase pxeboot code size limit from 64k to 128k.  Fixes PR kern/54560.
The start_pxe.S part was suggested by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.25.6.1 -r1.25.6.2 src/sys/arch/i386/stand/pxeboot/Makefile
cvs rdiff -u -r1.6 -r1.6.60.1 src/sys/arch/i386/stand/pxeboot/start_pxe.S

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



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

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:26:00 UTC 2019

Modified Files:
src/sys/arch/i386/stand/pxeboot [netbsd-9]: Makefile start_pxe.S

Log Message:
Pull up following revision(s) (requested by manu in ticket #277):

sys/arch/i386/stand/pxeboot/start_pxe.S: revision 1.7
sys/arch/i386/stand/pxeboot/Makefile: revision 1.28

Incrase pxeboot code size limit from 64k to 128k.  Fixes PR kern/54560.
The start_pxe.S part was suggested by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.25.6.1 -r1.25.6.2 src/sys/arch/i386/stand/pxeboot/Makefile
cvs rdiff -u -r1.6 -r1.6.60.1 src/sys/arch/i386/stand/pxeboot/start_pxe.S

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

Modified files:

Index: src/sys/arch/i386/stand/pxeboot/Makefile
diff -u src/sys/arch/i386/stand/pxeboot/Makefile:1.25.6.1 src/sys/arch/i386/stand/pxeboot/Makefile:1.25.6.2
--- src/sys/arch/i386/stand/pxeboot/Makefile:1.25.6.1	Tue Sep 17 19:32:00 2019
+++ src/sys/arch/i386/stand/pxeboot/Makefile	Thu Oct  3 17:26:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25.6.1 2019/09/17 19:32:00 martin Exp $
+#	$NetBSD: Makefile,v 1.25.6.2 2019/10/03 17:26:00 martin Exp $
 
 S=	${.CURDIR}/../../../..
 
@@ -66,7 +66,7 @@ CPPFLAGS+= -DBOOTPARAM_DEFFLAGS=0x0c
 #CFLAGS= -O2 -fomit-frame-pointer -fno-defer-pop
 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wno-main
 
-SAMISCCPPFLAGS+= -DHEAP_START=0x1 -DHEAP_LIMIT=0x3
+SAMISCCPPFLAGS+= -DHEAP_START=0x2 -DHEAP_LIMIT=0x4
 SAMISCMAKEFLAGS+= SA_USE_CREAD=yes	# Read compressed kernels
 
 CPPFLAGS+= -DPASS_BIOSGEOM

Index: src/sys/arch/i386/stand/pxeboot/start_pxe.S
diff -u src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6 src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6.60.1
--- src/sys/arch/i386/stand/pxeboot/start_pxe.S:1.6	Fri Mar 18 17:46:26 2011
+++ src/sys/arch/i386/stand/pxeboot/start_pxe.S	Thu Oct  3 17:26:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: start_pxe.S,v 1.6 2011/03/18 17:46:26 jakllsch Exp $	*/
+/*	$NetBSD: start_pxe.S,v 1.6.60.1 2019/10/03 17:26:00 martin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@ _C_LABEL(boot_params):
 	# set up %ss and %sp
 	movl	$_end, %eax		/* top of bss */
 	shrl	$4, %eax		/* as a segment */
-	addw	$0x1001, %ax		/* and + 64k */
+	addw	$0x2001, %ax		/* and + 128k */
 	movw	%ax, %ss		/* for stack */
 	movw	$0xfffc, %sp		/* %sp at top of it */
 



CVS commit: [netbsd-9] src/external/bsd/jemalloc/dist/src

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:29:33 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src [netbsd-9]: jemalloc.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #278):

external/bsd/jemalloc/dist/src/jemalloc.c: revision 1.8

realloc(ptr, 0) != { free(ptr); return NULL; }
http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/external/bsd/jemalloc/dist/src/jemalloc.c

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



CVS commit: [netbsd-9] src/external/bsd/jemalloc/dist/src

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:29:33 UTC 2019

Modified Files:
src/external/bsd/jemalloc/dist/src [netbsd-9]: jemalloc.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #278):

external/bsd/jemalloc/dist/src/jemalloc.c: revision 1.8

realloc(ptr, 0) != { free(ptr); return NULL; }
http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/external/bsd/jemalloc/dist/src/jemalloc.c

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

Modified files:

Index: src/external/bsd/jemalloc/dist/src/jemalloc.c
diff -u src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7 src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7.4.1
--- src/external/bsd/jemalloc/dist/src/jemalloc.c:1.7	Thu Mar 14 21:49:32 2019
+++ src/external/bsd/jemalloc/dist/src/jemalloc.c	Thu Oct  3 17:29:33 2019
@@ -2328,6 +2328,8 @@ je_realloc(void *ptr, size_t size) {
 	LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size);
 
 	if (unlikely(size == 0)) {
+#if 0
+	// http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400
 		if (ptr != NULL) {
 			/* realloc(ptr, 0) is equivalent to free(ptr). */
 			UTRACE(ptr, 0, 0);
@@ -2343,6 +2345,7 @@ je_realloc(void *ptr, size_t size) {
 			LOG("core.realloc.exit", "result: %p", NULL);
 			return NULL;
 		}
+#endif
 		size = 1;
 	}
 



CVS commit: [netbsd-9] src/external/mpl/bind/dist/lib/isc

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:31:02 UTC 2019

Modified Files:
src/external/mpl/bind/dist/lib/isc [netbsd-9]: siphash.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #279):

external/mpl/bind/dist/lib/isc/siphash.c: revision 1.3

PR/54594: Martin Husemann: bind may crash at startup

Use memcpy(3) instead of assuming casting "uint8_t *" to "uint64_t *" and
de-referencing works.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/external/mpl/bind/dist/lib/isc/siphash.c

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

Modified files:

Index: src/external/mpl/bind/dist/lib/isc/siphash.c
diff -u src/external/mpl/bind/dist/lib/isc/siphash.c:1.2.2.2 src/external/mpl/bind/dist/lib/isc/siphash.c:1.2.2.3
--- src/external/mpl/bind/dist/lib/isc/siphash.c:1.2.2.2	Thu Sep 12 19:18:16 2019
+++ src/external/mpl/bind/dist/lib/isc/siphash.c	Thu Oct  3 17:31:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: siphash.c,v 1.2.2.2 2019/09/12 19:18:16 martin Exp $	*/
+/*	$NetBSD: siphash.c,v 1.2.2.3 2019/10/03 17:31:02 martin Exp $	*/
 
 /*
  * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
@@ -60,9 +60,13 @@
 void
 isc_siphash24(const uint8_t *k, const uint8_t *in, size_t inlen, uint8_t *out)
 {
-	const uint64_t *key = (const uint64_t *)k;
-	uint64_t k0 = le64toh(key[0]);
-	uint64_t k1 = le64toh(key[1]);
+	uint64_t k0, k1;
+
+	memcpy(&k0, k, sizeof(k0));
+	memcpy(&k1, k + sizeof(k0), sizeof(k1));
+
+	k0 = le64toh(k0);
+	k1 = le64toh(k1);
 
 	uint64_t v0 = 0x736f6d6570736575ULL ^ k0;
 	uint64_t v1 = 0x646f72616e646f6dULL ^ k1;



CVS commit: [netbsd-9] src/external/mpl/bind/dist/lib/isc

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:31:02 UTC 2019

Modified Files:
src/external/mpl/bind/dist/lib/isc [netbsd-9]: siphash.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #279):

external/mpl/bind/dist/lib/isc/siphash.c: revision 1.3

PR/54594: Martin Husemann: bind may crash at startup

Use memcpy(3) instead of assuming casting "uint8_t *" to "uint64_t *" and
de-referencing works.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/external/mpl/bind/dist/lib/isc/siphash.c

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



CVS commit: [netbsd-9] src/external/gpl3/gdb/dist/gdb

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:32:32 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb [netbsd-9]: arm-nbsd-tdep.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #280):

external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c: revision 1.5

Fix core-dump register fetching.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c

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



CVS commit: [netbsd-9] src/external/gpl3/gdb/dist/gdb

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:32:32 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb [netbsd-9]: arm-nbsd-tdep.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #280):

external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c: revision 1.5

Fix core-dump register fetching.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c:1.4 src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c:1.4.2.1
--- src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c:1.4	Sun May 26 21:40:01 2019
+++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c	Thu Oct  3 17:32:32 2019
@@ -19,6 +19,8 @@
 
 #include "defs.h"
 #include "osabi.h"
+#include "gdbcore.h"
+#include "regset.h"
 
 #include "arch/arm.h"
 #include "arm-tdep.h"
@@ -36,6 +38,64 @@ static const gdb_byte arm_nbsd_arm_be_br
 static const gdb_byte arm_nbsd_thumb_le_breakpoint[] = {0xfe, 0xde};
 static const gdb_byte arm_nbsd_thumb_be_breakpoint[] = {0xde, 0xfe};
 
+/* Register maps.  */
+
+static const struct regcache_map_entry arm_nbsd_gregmap[] =
+  {
+{ 13, ARM_A1_REGNUM, 4 }, /* r0 ... r12 */
+{ 1, ARM_SP_REGNUM, 4 },
+{ 1, ARM_LR_REGNUM, 4 },
+{ 1, ARM_PC_REGNUM, 4 },
+{ 1, ARM_PS_REGNUM, 4 },
+{ 0 }
+  };
+
+static const struct regcache_map_entry arm_nbsd_vfpregmap[] =
+  {
+{ 1, ARM_FPS_REGNUM, 4 },		/* fpexc */
+{ 1, ARM_FPSCR_REGNUM, 4 },		/* fpscr */
+{ 1, REGCACHE_MAP_SKIP, 4 },	/* fpinst */
+{ 1, REGCACHE_MAP_SKIP, 4 },	/* fpinst2 */
+{ 32, ARM_D0_REGNUM, 8 }, /* d0 ... d31 */	/* really 33, not 32 */
+{ 1, REGCACHE_MAP_SKIP, 8 },	/* fstmx format */
+{ 0 }
+  };
+
+/* Register set definitions.  */
+
+const struct regset arm_nbsd_gregset =
+  {
+arm_nbsd_gregmap,
+regcache_supply_regset, regcache_collect_regset
+  };
+
+const struct regset arm_nbsd_vfpregset =
+  {
+arm_nbsd_vfpregmap,
+regcache_supply_regset, regcache_collect_regset
+  };
+
+/* Implement the "regset_from_core_section" gdbarch method.  */
+
+#define ARM_NBSD_SIZEOF_GREGSET (17 * 4)
+#define ARM_NBSD_SIZEOF_VFPREGSET (4 * 4 + 33 * 8)
+
+static void
+arm_nbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+   iterate_over_regset_sections_cb *cb,
+   void *cb_data,
+   const struct regcache *regcache)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  cb (".reg", ARM_NBSD_SIZEOF_GREGSET, ARM_NBSD_SIZEOF_GREGSET,
+  &arm_nbsd_gregset, NULL, cb_data);
+
+  // XXX: Don't see it in core.
+  if (tdep->vfp_register_count > 0)
+cb (".reg2", ARM_NBSD_SIZEOF_VFPREGSET, ARM_NBSD_SIZEOF_VFPREGSET,
+	&arm_nbsd_vfpregset, "VFP floating-point", cb_data);
+}
 static void
 arm_netbsd_init_abi_common (struct gdbarch_info info,
 			struct gdbarch *gdbarch)
@@ -71,7 +131,7 @@ arm_netbsd_init_abi_common (struct gdbar
   set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
   /* Core support */
   set_gdbarch_iterate_over_regset_sections
-(gdbarch, armbsd_iterate_over_regset_sections);
+(gdbarch, arm_nbsd_iterate_over_regset_sections);
 
 }
 



CVS commit: [netbsd-9] src/external/gpl3/gdb/dist/gdb

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:33:42 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb [netbsd-9]: arm-nbsd-nat.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #281):

external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c: revision 1.13

Validate register number before fetching/storing it (Gopikrishnan Sidhardhan)


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 \
src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c

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



CVS commit: [netbsd-9] src/external/gpl3/gdb/dist/gdb

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:33:42 UTC 2019

Modified Files:
src/external/gpl3/gdb/dist/gdb [netbsd-9]: arm-nbsd-nat.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #281):

external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c: revision 1.13

Validate register number before fetching/storing it (Gopikrishnan Sidhardhan)


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.1 -r1.11.2.2 \
src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c

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

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.11.2.1 src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.11.2.2
--- src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c:1.11.2.1	Sun Sep  1 14:15:24 2019
+++ src/external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c	Thu Oct  3 17:33:42 2019
@@ -49,6 +49,24 @@ public:
 
 static arm_nbsd_nat_target the_arm_nbsd_nat_target;
 
+/* Determine if PT_GETREGS fetches REGNUM.  */
+
+static bool
+getregs_supplies (int regnum)
+{
+  return ((regnum >= ARM_A1_REGNUM && regnum <= ARM_PC_REGNUM)
+	  || regnum == ARM_PS_REGNUM);
+}
+
+/* Determine if PT_GETFPREGS fetches REGNUM.  */
+
+static bool
+getfpregs_supplies (int regnum)
+{
+  return ((regnum >= ARM_D0_REGNUM && regnum <= ARM_D31_REGNUM)
+	  || regnum == ARM_FPSCR_REGNUM);
+}
+
 extern int arm_apcs_32;
 
 #define FPSCR(r) ((char *) &(r)->fpr_vfp.vfp_fpscr)
@@ -256,10 +274,12 @@ arm_nbsd_nat_target::fetch_registers (st
 {
   if (regno >= 0)
 {
-  if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+  if (getregs_supplies (regno))
+	fetch_register (regcache, regno);
+  else if (getfpregs_supplies (regno))
 	fetch_fp_register (regcache, regno);
   else
-	fetch_register (regcache, regno);
+warning (_("unable to fetch register %d"), regno);
 }
   else
 {
@@ -442,10 +462,12 @@ arm_nbsd_nat_target::store_registers (st
 {
   if (regno >= 0)
 {
-  if (regno >= ARM_D0_REGNUM && regno <= ARM_FPSCR_REGNUM)
+  if (getregs_supplies (regno))
+	store_register (regcache, regno);
+  else if (getfpregs_supplies (regno))
 	store_fp_register (regcache, regno);
   else
-	store_register (regcache, regno);
+warning (_("unable to store register %d"), regno);
 }
   else
 {



CVS commit: [netbsd-9] src/doc

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:35:13 UTC 2019

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

Log Message:
Tickets #271 - #281


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

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

Modified files:

Index: src/doc/CHANGES-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.68 src/doc/CHANGES-9.0:1.1.2.69
--- src/doc/CHANGES-9.0:1.1.2.68	Mon Sep 30 16:06:03 2019
+++ src/doc/CHANGES-9.0	Thu Oct  3 17:35:13 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.68 2019/09/30 16:06:03 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.69 2019/10/03 17:35:13 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4196,3 +4196,77 @@ sys/netinet6/nd6_nbr.c1.174
 	Initialize DAD components properly during boot.
 	[ozaki-r, ticket #269]
 
+sys/arch/luna68k/dev/lunafb.c			1.41
+
+	Correct size of the framebuffer.
+	[rin, ticket #271]
+
+sys/net/route.c	1.222,1.224,1.225
+
+	Stop passing a large const structure by value, in order to avoid
+	possible kernel stack overflow; const pointer is suffice here.
+	Refactor a bit.
+	[knakahara, ticket #272]
+
+sys/arch/evbarm/conf/GENERIC64			1.108
+sys/arch/evbarm/conf/files.evbarm		1.33
+
+	Increase maxusers to 64 for 64-bit kernels
+	[jmcneill, ticket #273]
+
+sys/external/bsd/ipf/netinet/fil.c		1.31
+sys/external/bsd/ipf/netinet/ip_fil_netbsd.c	1.32,1.33
+
+	- pfil_run_hooks() can be called recursively, so we have to
+	  #define FASTROUTE_RECURSION in fil.c
+	- ip6_if_output()/nd6_output() will free the mbuf on error, to make sure
+	  to set *mpp to NULL so the caller won't try to free it again.
+	[bouyer, ticket #274]
+
+sys/kern/sysv_shm.c1.139
+
+	in shmdt(), wait until shmat() completes before detaching.
+	[chs, ticket #275]
+
+sys/arch/arm/amlogic/meson_pinctrl.c		1.6
+sys/arch/arm/broadcom/bcm2835_gpio.c		1.14
+sys/arch/arm/nvidia/tegra_pinmux.c		1.4
+sys/arch/arm/rockchip/rk3328_iomux.c		1.3
+sys/arch/arm/rockchip/rk3399_iomux.c		1.6
+sys/arch/arm/samsung/exynos_pinctrl.c		1.14
+sys/arch/arm/sunxi/sunxi_gpio.c			1.27
+sys/dev/fdt/fdt_pinctrl.c			1.10
+sys/dev/fdt/fdtbus.c1.30
+sys/dev/fdt/fdtvar.h1.54
+sys/dev/i2c/axppmic.c1.26
+
+	Add support for devices with separate "init" and "default"
+	pinctrl states.
+	[jmcneill, ticket #276]
+
+sys/arch/i386/stand/pxeboot/Makefile		1.28
+sys/arch/i386/stand/pxeboot/start_pxe.S		1.7
+
+	Incrase pxeboot code size limit from 64k to 128k.
+	[manu, ticket #277]
+
+external/bsd/jemalloc/dist/src/jemalloc.c	1.8
+
+	Make realloc(ptr, 0) return a valid pointer (again).
+	[christos, ticket #278]
+
+external/mpl/bind/dist/lib/isc/siphash.c	1.3
+
+	Fix unaligned pointer access in bind.
+	[christos, ticket #279]
+
+external/gpl3/gdb/dist/gdb/arm-nbsd-tdep.c	1.5
+
+	arm: fix gdb core-dump register fetching.
+	[christos, ticket #280]
+
+external/gpl3/gdb/dist/gdb/arm-nbsd-nat.c	1.13
+
+	Validate register number before fetching/storing it.
+	[christos, ticket #281]
+



CVS commit: [netbsd-9] src/doc

2019-10-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct  3 17:35:13 UTC 2019

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

Log Message:
Tickets #271 - #281


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

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



CVS commit: src/sys/net80211

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 17:46:56 UTC 2019

Modified Files:
src/sys/net80211: ieee80211.c

Log Message:
ieee80211_announce: Print supported rates with aprint_debug


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/net80211/ieee80211.c

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



CVS commit: src/sys/net80211

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Oct  3 17:46:56 UTC 2019

Modified Files:
src/sys/net80211: ieee80211.c

Log Message:
ieee80211_announce: Print supported rates with aprint_debug


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/net80211/ieee80211.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/net80211/ieee80211.c
diff -u src/sys/net80211/ieee80211.c:1.56 src/sys/net80211/ieee80211.c:1.57
--- src/sys/net80211/ieee80211.c:1.56	Mon Aug 24 22:21:26 2015
+++ src/sys/net80211/ieee80211.c	Thu Oct  3 17:46:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ieee80211.c,v 1.56 2015/08/24 22:21:26 pooka Exp $	*/
+/*	$NetBSD: ieee80211.c,v 1.57 2019/10/03 17:46:56 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2001 Atsushi Onoe
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -36,7 +36,7 @@
 __FBSDID("$FreeBSD: src/sys/net80211/ieee80211.c,v 1.22 2005/08/10 16:22:29 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.56 2015/08/24 22:21:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ieee80211.c,v 1.57 2019/10/03 17:46:56 jmcneill Exp $");
 #endif
 
 /*
@@ -464,7 +464,7 @@ ieee80211_announce(struct ieee80211com *
 	for (mode = IEEE80211_MODE_11A; mode < IEEE80211_MODE_MAX; mode++) {
 		if ((ic->ic_modecaps & (1if_xname,
 		ieee80211_phymode_name[mode]);
 		rs = &ic->ic_sup_rates[mode];
 		for (i = 0; i < rs->rs_nrates; i++) {
@@ -472,11 +472,11 @@ ieee80211_announce(struct ieee80211com *
 			mword = ieee80211_rate2media(ic, rate, mode);
 			if (mword == 0)
 continue;
-			aprint_normal("%s%d%sMbps", (i != 0 ? " " : ""),
+			aprint_debug("%s%d%sMbps", (i != 0 ? " " : ""),
 			(rate & IEEE80211_RATE_VAL) / 2,
 			((rate & 0x1) != 0 ? ".5" : ""));
 		}
-		aprint_normal("\n");
+		aprint_debug("\n");
 	}
 }
 



CVS commit: src/lib/librmt

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:56:17 UTC 2019

Modified Files:
src/lib/librmt: rmtlib.c

Log Message:
- user (an alias to the login buffer should be NUL terminated so use strlcpy
- double the size of the resulting buffer so that it can fit a copy of the
  same sized buffer + more.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/librmt/rmtlib.c

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



CVS commit: src/lib/librmt

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 17:56:17 UTC 2019

Modified Files:
src/lib/librmt: rmtlib.c

Log Message:
- user (an alias to the login buffer should be NUL terminated so use strlcpy
- double the size of the resulting buffer so that it can fit a copy of the
  same sized buffer + more.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/librmt/rmtlib.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/librmt/rmtlib.c
diff -u src/lib/librmt/rmtlib.c:1.26 src/lib/librmt/rmtlib.c:1.27
--- src/lib/librmt/rmtlib.c:1.26	Wed Mar 21 06:10:37 2012
+++ src/lib/librmt/rmtlib.c	Thu Oct  3 13:56:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmtlib.c,v 1.26 2012/03/21 10:10:37 matt Exp $	*/
+/*	$NetBSD: rmtlib.c,v 1.27 2019/10/03 17:56:17 christos Exp $	*/
 
 /*
  *	rmt --- remote tape emulator subroutines
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: rmtlib.c,v 1.26 2012/03/21 10:10:37 matt Exp $");
+__RCSID("$NetBSD: rmtlib.c,v 1.27 2019/10/03 17:56:17 christos Exp $");
 
 #define RMTIOCTL	1
 /* #define USE_REXEC	1 */	/* rexec code courtesy of Dan Kegel, srs!dan */
@@ -249,7 +249,7 @@ static int
 _rmt_open(const char *path, int oflag, int mode)
 {
 	int i;
-	char buffer[BUFMAGIC];
+	char buffer[2 * BUFMAGIC];
 	char host[MAXHOSTLEN];
 	char device[BUFMAGIC];
 	char login[BUFMAGIC];
@@ -292,7 +292,7 @@ _rmt_open(const char *path, int oflag, i
 	path++;
 
 	if (*(path - 1) == '@') {
-		(void)strncpy(user, host, sizeof(login) - 1);
+		(void)strlcpy(user, host, sizeof(login));
 /* saw user part of user@host */
 		sys = host;			/* start over */
 		while (*path != ':') {



CVS commit: src/lib/libterminfo

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 18:02:05 UTC 2019

Modified Files:
src/lib/libterminfo: tputs.c

Log Message:
Cast function pointers that take different arguments through void *


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/tputs.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/libterminfo/tputs.c
diff -u src/lib/libterminfo/tputs.c:1.4 src/lib/libterminfo/tputs.c:1.5
--- src/lib/libterminfo/tputs.c:1.4	Mon May  1 15:09:22 2017
+++ src/lib/libterminfo/tputs.c	Thu Oct  3 14:02:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tputs.c,v 1.4 2017/05/01 19:09:22 roy Exp $ */
+/* $NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: tputs.c,v 1.4 2017/05/01 19:09:22 roy Exp $");
+__RCSID("$NetBSD: tputs.c,v 1.5 2019/10/03 18:02:05 christos Exp $");
 
 #include 
 #include 
@@ -156,7 +156,8 @@ ti_putp(const TERMINAL *term, const char
 
 	_DIAGASSERT(term != NULL);
 	_DIAGASSERT(str != NULL);
-	return ti_puts(term, str, 1, (int (*)(int, void *))putchar, NULL);
+	return ti_puts(term, str, 1,
+	(int (*)(int, void *))(void *)putchar, NULL);
 }
 
 int
@@ -166,7 +167,7 @@ tputs(const char *str, int affcnt, int (
 	_DIAGASSERT(str != NULL);
 	_DIAGASSERT(outc != NULL);
 	return _ti_puts(1, ospeed, PC, str, affcnt,
-	(int (*)(int, void *))outc, NULL);
+	(int (*)(int, void *))(void *)outc, NULL);
 }
 
 int



CVS commit: src/lib/libterminfo

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 18:02:05 UTC 2019

Modified Files:
src/lib/libterminfo: tputs.c

Log Message:
Cast function pointers that take different arguments through void *


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libterminfo/tputs.c

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



CVS commit: src/lib/libutil

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 18:12:44 UTC 2019

Modified Files:
src/lib/libutil: efun.c

Log Message:
provide a default error function instead of trying to cast exit(3).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libutil/efun.c

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



CVS commit: src/lib/libutil

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Oct  3 18:12:44 UTC 2019

Modified Files:
src/lib/libutil: efun.c

Log Message:
provide a default error function instead of trying to cast exit(3).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libutil/efun.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/libutil/efun.c
diff -u src/lib/libutil/efun.c:1.10 src/lib/libutil/efun.c:1.11
--- src/lib/libutil/efun.c:1.10	Sat Jul 25 22:20:30 2015
+++ src/lib/libutil/efun.c	Thu Oct  3 14:12:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $	*/
+/*	$NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: efun.c,v 1.10 2015/07/26 02:20:30 kamil Exp $");
+__RCSID("$NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $");
 #endif
 
 #include 
@@ -49,11 +49,17 @@ __RCSID("$NetBSD: efun.c,v 1.10 2015/07/
 
 static void (*efunc)(int, const char *, ...) = err;
 
+static void 
+eexit(int e, const char *fmt __unused, ...)
+{
+	exit(e);
+}
+
 void (*
 esetfunc(void (*ef)(int, const char *, ...)))(int, const char *, ...)
 {
 	void (*of)(int, const char *, ...) = efunc;
-	efunc = ef == NULL ? (void (*)(int, const char *, ...))exit : ef;
+	efunc = ef == NULL ? eexit : ef;
 	return of;
 }
 



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

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 18:53:08 UTC 2019

Modified Files:
src/sys/arch/x86/pci: msipic.c

Log Message:
change bus_space_map to _x86_memio_map

Resolves bus space reservation conflict between MI and MD code.
Discussion:
http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/msipic.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/x86/pci

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 18:53:08 UTC 2019

Modified Files:
src/sys/arch/x86/pci: msipic.c

Log Message:
change bus_space_map to _x86_memio_map

Resolves bus space reservation conflict between MI and MD code.
Discussion:
http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/pci/msipic.c

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

Modified files:

Index: src/sys/arch/x86/pci/msipic.c
diff -u src/sys/arch/x86/pci/msipic.c:1.17 src/sys/arch/x86/pci/msipic.c:1.18
--- src/sys/arch/x86/pci/msipic.c:1.17	Wed Jun 26 10:20:06 2019
+++ src/sys/arch/x86/pci/msipic.c	Thu Oct  3 18:53:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $	*/
+/*	$NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.18 2019/10/03 18:53:08 tnn Exp $");
 
 #include "opt_intrdebug.h"
 
@@ -711,7 +711,7 @@ msipic_construct_msix_pic(const struct p
 		flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
 	}
 	bssize = roundup(table_size, PAGE_SIZE);
-	err = bus_space_map(pa->pa_memt, memaddr + table_offset, bssize, flags,
+	err = _x86_memio_map(pa->pa_memt, memaddr + table_offset, bssize, flags,
 	&bshandle);
 	bstag = pa->pa_memt;
 #endif
@@ -739,8 +739,8 @@ msipic_destruct_msix_pic(struct pic *msi
 	KASSERT(msix_pic->pic_type == PIC_MSIX);
 
 	msipic = msix_pic->pic_msipic;
-	bus_space_unmap(msipic->mp_bstag, msipic->mp_bshandle,
-	msipic->mp_bssize);
+	_x86_memio_unmap(msipic->mp_bstag, msipic->mp_bshandle,
+	msipic->mp_bssize, NULL);
 
 	msipic_destruct_common_msi_pic(msix_pic);
 }



CVS commit: src/sys/arch/amd64/conf

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 18:57:38 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC

Log Message:
add mcx(4) to GENERIC

Tested on dual-port ConnectX-4 with 25 Gbit/s AOC


To generate a diff of this commit:
cvs rdiff -u -r1.535 -r1.536 src/sys/arch/amd64/conf/GENERIC

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



CVS commit: src/sys/arch/amd64/conf

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 18:57:38 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC

Log Message:
add mcx(4) to GENERIC

Tested on dual-port ConnectX-4 with 25 Gbit/s AOC


To generate a diff of this commit:
cvs rdiff -u -r1.535 -r1.536 src/sys/arch/amd64/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.535 src/sys/arch/amd64/conf/GENERIC:1.536
--- src/sys/arch/amd64/conf/GENERIC:1.535	Sat Sep 14 06:57:51 2019
+++ src/sys/arch/amd64/conf/GENERIC	Thu Oct  3 18:57:38 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.535 2019/09/14 06:57:51 maxv Exp $
+# $NetBSD: GENERIC,v 1.536 2019/10/03 18:57:38 tnn Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.535 $"
+#ident		"GENERIC-$Revision: 1.536 $"
 
 maxusers	64		# estimated number of users
 
@@ -789,6 +789,7 @@ hme*	at pci? dev ? function ?	# Sun Micr
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
+mcx*	at pci? dev ? function ?	# Mellanox 5th generation Ethernet
 mskc*	at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*	at mskc?			# Marvell Yukon 2 Gigabit Ethernet
 mtd*	at pci? dev ? function ?	# Myson MTD803 3-in-1 Ethernet



CVS commit: src/sys/arch/amd64/conf

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 19:01:13 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
also add mcx(4) to ALL


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/amd64/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.122 src/sys/arch/amd64/conf/ALL:1.123
--- src/sys/arch/amd64/conf/ALL:1.122	Mon Aug 19 03:25:40 2019
+++ src/sys/arch/amd64/conf/ALL	Thu Oct  3 19:01:13 2019
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.122 2019/08/19 03:25:40 ozaki-r Exp $
+# $NetBSD: ALL,v 1.123 2019/10/03 19:01:13 tnn Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.122 $"
+#ident		"ALL-$Revision: 1.123 $"
 
 maxusers	64		# estimated number of users
 
@@ -991,6 +991,7 @@ hme*	at pci? dev ? function ?	# Sun Micr
 le*	at pci? dev ? function ?	# PCnet-PCI Ethernet
 lii*	at pci? dev ? function ?	# Atheros L2 Fast-Ethernet
 malo*	at pci? dev ? function ?	# Marvell Libertas Wireless
+mcx*	at pci? dev ? function ?	# Mellanox 5th generation Ethernet
 mskc*	at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*	at mskc?			# Marvell Yukon 2 Gigabit Ethernet
 mtd*	at pci? dev ? function ?	# Myson MTD803 3-in-1 Ethernet



CVS commit: src/sys/arch/amd64/conf

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 19:01:13 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
also add mcx(4) to ALL


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/arch/amd64/conf/ALL

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



CVS commit: src/sys/compat/common

2019-10-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Oct  3 19:56:16 UTC 2019

Modified Files:
src/sys/compat/common: compat_80_mod.c

Log Message:
Since we now have a compat_90 module, the compat_80 module should depend
on it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/compat_80_mod.c

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



CVS commit: src/sys/compat/common

2019-10-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Oct  3 19:56:16 UTC 2019

Modified Files:
src/sys/compat/common: compat_80_mod.c

Log Message:
Since we now have a compat_90 module, the compat_80 module should depend
on it.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/compat_80_mod.c

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

Modified files:

Index: src/sys/compat/common/compat_80_mod.c
diff -u src/sys/compat/common/compat_80_mod.c:1.4 src/sys/compat/common/compat_80_mod.c:1.5
--- src/sys/compat/common/compat_80_mod.c:1.4	Fri May 17 07:37:11 2019
+++ src/sys/compat/common/compat_80_mod.c	Thu Oct  3 19:56:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_80_mod.c,v 1.4 2019/05/17 07:37:11 msaitoh Exp $	*/
+/*	$NetBSD: compat_80_mod.c,v 1.5 2019/10/03 19:56:16 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.4 2019/05/17 07:37:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_80_mod.c,v 1.5 2019/10/03 19:56:16 pgoyette Exp $");
 
 #include 
 #include 
@@ -66,7 +66,7 @@ compat_80_fini(void)
 	return 0;
 }
 
-MODULE(MODULE_CLASS_EXEC, compat_80, NULL);
+MODULE(MODULE_CLASS_EXEC, compat_80, "compat_90");
 
 static int
 compat_80_modcmd(modcmd_t cmd, void *arg)



CVS commit: src/lib/libutil

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 20:29:19 UTC 2019

Modified Files:
src/lib/libutil: efun.c

Log Message:
annotate __dead


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libutil/efun.c

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



CVS commit: src/lib/libutil

2019-10-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Oct  3 20:29:19 UTC 2019

Modified Files:
src/lib/libutil: efun.c

Log Message:
annotate __dead


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libutil/efun.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/libutil/efun.c
diff -u src/lib/libutil/efun.c:1.11 src/lib/libutil/efun.c:1.12
--- src/lib/libutil/efun.c:1.11	Thu Oct  3 18:12:44 2019
+++ src/lib/libutil/efun.c	Thu Oct  3 20:29:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $	*/
+/*	$NetBSD: efun.c,v 1.12 2019/10/03 20:29:19 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #ifdef __RCSID
-__RCSID("$NetBSD: efun.c,v 1.11 2019/10/03 18:12:44 christos Exp $");
+__RCSID("$NetBSD: efun.c,v 1.12 2019/10/03 20:29:19 tnn Exp $");
 #endif
 
 #include 
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: efun.c,v 1.11 2019/10/
 
 static void (*efunc)(int, const char *, ...) = err;
 
-static void 
+static void __dead
 eexit(int e, const char *fmt __unused, ...)
 {
 	exit(e);



CVS commit: src

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:16:53 UTC 2019

Modified Files:
src/external/bsd/libevent/dist: kqueue.c
src/sys/compat/linux/common: linux_sched.c
src/sys/compat/netbsd32: netbsd32.h netbsd32_conv.h
src/sys/sys: event.h

Log Message:
Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/libevent/dist/kqueue.c
cvs rdiff -u -r1.71 -r1.72 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.126 -r1.127 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.37 -r1.38 src/sys/sys/event.h

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



CVS commit: src

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:16:53 UTC 2019

Modified Files:
src/external/bsd/libevent/dist: kqueue.c
src/sys/compat/linux/common: linux_sched.c
src/sys/compat/netbsd32: netbsd32.h netbsd32_conv.h
src/sys/sys: event.h

Log Message:
Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/libevent/dist/kqueue.c
cvs rdiff -u -r1.71 -r1.72 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.126 -r1.127 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.37 -r1.38 src/sys/sys/event.h

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

Modified files:

Index: src/external/bsd/libevent/dist/kqueue.c
diff -u src/external/bsd/libevent/dist/kqueue.c:1.1.1.3 src/external/bsd/libevent/dist/kqueue.c:1.2
--- src/external/bsd/libevent/dist/kqueue.c:1.1.1.3	Tue Jan 31 21:14:52 2017
+++ src/external/bsd/libevent/dist/kqueue.c	Thu Oct  3 22:16:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kqueue.c,v 1.1.1.3 2017/01/31 21:14:52 christos Exp $	*/
+/*	$NetBSD: kqueue.c,v 1.2 2019/10/03 22:16:52 kamil Exp $	*/
 /*	$OpenBSD: kqueue.c,v 1.5 2002/07/10 14:41:31 art Exp $	*/
 
 /*
@@ -29,7 +29,7 @@
  */
 #include "event2/event-config.h"
 #include 
-__RCSID("$NetBSD: kqueue.c,v 1.1.1.3 2017/01/31 21:14:52 christos Exp $");
+__RCSID("$NetBSD: kqueue.c,v 1.2 2019/10/03 22:16:52 kamil Exp $");
 #include "evconfig-private.h"
 
 #ifdef EVENT__HAVE_KQUEUE
@@ -53,7 +53,10 @@ __RCSID("$NetBSD: kqueue.c,v 1.1.1.3 201
 /* Some platforms apparently define the udata field of struct kevent as
  * intptr_t, whereas others define it as void*.  There doesn't seem to be an
  * easy way to tell them apart via autoconf, so we need to use OS macros. */
-#if defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
+#if defined(__NetBSD__)
+#define PTR_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(x))
+#define INT_TO_UDATA(x) ((typeof(((struct kevent *)0)->udata))(intptr_t)(x))
+#elif defined(EVENT__HAVE_INTTYPES_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__darwin__) && !defined(__APPLE__) && !defined(__CloudABI__)
 #define PTR_TO_UDATA(x)	((intptr_t)(x))
 #define INT_TO_UDATA(x) ((intptr_t)(x))
 #else

Index: src/sys/compat/linux/common/linux_sched.c
diff -u src/sys/compat/linux/common/linux_sched.c:1.71 src/sys/compat/linux/common/linux_sched.c:1.72
--- src/sys/compat/linux/common/linux_sched.c:1.71	Mon Apr 16 14:51:59 2018
+++ src/sys/compat/linux/common/linux_sched.c	Thu Oct  3 22:16:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sched.c,v 1.71 2018/04/16 14:51:59 kamil Exp $	*/
+/*	$NetBSD: linux_sched.c,v 1.72 2019/10/03 22:16:53 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.71 2018/04/16 14:51:59 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.72 2019/10/03 22:16:53 kamil Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ linux_clone_nptl(struct lwp *l, const st
 	mutex_enter(p->p_lock);
 	lwp_lock(l2);
 	spc = &l2->l_cpu->ci_schedstate;
-	if ((l->l_flag & (LW_WREBOOT | LW_WSUSPEND | LW_WEXIT)) == 0) {
+	if ((l->l_flag & (LW_WREBOOT | LW_DBGSUSPEND | LW_WSUSPEND | LW_WEXIT)) == 0) {
 		if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) {
 			KASSERT(l2->l_wchan == NULL);
 			l2->l_stat = LSSTOP;

Index: src/sys/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.126 src/sys/compat/netbsd32/netbsd32.h:1.127
--- src/sys/compat/netbsd32/netbsd32.h:1.126	Thu Sep 26 01:30:46 2019
+++ src/sys/compat/netbsd32/netbsd32.h	Thu Oct  3 22:16:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.126 2019/09/26 01:30:46 christos Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.127 2019/10/03 22:16:53 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -1003,7 +1003,7 @@ struct netbsd32_kevent {
 	uint32_t		flags;
 	uint32_t		fflags;
 	netbsd32_int64		data;
-	netbsd32_intptr_t	udata;
+	netbsd32_pointer_t	udata;
 };
 
 /* from  */

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.39 src/sys/compat/netbsd32/netbsd32_conv.h:1.40
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.39	Sun Sep 22 22:59:38 2019
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Thu Oct  3 22:16:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.39 2019/09/22 22:59:38 christos Exp $	*

CVS commit: src/sys/sys

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:26:43 UTC 2019

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

Log Message:
Define LW_DBGSUSPEND in sys/lwp.h

This flag specifies the suspended by debugger property, as used by
PT_SUSPEND in ptrace(2).


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/sys/lwp.h

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



CVS commit: src/sys/sys

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:26:43 UTC 2019

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

Log Message:
Define LW_DBGSUSPEND in sys/lwp.h

This flag specifies the suspended by debugger property, as used by
PT_SUSPEND in ptrace(2).


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/sys/lwp.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/lwp.h
diff -u src/sys/sys/lwp.h:1.186 src/sys/sys/lwp.h:1.187
--- src/sys/sys/lwp.h:1.186	Wed Jun 19 21:39:53 2019
+++ src/sys/sys/lwp.h	Thu Oct  3 22:26:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.186 2019/06/19 21:39:53 kamil Exp $	*/
+/*	$NetBSD: lwp.h,v 1.187 2019/10/03 22:26:43 kamil Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -236,6 +236,7 @@ extern int		maxlwp __read_mostly;	/* max
 #define	LW_CVLOCKDEBUG	0x0004 /* Waker does lockdebug */
 #define	LW_SINTR	0x0080 /* Sleep is interruptible. */
 #define	LW_SYSTEM	0x0200 /* Kernel thread */
+#define	LW_DBGSUSPEND	0x0001 /* Suspend by debugger */
 #define	LW_WSUSPEND	0x0002 /* Suspend before return to user */
 #define	LW_BATCH	0x0004 /* LWP tends to hog CPU */
 #define	LW_WCORE	0x0008 /* Stop for core dump on return to user */



CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:29:17 UTC 2019

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

Log Message:
Remove compile-time asserts checking whether intptr_t and void* are compat

The checks were requested by core@ as a prerequisite for kevent::udata type
switch from intptr_t to void*.


To generate a diff of this commit:
cvs rdiff -u -r1.505 -r1.506 src/sys/kern/init_main.c

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



CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:29:17 UTC 2019

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

Log Message:
Remove compile-time asserts checking whether intptr_t and void* are compat

The checks were requested by core@ as a prerequisite for kevent::udata type
switch from intptr_t to void*.


To generate a diff of this commit:
cvs rdiff -u -r1.505 -r1.506 src/sys/kern/init_main.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/init_main.c
diff -u src/sys/kern/init_main.c:1.505 src/sys/kern/init_main.c:1.506
--- src/sys/kern/init_main.c:1.505	Tue Sep 24 19:21:45 2019
+++ src/sys/kern/init_main.c	Thu Oct  3 22:29:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.505 2019/09/24 19:21:45 kamil Exp $	*/
+/*	$NetBSD: init_main.c,v 1.506 2019/10/03 22:29:17 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.505 2019/09/24 19:21:45 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.506 2019/10/03 22:29:17 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -250,9 +250,6 @@ static void configure2(void);
 static void configure3(void);
 void main(void);
 
-CTASSERT(sizeof(void *) == sizeof(intptr_t));
-CTASSERT(__alignof__(void *) == __alignof__(intptr_t));
-
 /*
  * System startup; initialize the world, create process 0, mount root
  * filesystem, and fork to create init and pagedaemon.  Most of the



CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:48:44 UTC 2019

Modified Files:
src/sys/kern: kern_exit.c kern_lwp.c kern_sig.c kern_synch.c
sys_ptrace_common.c

Log Message:
Separate flag for suspended by _lwp_suspend and suspended by a debugger

Once a thread was stopped with ptrace(2), userland process must not
be able to unstop it deliberately or by an accident.

This was a Windows-style behavior that makes threading tracing fragile.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.203 -r1.204 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.365 -r1.366 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.323 -r1.324 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/sys_ptrace_common.c

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

Modified files:

Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.276 src/sys/kern/kern_exit.c:1.277
--- src/sys/kern/kern_exit.c:1.276	Thu Jun 13 20:20:18 2019
+++ src/sys/kern/kern_exit.c	Thu Oct  3 22:48:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.277 2019/10/03 22:48:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.277 2019/10/03 22:48:44 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -617,6 +617,7 @@ retry:
 		l2->l_flag |= LW_WEXIT;
 		if ((l2->l_stat == LSSLEEP && (l2->l_flag & LW_SINTR)) ||
 		l2->l_stat == LSSUSPENDED || l2->l_stat == LSSTOP) {
+			l2->l_flag &= ~LW_DBGSUSPEND;
 			/* setrunnable() will release the lock. */
 			setrunnable(l2);
 			continue;

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.203 src/sys/kern/kern_lwp.c:1.204
--- src/sys/kern/kern_lwp.c:1.203	Mon Sep 30 21:13:33 2019
+++ src/sys/kern/kern_lwp.c	Thu Oct  3 22:48:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.203 2019/09/30 21:13:33 kamil Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.204 2019/10/03 22:48:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.203 2019/09/30 21:13:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.204 2019/10/03 22:48:44 kamil Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -408,6 +408,11 @@ lwp_suspend(struct lwp *curl, struct lwp
 		return (EDEADLK);
 	}
 
+	if ((t->l_flag & LW_DBGSUSPEND) != 0) {
+		lwp_unlock(t);
+		return 0;
+	}
+
 	error = 0;
 
 	switch (t->l_stat) {
@@ -472,7 +477,7 @@ lwp_continue(struct lwp *l)
 
 	l->l_flag &= ~LW_WSUSPEND;
 
-	if (l->l_stat != LSSUSPENDED) {
+	if (l->l_stat != LSSUSPENDED || (l->l_flag & LW_DBGSUSPEND) != 0) {
 		lwp_unlock(l);
 		return;
 	}
@@ -497,6 +502,8 @@ lwp_unstop(struct lwp *l)
 
 	lwp_lock(l);
 
+	KASSERT((l->l_flag & LW_DBGSUSPEND) == 0);
+
 	/* If not stopped, then just bail out. */
 	if (l->l_stat != LSSTOP) {
 		lwp_unlock(l);

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.365 src/sys/kern/kern_sig.c:1.366
--- src/sys/kern/kern_sig.c:1.365	Mon Sep 30 21:13:33 2019
+++ src/sys/kern/kern_sig.c	Thu Oct  3 22:48:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.365 2019/09/30 21:13:33 kamil Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.366 2019/10/03 22:48:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.365 2019/09/30 21:13:33 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.366 2019/10/03 22:48:44 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1108,11 +1108,20 @@ sigpost(struct lwp *l, sig_t action, int
 
 	SDT_PROBE(proc, kernel, , signal__send, l, p, sig, 0, 0);
 
+	lwp_lock(l);
+	if (__predict_false((l->l_flag & LW_DBGSUSPEND) != 0)) {
+		if ((prop & SA_KILL) != 0)
+			l->l_flag &= ~LW_DBGSUSPEND;
+		else {
+			lwp_unlock(l);
+			return 0;
+		}
+	}
+
 	/*
 	 * Have the LWP check for signals.  This ensures that even if no LWP
 	 * is found to take the signal immediately, it should be taken soon.
 	 */
-	lwp_lock(l);
 	l->l_flag |= LW_PENDSIG;
 
 	/*
@@ -2179,7 +2188,8 @@ sigexit(struct lwp *l, int signo)
 			LIST_FOREACH(t, &p->p_lwps, l_sibling) {
 lwp_lock(t);
 if (t == l) {
-	t->l_flag &= ~LW_WSUSPEND;
+	t->l_flag &=
+	~(LW_WSUSPEND | LW_DBGSUSPEND);
 	lwp_unlock(t);
 	continue;
 }
@@ -2376,7 +2386,7 @@ proc_unstop(struct proc *p)
 
 	LIST_FOREACH(l, &p->p_lwps, l_sibling) {
 		lwp_lock(l);
-		if (l->l_stat != LSSTOP) {
+		if (l->l_stat != LSSTOP || (l->l_flag & LW_DBGSUSPEND) != 0) {
 			lwp_unlock(l);
 			continue;
 		}

Index: src/sy

CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 22:48:44 UTC 2019

Modified Files:
src/sys/kern: kern_exit.c kern_lwp.c kern_sig.c kern_synch.c
sys_ptrace_common.c

Log Message:
Separate flag for suspended by _lwp_suspend and suspended by a debugger

Once a thread was stopped with ptrace(2), userland process must not
be able to unstop it deliberately or by an accident.

This was a Windows-style behavior that makes threading tracing fragile.


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.203 -r1.204 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.365 -r1.366 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.323 -r1.324 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.61 -r1.62 src/sys/kern/sys_ptrace_common.c

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



CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 23:11:11 UTC 2019

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

Log Message:
Add two KASSERTS in the ptrace(2) kernel code

Verify that we will never return empty ptrace_state for CHILD/LWP event.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/sys_ptrace_common.c

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



CVS commit: src/sys/kern

2019-10-03 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Oct  3 23:11:11 UTC 2019

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

Log Message:
Add two KASSERTS in the ptrace(2) kernel code

Verify that we will never return empty ptrace_state for CHILD/LWP event.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.62 src/sys/kern/sys_ptrace_common.c:1.63
--- src/sys/kern/sys_ptrace_common.c:1.62	Thu Oct  3 22:48:44 2019
+++ src/sys/kern/sys_ptrace_common.c	Thu Oct  3 23:11:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.62 2019/10/03 22:48:44 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.63 2019/10/03 23:11:11 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.62 2019/10/03 22:48:44 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.63 2019/10/03 23:11:11 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -702,6 +702,10 @@ ptrace_get_process_state(struct proc *t,
 		memset(&ps, 0, sizeof(ps));
 	} else {
 		si = &t->p_sigctx.ps_info;
+
+		KASSERT(si->_reason._ptrace_state._pe_report_event > 0);
+		KASSERT(si->_reason._ptrace_state._option._pe_other_pid > 0);
+
 		ps.pe_report_event = si->_reason._ptrace_state._pe_report_event;
 
 		CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp));



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

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct  4 00:04:28 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
Increase voltage for frequencies above 1GHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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

Modified files:

Index: src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
diff -u src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.4
--- src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts:1.3	Mon Jul  2 17:13:15 2018
+++ src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts	Fri Oct  4 00:04:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.3 2018/07/02 17:13:15 jakllsch Exp $ */
+/* $NetBSD: sun50i-h5-nanopi-neo-plus2.dts,v 1.4 2019/10/04 00:04:28 jmcneill Exp $ */
 
 #include "../../../external/gpl2/dts/dist/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-plus2.dts"
 #include "sun50i-h5.dtsi"
@@ -9,9 +9,9 @@
 			cpu-supply = <&vdd_cpux>;
 			operating-points = <
 /* kHz	  uV */
-1152000	110
-1104000	110
-1008000	110
+1152000	130
+1104000	130
+1008000	130
 816000	110
 624000	110
 >;



CVS commit: src/lib/libutil

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 00:03:56 UTC 2019

Modified Files:
src/lib/libutil: Makefile

Log Message:
Ignore strncpy(foo, bar, sizeof(foo)) for the wtmp fields where we don't
want NUL termination. We can't use pragma's because the old gcc complains
about the new warnings it does not understand.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/lib/libutil/Makefile

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

Modified files:

Index: src/lib/libutil/Makefile
diff -u src/lib/libutil/Makefile:1.82 src/lib/libutil/Makefile:1.83
--- src/lib/libutil/Makefile:1.82	Wed Apr  4 00:43:46 2018
+++ src/lib/libutil/Makefile	Thu Oct  3 20:03:56 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.82 2018/04/04 04:43:46 kre Exp $
+#	$NetBSD: Makefile,v 1.83 2019/10/04 00:03:56 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
@@ -39,6 +39,11 @@ CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_UTI
 CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_NETATALK_AT_H
 CPPFLAGS.sockaddr_snprintf.c+=-DHAVE_NET_IF_DL_H
 
+#.if ${HAVE_GCC:U0} > 7
+COPTS.logwtmp.c += -Wno-stringop-truncation
+COPTS.logwtmpx.c += -Wno-stringop-truncation
+#.endif
+
 YPREFIX=__pd
 .PATH:	${NETBSDSRCDIR}/lib/libc/gen
 



CVS commit: src/lib/libutil

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 00:03:56 UTC 2019

Modified Files:
src/lib/libutil: Makefile

Log Message:
Ignore strncpy(foo, bar, sizeof(foo)) for the wtmp fields where we don't
want NUL termination. We can't use pragma's because the old gcc complains
about the new warnings it does not understand.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/lib/libutil/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/arm/dts

2019-10-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Oct  4 00:04:28 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun50i-h5-nanopi-neo-plus2.dts

Log Message:
Increase voltage for frequencies above 1GHz


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts

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



CVS commit: src

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:28:03 UTC 2019

Modified Files:
src/lib/libc/compat/sys: compat_statfs.c
src/sys/compat/common: vfs_syscalls_20.c
src/sys/compat/sys: mount.h

Log Message:
deduplicate the conversion function from statvfs -> statfs12


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/compat/sys/compat_statfs.c
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/common/vfs_syscalls_20.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/sys/mount.h

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



CVS commit: src

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:28:03 UTC 2019

Modified Files:
src/lib/libc/compat/sys: compat_statfs.c
src/sys/compat/common: vfs_syscalls_20.c
src/sys/compat/sys: mount.h

Log Message:
deduplicate the conversion function from statvfs -> statfs12


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/compat/sys/compat_statfs.c
cvs rdiff -u -r1.43 -r1.44 src/sys/compat/common/vfs_syscalls_20.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/sys/mount.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/compat/sys/compat_statfs.c
diff -u src/lib/libc/compat/sys/compat_statfs.c:1.8 src/lib/libc/compat/sys/compat_statfs.c:1.9
--- src/lib/libc/compat/sys/compat_statfs.c:1.8	Sun Sep 22 18:59:38 2019
+++ src/lib/libc/compat/sys/compat_statfs.c	Thu Oct  3 21:28:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_statfs.c,v 1.8 2019/09/22 22:59:38 christos Exp $	*/
+/*	$NetBSD: compat_statfs.c,v 1.9 2019/10/04 01:28:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: compat_statfs.c,v 1.8 2019/09/22 22:59:38 christos Exp $");
+__RCSID("$NetBSD: compat_statfs.c,v 1.9 2019/10/04 01:28:03 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #define __LIBC12_SOURCE__
@@ -63,73 +63,6 @@ __strong_alias(fstatfs, __compat_fstatfs
 __strong_alias(fhstatfs, __compat_fhstatfs)
 __strong_alias(getfsstat, __compat_getfsstat)
 
-/*
- * Convert from a new statvfs to an old statfs structure.
- */
-
-static void vfs2fs(struct statfs12 *, const struct statvfs *);
-
-#define MOUNTNO_NONE	0
-#define MOUNTNO_UFS	1		/* UNIX "Fast" Filesystem */
-#define MOUNTNO_NFS	2		/* Network Filesystem */
-#define MOUNTNO_MFS	3		/* Memory Filesystem */
-#define MOUNTNO_MSDOS	4		/* MSDOS Filesystem */
-#define MOUNTNO_CD9660	5		/* iso9660 cdrom */
-#define MOUNTNO_FDESC	6		/* /dev/fd filesystem */
-#define MOUNTNO_KERNFS	7		/* kernel variable filesystem */ 
-#define MOUNTNO_DEVFS	8		/* device node filesystem */
-#define MOUNTNO_AFS	9		/* AFS 3.x */
-static const struct {
-	const char *name;
-	const int value;
-} nv[] = {
-	{ MOUNT_UFS, MOUNTNO_UFS },
-	{ MOUNT_NFS, MOUNTNO_NFS },
-	{ MOUNT_MFS, MOUNTNO_MFS },
-	{ MOUNT_MSDOS, MOUNTNO_MSDOS },
-	{ MOUNT_CD9660, MOUNTNO_CD9660 },
-	{ MOUNT_FDESC, MOUNTNO_FDESC },
-	{ MOUNT_KERNFS, MOUNTNO_KERNFS },
-	{ MOUNT_AFS, MOUNTNO_AFS },
-};
-
-static void
-vfs2fs(struct statfs12 *bfs, const struct statvfs *fs) 
-{
-	size_t i = 0;
-	bfs->f_type = 0;
-	bfs->f_oflags = (short)fs->f_flag;
-
-	for (i = 0; i < sizeof(nv) / sizeof(nv[0]); i++) {
-		if (strcmp(nv[i].name, fs->f_fstypename) == 0) {
-			bfs->f_type = nv[i].value;
-			break;
-		}
-	}
-#define CLAMP(a)	(long)(((a) & ~LONG_MAX) ? LONG_MAX : (a))
-	bfs->f_bsize = CLAMP(fs->f_frsize);
-	bfs->f_iosize = CLAMP(fs->f_iosize);
-	bfs->f_blocks = CLAMP(fs->f_blocks);
-	bfs->f_bfree = CLAMP(fs->f_bfree);
-	if (fs->f_bfree > fs->f_bresvd)
-		bfs->f_bavail = CLAMP(fs->f_bfree - fs->f_bresvd);
-	else
-		bfs->f_bavail = -CLAMP(fs->f_bresvd - fs->f_bfree);
-	bfs->f_files = CLAMP(fs->f_files);
-	bfs->f_ffree = CLAMP(fs->f_ffree);
-	bfs->f_fsid = fs->f_fsidx;
-	bfs->f_owner = fs->f_owner;
-	bfs->f_flags = (long)fs->f_flag;
-	bfs->f_syncwrites = CLAMP(fs->f_syncwrites);
-	bfs->f_asyncwrites = CLAMP(fs->f_asyncwrites);
-	(void)strncpy(bfs->f_fstypename, fs->f_fstypename,
-	sizeof(bfs->f_fstypename));
-	(void)strncpy(bfs->f_mntonname, fs->f_mntonname,
-	sizeof(bfs->f_mntonname));
-	(void)strncpy(bfs->f_mntfromname, fs->f_mntfromname,
-	sizeof(bfs->f_mntfromname));
-}
-
 int
 __compat_statfs(const char *file, struct statfs12 *ost)
 {
@@ -138,7 +71,7 @@ __compat_statfs(const char *file, struct
 
 	if ((ret = __statvfs90(file, &nst)) == -1)
 		return ret;
-	vfs2fs(ost, &nst);
+	statvfs_to_statfs12(&nst, ost);
 	return ret;
 }
 
@@ -150,7 +83,7 @@ __compat_fstatfs(int f, struct statfs12 
 
 	if ((ret = __fstatvfs90(f, &nst)) == -1)
 		return ret;
-	vfs2fs(ost, &nst);
+	statvfs_to_statfs12(&nst, ost);
 	return ret;
 }
 
@@ -162,7 +95,7 @@ __compat_fhstatfs(const struct compat_30
 
 	if ((ret = __fhstatvfs190(fh, FHANDLE30_SIZE, &nst, ST_WAIT)) == -1)
 		return ret;
-	vfs2fs(ost, &nst);
+	statvfs_to_statfs12(&nst, ost);
 	return ret;
 }
 
@@ -183,7 +116,7 @@ __compat_getfsstat(struct statfs12 *ost,
 		goto done;
 	if (nst)
 		for (i = 0; i < ret; i++)
-			vfs2fs(&ost[i], &nst[i]);
+			statvfs_to_statfs12(&nst[i], &ost[i]);
 done:
 	if (nst)
 		free(nst);

Index: src/sys/compat/common/vfs_syscalls_20.c
diff -u src/sys/compat/common/vfs_syscalls_20.c:1.43 src/sys/compat/common/vfs_syscalls_20.c:1.44
--- src/sys/compat/common/vfs_syscalls_20.c:1.43	Wed Sep 25 21:28:27 2019
+++ src/sys/compat/common/vfs_syscalls_20.c	Thu Oct  3 21:28:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_s

CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:53:58 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c

Log Message:
change 0x% -> %x


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/acorn32/acorn32/rpc_machdep.c

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



CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:53:58 UTC 2019

Modified Files:
src/sys/arch/acorn32/acorn32: rpc_machdep.c

Log Message:
change 0x% -> %x


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/acorn32/acorn32/rpc_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/acorn32/acorn32/rpc_machdep.c
diff -u src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.94 src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.95
--- src/sys/arch/acorn32/acorn32/rpc_machdep.c:1.94	Thu Oct  3 11:36:24 2019
+++ src/sys/arch/acorn32/acorn32/rpc_machdep.c	Thu Oct  3 21:53:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rpc_machdep.c,v 1.94 2019/10/03 15:36:24 msaitoh Exp $	*/
+/*	$NetBSD: rpc_machdep.c,v 1.95 2019/10/04 01:53:58 christos Exp $	*/
 
 /*
  * Copyright (c) 2000-2002 Reinoud Zandijk.
@@ -55,7 +55,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.94 2019/10/03 15:36:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rpc_machdep.c,v 1.95 2019/10/04 01:53:58 christos Exp $");
 
 #include 
 #include 
@@ -518,7 +518,7 @@ initarm(void *cookie)
 #endif
 	for (loop = 0, physmem = 0; loop < bootconfig.dramblocks; ++loop) {
 #ifdef VERBOSE_INIT_ARM
-		printf("0x%x + 0x%0x, type = 0x%08x\n", bootconfig.dram[loop].address,
+		printf("%#x + %#0x, type = %#08x\n", bootconfig.dram[loop].address,
  bootconfig.dram[loop].pages * PAGE_SIZE,
  bootconfig.dram[loop].flags);
 #endif
@@ -626,13 +626,13 @@ initarm(void *cookie)
 
 #ifdef VERBOSE_INIT_ARM
 	printf("Setting up stacks :\n");
-	printf("IRQ stack: p0x%08lx v0x%08lx\n",
+	printf("IRQ stack: p%#08lx v%#08lx\n",
 	irqstack.pv_pa, irqstack.pv_va); 
-	printf("ABT stack: p0x%08lx v0x%08lx\n",
+	printf("ABT stack: p%#08lx v%#08lx\n",
 	abtstack.pv_pa, abtstack.pv_va); 
-	printf("UND stack: p0x%08lx v0x%08lx\n",
+	printf("UND stack: p%#08lx v%#08lx\n",
 	undstack.pv_pa, undstack.pv_va); 
-	printf("SVC stack: p0x%08lx v0x%08lx\n",
+	printf("SVC stack: p%#08lx v%#08lx\n",
 	kernelstack.pv_pa, kernelstack.pv_va); 
 	printf("\n");
 #endif
@@ -656,7 +656,7 @@ initarm(void *cookie)
 	 */
 
 #ifdef VERBOSE_INIT_ARM
-	printf("Creating L1 page table p@0x%08x\n", (uint32_t)kernel_l1pt.pv_pa);
+	printf("Creating L1 page table p@%#08x\n", (uint32_t)kernel_l1pt.pv_pa);
 #endif
 
 	/*



CVS commit: src/libexec/ld.elf_so

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:57:53 UTC 2019

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

Log Message:
use __func__ (c99, c++11) instead of __FUNCTION__


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/libexec/ld.elf_so/rtld.c

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



CVS commit: src/libexec/ld.elf_so

2019-10-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  4 01:57:53 UTC 2019

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

Log Message:
use __func__ (c99, c++11) instead of __FUNCTION__


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/libexec/ld.elf_so/rtld.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/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.199 src/libexec/ld.elf_so/rtld.c:1.200
--- src/libexec/ld.elf_so/rtld.c:1.199	Thu Oct  3 06:34:30 2019
+++ src/libexec/ld.elf_so/rtld.c	Thu Oct  3 21:57:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.199 2019/10/03 10:34:30 tnn Exp $	 */
+/*	$NetBSD: rtld.c,v 1.200 2019/10/04 01:57:53 christos Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.199 2019/10/03 10:34:30 tnn Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.200 2019/10/04 01:57:53 christos Exp $");
 #endif /* not lint */
 
 #include 
@@ -1674,7 +1674,7 @@ _rtld_shared_enter(void)
 		if (cur == (self | RTLD_EXCLUSIVE_MASK)) {
 			if (_rtld_mutex_may_recurse)
 return;
-			_rtld_error("%s: dead lock detected", __FUNCTION__);
+			_rtld_error("%s: dead lock detected", __func__);
 			_rtld_die();
 		}
 		waiter = atomic_swap_uint(&_rtld_waiter_shared, self);
@@ -1738,7 +1738,7 @@ _rtld_exclusive_enter(sigset_t *mask)
 		membar_sync();
 		cur = _rtld_mutex;
 		if (cur == locked_value) {
-			_rtld_error("%s: dead lock detected", __FUNCTION__);
+			_rtld_error("%s: dead lock detected", __func__);
 			_rtld_die();
 		}
 		if (cur)



Re: CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Valery Ushakov


> Modified Files:
>   src/sys/arch/acorn32/acorn32: rpc_machdep.c
> 
> Log Message:
> change 0x% -> %x

This should read %#x.
And this is wrong.

1) With # the 0x is part of the width, so 

0x%08x -> 0x0001
%#08x  -> 0x01

0x 0x0001
 0x01

2) # doesn't add prefix for zero, so 

0x%08x -> 0x
%#08x  ->  

-uwe


Re: CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Christos Zoulas
Thanks, and zero is special for 0#. Should I revert it?

christos

> On Oct 3, 2019, at 10:06 PM, Valery Ushakov  wrote:
> 
> 
>> Modified Files:
>>  src/sys/arch/acorn32/acorn32: rpc_machdep.c
>> 
>> Log Message:
>> change 0x% -> %x
> 
> This should read %#x.
> And this is wrong.
> 
> 1) With # the 0x is part of the width, so 
> 
> 0x%08x -> 0x0001
> %#08x  -> 0x01
> 
> 0x 0x0001
>  0x01
> 
> 2) # doesn't add prefix for zero, so 
> 
> 0x%08x -> 0x
> %#08x  ->  
> 
> -uwe



Re: CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Kamil Rytarowski
At least in certain domains of engineering 0 is a special case as it
does not need unit (km, lumen, kg, ...) neither base (hex, dec, ..).

It is natural (correct, expected) to print %#x for 0 as 0, without 0x.

On 04.10.2019 04:09, Christos Zoulas wrote:
> Thanks, and zero is special for 0#. Should I revert it?
> 
> christos
> 
>> On Oct 3, 2019, at 10:06 PM, Valery Ushakov  wrote:
>>
>>
>>> Modified Files:
>>> src/sys/arch/acorn32/acorn32: rpc_machdep.c
>>>
>>> Log Message:
>>> change 0x% -> %x
>>
>> This should read %#x.
>> And this is wrong.
>>
>> 1) With # the 0x is part of the width, so 
>>
>> 0x%08x -> 0x0001
>> %#08x  -> 0x01
>>
>> 0x 0x0001
>>  0x01
>>
>> 2) # doesn't add prefix for zero, so 
>>
>> 0x%08x -> 0x
>> %#08x  ->  
>>
>> -uwe
> 




signature.asc
Description: OpenPGP digital signature


Re: CVS commit: src/sys/arch/acorn32/acorn32

2019-10-03 Thread Valery Ushakov
On Thu, Oct 03, 2019 at 22:09:28 -0400, Christos Zoulas wrote:

> Thanks, and zero is special for 0#. Should I revert it?

Yes, please.


> > On Oct 3, 2019, at 10:06 PM, Valery Ushakov  wrote:
> > 
> > 
> >> Modified Files:
> >>src/sys/arch/acorn32/acorn32: rpc_machdep.c
> >> 
> >> Log Message:
> >> change 0x% -> %x
> > 
> > This should read %#x.
> > And this is wrong.
> > 
> > 1) With # the 0x is part of the width, so 
> > 
> > 0x%08x -> 0x0001
> > %#08x  -> 0x01
> > 
> > 0x 0x0001
> >  0x01
> > 
> > 2) # doesn't add prefix for zero, so 
> > 
> > 0x%08x -> 0x
> > %#08x  ->  

-uwe


CVS commit: src/sys/compat/common

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct  4 05:48:11 UTC 2019

Modified Files:
src/sys/compat/common: rtsock_50.c

Log Message:
 Make clog static. Found by lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/rtsock_50.c

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

Modified files:

Index: src/sys/compat/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.13 src/sys/compat/common/rtsock_50.c:1.14
--- src/sys/compat/common/rtsock_50.c:1.13	Mon Apr 29 16:12:30 2019
+++ src/sys/compat/common/rtsock_50.c	Fri Oct  4 05:48:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.13 2019/04/29 16:12:30 roy Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.14 2019/10/04 05:48:11 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.13 2019/04/29 16:12:30 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.14 2019/10/04 05:48:11 msaitoh Exp $");
 
 #define	COMPAT_RTSOCK	/* Use the COMPATNAME/COMPATCALL macros and the
 			 * various other compat definitions - see
@@ -71,7 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,
 #include 
 #include 
 
-struct sysctllog *clog;
+static struct sysctllog *clog;
 
 void
 compat_50_rt_oifmsg(struct ifnet *ifp)



CVS commit: src/sys/compat/common

2019-10-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Oct  4 05:48:11 UTC 2019

Modified Files:
src/sys/compat/common: rtsock_50.c

Log Message:
 Make clog static. Found by lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/common/rtsock_50.c

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



CVS commit: src/sys

2019-10-03 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 06:27:42 UTC 2019

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: bus_defs.h
src/sys/arch/x86/x86: bus_dma.c
src/sys/kern: subr_asan.c
src/sys/sys: asan.h

Log Message:
Add DMA instrumentation in KASAN. We note the original buffer and length in
the map, and check the buffer on each bus_dmamap_sync. This allows us to
find DMA buffer overflows and UAFs, which couldn't be found before because
the device accesses to memory are outside of KASAN's control.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/bus_defs.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_asan.c
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/asan.h

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



CVS commit: src/sys

2019-10-03 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Oct  4 06:27:42 UTC 2019

Modified Files:
src/sys/arch/amd64/include: types.h
src/sys/arch/x86/include: bus_defs.h
src/sys/arch/x86/x86: bus_dma.c
src/sys/kern: subr_asan.c
src/sys/sys: asan.h

Log Message:
Add DMA instrumentation in KASAN. We note the original buffer and length in
the map, and check the buffer on each bus_dmamap_sync. This allows us to
find DMA buffer overflows and UAFs, which couldn't be found before because
the device accesses to memory are outside of KASAN's control.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/bus_defs.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_asan.c
cvs rdiff -u -r1.10 -r1.11 src/sys/sys/asan.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/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.62 src/sys/arch/amd64/include/types.h:1.63
--- src/sys/arch/amd64/include/types.h:1.62	Mon Sep 23 23:06:26 2019
+++ src/sys/arch/amd64/include/types.h	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.62 2019/09/23 23:06:26 kamil Exp $	*/
+/*	$NetBSD: types.h,v 1.63 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -108,6 +108,7 @@ typedef	unsigned char		__cpu_simple_lock
 #include "opt_kasan.h"
 #ifdef KASAN
 #define __HAVE_KASAN_INSTR_BUS
+#define __HAVE_KASAN_INSTR_DMA
 #endif
 #if defined(__x86_64__) && !defined(XENPV)
 #if !defined(KASAN)

Index: src/sys/arch/x86/include/bus_defs.h
diff -u src/sys/arch/x86/include/bus_defs.h:1.3 src/sys/arch/x86/include/bus_defs.h:1.4
--- src/sys/arch/x86/include/bus_defs.h:1.3	Mon Sep 23 16:17:58 2019
+++ src/sys/arch/x86/include/bus_defs.h	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.3 2019/09/23 16:17:58 skrll Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.4 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -64,6 +64,10 @@
 #ifndef _X86_BUS_H_
 #define _X86_BUS_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_kasan.h"
+#endif
+
 #include 
 
 #ifdef BUS_SPACE_DEBUG 
@@ -141,6 +145,11 @@ struct x86_bus_dmamap {
 	/*
 	 * PUBLIC MEMBERS: these are used by machine-independent code.
 	 */
+#if defined(KASAN)
+	void		*dm_buf;
+	bus_size_t	dm_buflen;
+	int		dm_buftype;
+#endif
 	bus_size_t	dm_maxsegsz;	/* largest possible segment */
 	bus_size_t	dm_mapsize;	/* size of the mapping */
 	int		dm_nsegs;	/* # valid segments in mapping */

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.79 src/sys/arch/x86/x86/bus_dma.c:1.80
--- src/sys/arch/x86/x86/bus_dma.c:1.79	Fri Jun 14 03:35:31 2019
+++ src/sys/arch/x86/x86/bus_dma.c	Fri Oct  4 06:27:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.79 2019/06/14 03:35:31 mrg Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.80 2019/10/04 06:27:42 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.79 2019/06/14 03:35:31 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.80 2019/10/04 06:27:42 maxv Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -95,6 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1327,6 +1328,8 @@ bus_dmamap_sync(bus_dma_tag_t t, bus_dma
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_sync(p, o, l, ops);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_SYNC) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1386,6 +1389,8 @@ bus_dmamap_load(bus_dma_tag_t t, bus_dma
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, buf, buflen, KASAN_DMA_LINEAR);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1404,6 +1409,8 @@ bus_dmamap_load_mbuf(bus_dma_tag_t t, bu
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, chain, 0, KASAN_DMA_MBUF);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_MBUF) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1422,6 +1429,8 @@ bus_dmamap_load_uio(bus_dma_tag_t t, bus
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, uio, 0, KASAN_DMA_UIO);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_UIO) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {
@@ -1441,6 +1450,8 @@ bus_dmamap_load_raw(bus_dma_tag_t t, bus
 {
 	bus_dma_tag_t it;
 
+	kasan_dma_load(dmam, NULL, 0, KASAN_DMA_RAW);
+
 	if ((t->bdt_exists & BUS_DMAMAP_OVERRIDE_LOAD_RAW) == 0)
 		;	/* skip override */
 	else for (it = t; it != NULL; it = it->bdt_super) {

Index:

CVS commit: src/sys/arch/arm/imx/fdt

2019-10-03 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.c

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c

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



CVS commit: src/sys/arch/arm/imx/fdt

2019-10-03 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Fri Oct  4 06:49:40 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_ahcisata.c

Log Message:
Remove FDT_INTR_MPSAFE flag.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c

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

Modified files:

Index: src/sys/arch/arm/imx/fdt/imx6_ahcisata.c
diff -u src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2 src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.3
--- src/sys/arch/arm/imx/fdt/imx6_ahcisata.c:1.2	Mon Aug 19 03:45:51 2019
+++ src/sys/arch/arm/imx/fdt/imx6_ahcisata.c	Fri Oct  4 06:49:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $	*/
+/*	$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.2 2019/08/19 03:45:51 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_ahcisata.c,v 1.3 2019/10/04 06:49:40 hkenken Exp $");
 
 #include 
 #include 
@@ -116,6 +116,8 @@ imx6_ahcisata_attach(device_t parent, de
 		sc->sc_rx_eq = 3000;
 	if (of_getprop_bool(phandle, "fsl,no-spread-spectrum") == false)
 		sc->sc_ss = 1;
+	else
+		sc->sc_ss = 0;
 
 	sc->sc_clk_sata = fdtbus_clock_get(phandle, "sata");
 	if (sc->sc_clk_sata == NULL) {
@@ -181,8 +183,8 @@ imx6_ahcisata_attach(device_t parent, de
 		return;
 	}
 
-	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO,
-	FDT_INTR_MPSAFE, ahci_intr, &sc->sc);
+	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
+	ahci_intr, &sc->sc);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n",
 		intrstr);
@@ -412,10 +414,10 @@ imx6_ahcisata_init(struct imx6_ahcisata_
 			val = gpr13_sata_phy_settings[i].def_val;
 		v |= __SHIFTIN(val, gpr13_sata_phy_settings[i].mask);
 	}
-	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(0x12, IOMUX_GPR13_SATA_PHY_7);	/* Rx SATA2m */
 	v |= __SHIFTIN(3, IOMUX_GPR13_SATA_PHY_6);	/* Rx DPLL mode */
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_SPEED);	/* 3.0GHz */
+	v |= __SHIFTIN(sc->sc_ss, IOMUX_GPR13_SATA_PHY_5);
 	v |= __SHIFTIN(1, IOMUX_GPR13_SATA_PHY_1);	/* PLL clock enable */
 	bus_space_write_4(sc->sc_iot, sc->sc_gpr_ioh, IOMUX_GPR13, v);
 



  1   2   >