CVS commit: src/sys/stand/efiboot

2020-06-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Jun 26 03:23:04 UTC 2020

Modified Files:
src/sys/stand/efiboot: Makefile.efiboot boot.c bootmenu.c efiboot.c
efiboot.h efienv.c efienv.h exec.c version
Added Files:
src/sys/stand/efiboot: overlay.c overlay.h

Log Message:
Add dtoverlay command to specify device tree overlays from the boot
loader command line.  Add support for specifying device tree overlays
in boot.cfg, with the syntax:

dtoverlay=/path/to/overlay.dtbo
dtoverlay=hd0e:/overlays/example.dtbo

Multiple overlays can be specified, and they are loaded in the order
they appear in boot.cfg.

Remove support for efiboot.plist.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.23 -r1.24 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/bootmenu.c
cvs rdiff -u -r1.19 -r1.20 src/sys/stand/efiboot/efiboot.c
cvs rdiff -u -r1.11 -r1.12 src/sys/stand/efiboot/efiboot.h
cvs rdiff -u -r1.5 -r1.6 src/sys/stand/efiboot/efienv.c
cvs rdiff -u -r1.2 -r1.3 src/sys/stand/efiboot/efienv.h
cvs rdiff -u -r1.16 -r1.17 src/sys/stand/efiboot/exec.c
cvs rdiff -u -r0 -r1.1 src/sys/stand/efiboot/overlay.c \
src/sys/stand/efiboot/overlay.h
cvs rdiff -u -r1.17 -r1.18 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.15 src/sys/stand/efiboot/Makefile.efiboot:1.16
--- src/sys/stand/efiboot/Makefile.efiboot:1.15	Sun Jun 21 23:53:26 2020
+++ src/sys/stand/efiboot/Makefile.efiboot	Fri Jun 26 03:23:04 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.15 2020/06/21 23:53:26 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.16 2020/06/26 03:23:04 thorpej Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -22,7 +22,7 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 .PATH: ${EFIDIR}/gnuefi
 SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
 SOURCES+=	boot.c bootmenu.c conf.c console.c dev_net.c devopen.c exec.c \
-		module.c panic.c prompt.c
+		module.c overlay.c panic.c prompt.c
 SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c \
 		efifile.c efiblock.c efinet.c efipxe.c efiacpi.c efirng.c smbios.c
 

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.23 src/sys/stand/efiboot/boot.c:1.24
--- src/sys/stand/efiboot/boot.c:1.23	Sun Jun 21 23:53:26 2020
+++ src/sys/stand/efiboot/boot.c	Fri Jun 26 03:23:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.23 2020/06/21 23:53:26 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.24 2020/06/26 03:23:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -34,6 +34,7 @@
 #include "efienv.h"
 #include "efirng.h"
 #include "module.h"
+#include "overlay.h"
 #include "bootmenu.h"
 
 #include 
@@ -76,7 +77,6 @@ static const char *efi_memory_type[] = {
 static char default_device[32];
 static char initrd_path[255];
 static char dtb_path[255];
-static char efibootplist_path[255];
 static char netbsd_path[255];
 static char netbsd_args[255];
 static char rndseed_path[255];
@@ -90,9 +90,10 @@ int	set_bootargs(const char *);
 void	command_boot(char *);
 void	command_dev(char *);
 void	command_dtb(char *);
-void	command_plist(char *);
 void	command_initrd(char *);
 void	command_rndseed(char *);
+void	command_dtoverlay(char *);
+void	command_dtoverlays(char *);
 void	command_modules(char *);
 void	command_load(char *);
 void	command_unload(char *);
@@ -111,9 +112,10 @@ const struct boot_command commands[] = {
 	{ "boot",	command_boot,		"boot [dev:][filename] [args]\n (ex. \"hd0a:\\netbsd.old -s\"" },
 	{ "dev",	command_dev,		"dev" },
 	{ "dtb",	command_dtb,		"dtb [dev:][filename]" },
-	{ "plist",	command_plist,		"plist [dev:][filename]" },
 	{ "initrd",	command_initrd,		"initrd [dev:][filename]" },
 	{ "rndseed",	command_rndseed,	"rndseed [dev:][filename]" },
+	{ "dtoverlay",	command_dtoverlay,	"dtoverlay [dev:][filename]" },
+	{ "dtoverlays",	command_dtoverlays,	"dtoverlays [{on|off|reset}]" },
 	{ "modules",	command_modules,	"modules [{on|off|reset}]" },
 	{ "load",	command_load,		"load " },
 	{ "unload",	command_unload,		"unload " },
@@ -185,13 +187,6 @@ command_dtb(char *arg)
 }
 
 void
-command_plist(char *arg)
-{
-	if (set_efibootplist_path(arg) == 0)
-		load_efibootplist(false);
-}
-
-void
 command_initrd(char *arg)
 {
 	set_initrd_path(arg);
@@ -204,6 +199,37 @@ command_rndseed(char *arg)
 }
 
 void
+command_dtoverlays(char *arg)
+{
+	if (arg && *arg) {
+		if (strcmp(arg, "on") == 0)
+			dtoverlay_enable(1);
+		else if (strcmp(arg, "off") == 0)
+			dtoverlay_enable(0);
+		else if (strcmp(arg, "reset") == 0)
+			dtoverlay_remove_all();
+		else {
+			command_help("");
+			return;
+		}
+	} else {
+		printf("Device Tree overlays are %sabled\n",
+		dtoverlay_enabled ? "en" : "dis");
+	}
+}
+
+void

CVS commit: src/sys/dev/ofw

2020-06-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Jun 25 22:50:56 UTC 2020

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

Log Message:
Fix fallout from migration from alloca() to malloc() in the previous.

of_compatible() is used at least for macppc in very early boot stage
where malloc() is still not available.

Therefore, for small (<= OFW_MAX_STACK_BUF_SIZE = 256) buffer, use
statically allocated one in the stack. For larger one, we continue to
use malloc() but KASSERT(!cold) is added for sure.

Fix boot failure for macppc reported by martin:
http://mail-index.netbsd.org/port-macppc/2020/06/25/msg002756.html


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

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

Modified files:

Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.37 src/sys/dev/ofw/ofw_subr.c:1.38
--- src/sys/dev/ofw/ofw_subr.c:1.37	Thu Jun 25 11:31:45 2020
+++ src/sys/dev/ofw/ofw_subr.c	Thu Jun 25 22:50:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.37 2020/06/25 11:31:45 jdolecek Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.38 2020/06/25 22:50:56 rin Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.37 2020/06/25 11:31:45 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.38 2020/06/25 22:50:56 rin Exp $");
 
 #include 
 #include 
@@ -100,15 +100,22 @@ int
 of_compatible(int phandle, const char * const *strings)
 {
 
-	int len, olen, nstr, cstr, rv;
-	char *buf;
+	int len, olen, allocated, nstr, cstr, rv;
+	char *buf, sbuf[OFW_MAX_STACK_BUF_SIZE];
 	const char *sp, *nsp;
 
 	len = OF_getproplen(phandle, "compatible");
 	if (len <= 0)
 		return (-1);
 
-	buf = malloc(len, M_TEMP, M_WAITOK);
+	if (len > sizeof(sbuf)) {
+		KASSERT(!cold);
+		buf = malloc(len, M_TEMP, M_WAITOK);
+		allocated = 1;
+	} else {
+		buf = sbuf;
+		allocated = 0;
+	}
 
 	/* 'compatible' size should not change. */
 	if (OF_getprop(phandle, "compatible", buf, len) != len) {
@@ -144,7 +151,8 @@ of_compatible(int phandle, const char * 
 	rv = -1;
 
 out:
-	free(buf, M_TEMP);
+	if (allocated)
+		free(buf, M_TEMP);
 	return (rv);
 }
 



CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 18:30:42 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/sbin/ifconfig: Makefile t_tap.sh
Added Files:
src/tests/sbin/ifconfig: t_bridge.sh

Log Message:
Test creating thousands of bridge(4)'s.  Unlike with tap(4) (PR kern/55417),
this test succeeeds. It is even possible to have the ultimate ifconfig(8)
output with more than 65,000 devices.


To generate a diff of this commit:
cvs rdiff -u -r1.853 -r1.854 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/sbin/ifconfig/Makefile \
src/tests/sbin/ifconfig/t_tap.sh
cvs rdiff -u -r0 -r1.1 src/tests/sbin/ifconfig/t_bridge.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.853 src/distrib/sets/lists/tests/mi:1.854
--- src/distrib/sets/lists/tests/mi:1.853	Thu Jun 25 17:08:33 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 18:30:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.853 2020/06/25 17:08:33 jruoho Exp $
+# $NetBSD: mi,v 1.854 2020/06/25 18:30:42 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3994,6 +3994,7 @@
 ./usr/tests/sbin/ifconfig			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/Atffile		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
+./usr/tests/sbin/ifconfig/t_bridge		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_nonexistent		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_repeated_scan	tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_repeated_updown	tests-sbin-tests	compattestfile,atf

Index: src/tests/sbin/ifconfig/Makefile
diff -u src/tests/sbin/ifconfig/Makefile:1.4 src/tests/sbin/ifconfig/Makefile:1.5
--- src/tests/sbin/ifconfig/Makefile:1.4	Thu Jun 25 15:41:40 2020
+++ src/tests/sbin/ifconfig/Makefile	Thu Jun 25 18:30:42 2020
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.4 2020/06/25 15:41:40 jruoho Exp $
+# $NetBSD: Makefile,v 1.5 2020/06/25 18:30:42 jruoho Exp $
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/sbin/ifconfig
 
-TESTS_SH=	t_nonexistent t_repeated_scan t_repeated_updown t_tap
+TESTS_SH=	t_bridge t_nonexistent t_repeated_scan t_repeated_updown t_tap
 
 .include 
Index: src/tests/sbin/ifconfig/t_tap.sh
diff -u src/tests/sbin/ifconfig/t_tap.sh:1.4 src/tests/sbin/ifconfig/t_tap.sh:1.5
--- src/tests/sbin/ifconfig/t_tap.sh:1.4	Thu Jun 25 16:57:00 2020
+++ src/tests/sbin/ifconfig/t_tap.sh	Thu Jun 25 18:30:42 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_tap.sh,v 1.4 2020/06/25 16:57:00 jruoho Exp $
+# $NetBSD: t_tap.sh,v 1.5 2020/06/25 18:30:42 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -38,7 +38,7 @@ manytaps_head() {
 manytaps_body() {
 
 	atf_skip "The test causes a panic (PR kern/55417)"
-	seq 65535 64000 > $taps
+	seq 65535 65000 > $taps # Try to avoid stalling automated runs.
 
 	while read tap; do
 

Added files:

Index: src/tests/sbin/ifconfig/t_bridge.sh
diff -u /dev/null src/tests/sbin/ifconfig/t_bridge.sh:1.1
--- /dev/null	Thu Jun 25 18:30:42 2020
+++ src/tests/sbin/ifconfig/t_bridge.sh	Thu Jun 25 18:30:42 2020
@@ -0,0 +1,72 @@
+# $NetBSD: t_bridge.sh,v 1.1 2020/06/25 18:30:42 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+bridges="/tmp/bridges"
+
+atf_test_case manybridges cleanup

CVS commit: src/sys/uvm

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 18:20:18 UTC 2020

Modified Files:
src/sys/uvm: uvm_param.h

Log Message:
uvm_emap_size was removed a while ago


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/uvm/uvm_param.h

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

Modified files:

Index: src/sys/uvm/uvm_param.h
diff -u src/sys/uvm/uvm_param.h:1.39 src/sys/uvm/uvm_param.h:1.40
--- src/sys/uvm/uvm_param.h:1.39	Thu Jun 25 16:36:43 2020
+++ src/sys/uvm/uvm_param.h	Thu Jun 25 18:20:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_param.h,v 1.39 2020/06/25 16:36:43 mlelstv Exp $	*/
+/*	$NetBSD: uvm_param.h,v 1.40 2020/06/25 18:20:18 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -213,7 +213,6 @@ extern unsigned int user_thread_stack_gu
 
 extern int		ubc_nwins;	/* number of UBC mapping windows */
 extern const int	ubc_winshift;	/* shift for a UBC mapping window */
-extern u_int		uvm_emap_size;	/* size of emap */
 
 #else
 /* out-of-kernel versions of round_page and trunc_page */



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

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 17:24:31 UTC 2020

Modified Files:
src/sys/arch/x86/x86: multiboot2.c

Log Message:
rearrange code to remove need for the scratch space variable, simply put
the data to destination bootinfo buffer directly

XXX compile tested only, needs confirmation that it still works


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/x86/multiboot2.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/x86/multiboot2.c
diff -u src/sys/arch/x86/x86/multiboot2.c:1.5 src/sys/arch/x86/x86/multiboot2.c:1.6
--- src/sys/arch/x86/x86/multiboot2.c:1.5	Wed Jun 24 22:28:07 2020
+++ src/sys/arch/x86/x86/multiboot2.c	Thu Jun 25 17:24:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot2.c,v 1.5 2020/06/24 22:28:07 jdolecek Exp $	*/
+/*	$NetBSD: multiboot2.c,v 1.6 2020/06/25 17:24:31 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.5 2020/06/24 22:28:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.6 2020/06/25 17:24:31 jdolecek Exp $");
 
 #include "opt_multiboot.h"
 
@@ -115,7 +115,6 @@ char multiboot_info[16384] = "\0\0\0\0";
 bool multiboot2_enabled = false;
 bool has_syms = false;
 struct multiboot_symbols Multiboot_Symbols;
-static char bimbuf[16384];
 
 #define RELOC(type, x) ((type)((vaddr_t)(x) - KERNBASE))
 
@@ -346,16 +345,13 @@ multiboot2_pre_reloc(char *mbi)
 	return;
 }
 
-static void
-bootinfo_add(struct btinfo_common *item, int type, int len)
+static struct btinfo_common *
+bootinfo_init(int type, int len)
 {
 	int i;  
 	struct bootinfo *bip = (struct bootinfo *)
 	vaddr_t data;
 
-	item->type = type;
-	item->len = len;
-
 	data = (vaddr_t)>bi_data;
 	for (i = 0; i < bip->bi_nentries; i++) {
 		struct btinfo_common *tmp;
@@ -364,12 +360,29 @@ bootinfo_add(struct btinfo_common *item,
 		data += tmp->len;
 	}
 	if (data + len < (vaddr_t)>bi_data + sizeof(bip->bi_data)) {
-		memcpy((void *)data, item, len);
+		/* Initialize the common part */
+		struct btinfo_common *item = (struct btinfo_common *)data;
+		item->type = type;
+		item->len = len;
 		bip->bi_nentries++;
+		return item;
+	} else {
+		return NULL;
 	}
 }
 
 static void
+bootinfo_add(struct btinfo_common *item, int type, int len)
+{
+	struct btinfo_common *bip = bootinfo_init(type, len);
+	if (bip == NULL)
+		return;
+
+	/* Copy the data after the common part over */
+	memcpy([1], [1], len - sizeof(*item));
+}
+
+static void
 mbi_cmdline(struct multiboot_tag_string *mbt)
 {
 	char *cmdline = mbt->string;
@@ -450,11 +463,11 @@ mbi_modules(char *mbi, uint32_t mbi_size
 	struct btinfo_modulelist *bim;
 
 	bim_len = sizeof(*bim) + (module_count * sizeof(*bie));
-	if (bim_len > sizeof(bimbuf))
+	bim = (struct btinfo_modulelist *)bootinfo_init(BTINFO_MODULELIST,
+	bim_len);
+	if (bim == NULL)
 		return;
 
-	bim = (struct btinfo_modulelist *)bimbuf;
-
 	bim->num = module_count;
 	bim->endpa = end;
 
@@ -474,11 +487,6 @@ mbi_modules(char *mbi, uint32_t mbi_size
 
 		bie++;
 	}
-
-	bootinfo_add((struct btinfo_common *),
-   BTINFO_MODULELIST, bim_len);
-
-	return;
 }
 
 static void
@@ -518,12 +526,24 @@ static void
 mbi_mmap(struct multiboot_tag_mmap *mbt)
 {
 	struct btinfo_memmap *bim;
+	int num;
 	char *cp;
 
 	if (mbt->entry_version != 0)
 		return;
 
-	bim = (struct btinfo_memmap *)bimbuf;
+	/* Determine size */
+	num = 0;
+	for (cp = (char *)(mbt + 1);
+	 cp - (char *)mbt < mbt->size;
+	 cp += mbt->entry_size) {
+		num++;
+	}
+
+	bim = (struct btinfo_memmap *)bootinfo_init(BTINFO_MEMMAP,
+	sizeof(num) + num * sizeof(struct bi_memmap_entry));
+	if (bim == NULL)
+		return;
 	bim->num = 0;
 
 	for (cp = (char *)(mbt + 1);
@@ -557,15 +577,9 @@ mbi_mmap(struct multiboot_tag_mmap *mbt)
 		}
 
 		bim->num++;
-
-		if ((char*)>entry[bim->num] - (char *)bim > sizeof(bimbuf))
-			break;
 	}
 
-	bootinfo_add((struct btinfo_common *)bim, BTINFO_MEMMAP,
-	(char*)>entry[bim->num] - (char *)bim);
-
-	return;
+	KASSERT(bim->num == num);
 }
 
 static void
@@ -614,26 +628,22 @@ mbi_efi64(struct multiboot_tag_efi64 *mb
 static void
 mbi_efi_mmap(struct multiboot_tag_efi_mmap *mbt)
 {
-	struct btinfo_efimemmap *bie = (struct btinfo_efimemmap *)bimbuf;
+	struct btinfo_efimemmap *bie;
 	size_t bie_len;
 
 	if (mbt->descr_vers != 0)
-		goto out;
+		return;
 
 	bie_len = sizeof(*bie) + mbt->size - sizeof(*mbt);
-	if (bie_len > sizeof(bimbuf))
-		goto out;
+	bie = (struct btinfo_efimemmap *)bootinfo_init(BTINFO_EFIMEMMAP,
+	bie_len);
+	if (bie == NULL)
+		return;
 
 	bie->num = (mbt->size - sizeof(*mbt)) / mbt->descr_size;
 	bie->version = mbt->descr_vers;
 	bie->size = mbt->descr_size;
 	memcpy(bie->memmap, mbt + 1, mbt->size - sizeof(*mbt));
-
-	bootinfo_add((struct btinfo_common *)bie,
-   BTINFO_EFIMEMMAP, 

CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 17:08:33 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/sbin: Makefile
Added Files:
src/tests/sbin/setkey: Makefile t_setkey.sh

Log Message:
Verify that PR kern/52150 is no longer present.


To generate a diff of this commit:
cvs rdiff -u -r1.852 -r1.853 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.167 -r1.168 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.8 -r1.9 src/tests/sbin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/setkey/Makefile \
src/tests/sbin/setkey/t_setkey.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.852 src/distrib/sets/lists/tests/mi:1.853
--- src/distrib/sets/lists/tests/mi:1.852	Thu Jun 25 16:16:49 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 17:08:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.852 2020/06/25 16:16:49 jruoho Exp $
+# $NetBSD: mi,v 1.853 2020/06/25 17:08:33 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4021,6 +4021,10 @@
 ./usr/tests/sbin/route/Atffile			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/route/Kyuafile			tests-sbin-tests	compattestfile,atf,kyua
 ./usr/tests/sbin/route/t_missing		tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/setkeytests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/setkey/Atffile			tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/setkey/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
+./usr/tests/sbin/setkey/t_setkey		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/sysctltests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/sysctl/Atffile			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/sysctl/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.167 src/etc/mtree/NetBSD.dist.tests:1.168
--- src/etc/mtree/NetBSD.dist.tests:1.167	Thu Jun 25 15:01:35 2020
+++ src/etc/mtree/NetBSD.dist.tests	Thu Jun 25 17:08:33 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.167 2020/06/25 15:01:35 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.168 2020/06/25 17:08:33 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -379,6 +379,7 @@
 ./usr/tests/sbin/newfs_msdos
 ./usr/tests/sbin/resize_ffs
 ./usr/tests/sbin/route
+./usr/tests/sbin/setkey
 ./usr/tests/sbin/sysctl
 ./usr/tests/share
 ./usr/tests/share/examples

Index: src/tests/sbin/Makefile
diff -u src/tests/sbin/Makefile:1.8 src/tests/sbin/Makefile:1.9
--- src/tests/sbin/Makefile:1.8	Thu Jun 25 15:01:35 2020
+++ src/tests/sbin/Makefile	Thu Jun 25 17:08:32 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2020/06/25 15:01:35 jruoho Exp $
+#	$NetBSD: Makefile,v 1.9 2020/06/25 17:08:32 jruoho Exp $
 #
 
 .include 
@@ -7,6 +7,6 @@ TESTSDIR=	${TESTSBASE}/sbin
 
 TESTS_SUBDIRS+=	envstat fsck_ffs gpt ifconfig \
 		newfs newfs_msdos resize_ffs \
-		route sysctl
+		route setkey sysctl
 
 .include 

Added files:

Index: src/tests/sbin/setkey/Makefile
diff -u /dev/null src/tests/sbin/setkey/Makefile:1.1
--- /dev/null	Thu Jun 25 17:08:33 2020
+++ src/tests/sbin/setkey/Makefile	Thu Jun 25 17:08:32 2020
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.1 2020/06/25 17:08:32 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/sbin/setkey
+
+TESTS_SH=	t_setkey
+
+.include 
Index: src/tests/sbin/setkey/t_setkey.sh
diff -u /dev/null src/tests/sbin/setkey/t_setkey.sh:1.1
--- /dev/null	Thu Jun 25 17:08:33 2020
+++ src/tests/sbin/setkey/t_setkey.sh	Thu Jun 25 17:08:32 2020
@@ -0,0 +1,47 @@
+# $NetBSD: t_setkey.sh,v 1.1 2020/06/25 17:08:32 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE 

CVS commit: src/sys

2020-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 25 17:01:20 UTC 2020

Modified Files:
src/sys/dev/nvmm: files.nvmm nvmm.c
src/sys/modules/nvmm: nvmm.ioconf

Log Message:
Register NVMM as an actual pseudo-device. Without PMF handler, to
explicitly disallow ACPI suspend if NVMM is running.

Should fix PR/55406.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/files.nvmm
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/nvmm/nvmm.ioconf

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/nvmm/files.nvmm
diff -u src/sys/dev/nvmm/files.nvmm:1.2 src/sys/dev/nvmm/files.nvmm:1.3
--- src/sys/dev/nvmm/files.nvmm:1.2	Thu Mar 28 19:00:40 2019
+++ src/sys/dev/nvmm/files.nvmm	Thu Jun 25 17:01:19 2020
@@ -1,6 +1,6 @@
-#	$NetBSD: files.nvmm,v 1.2 2019/03/28 19:00:40 maxv Exp $
+#	$NetBSD: files.nvmm,v 1.3 2020/06/25 17:01:19 maxv Exp $
 
-defpseudo nvmm
+defpseudodev nvmm
 
 file	dev/nvmm/nvmm.c			nvmm
 

Index: src/sys/dev/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.30 src/sys/dev/nvmm/nvmm.c:1.31
--- src/sys/dev/nvmm/nvmm.c:1.30	Sun May 24 08:08:49 2020
+++ src/sys/dev/nvmm/nvmm.c	Thu Jun 25 17:01:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.30 2020/05/24 08:08:49 maxv Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.31 2020/06/25 17:01:19 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.30 2020/05/24 08:08:49 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.31 2020/06/25 17:01:19 maxv Exp $");
 
 #include 
 #include 
@@ -44,7 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.3
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -960,22 +960,27 @@ nvmm_ctl(struct nvmm_owner *owner, struc
 
 /* -- */
 
+static const struct nvmm_impl *
+nvmm_ident(void)
+{
+	size_t i;
+
+	for (i = 0; i < __arraycount(nvmm_impl_list); i++) {
+		if ((*nvmm_impl_list[i]->ident)())
+			return nvmm_impl_list[i];
+	}
+
+	return NULL;
+}
+
 static int
 nvmm_init(void)
 {
 	size_t i, n;
 
-	for (i = 0; i < __arraycount(nvmm_impl_list); i++) {
-		if (!(*nvmm_impl_list[i]->ident)()) {
-			continue;
-		}
-		nvmm_impl = nvmm_impl_list[i];
-		break;
-	}
-	if (nvmm_impl == NULL) {
-		printf("NVMM: CPU not supported\n");
+	nvmm_impl = nvmm_ident();
+	if (nvmm_impl == NULL)
 		return ENOTSUP;
-	}
 
 	for (i = 0; i < NVMM_MAX_MACHINES; i++) {
 		machines[i].machid = i;
@@ -1169,6 +1174,53 @@ nvmm_ioctl(file_t *fp, u_long cmd, void 
 
 /* -- */
 
+static int nvmm_match(device_t, cfdata_t, void *);
+static void nvmm_attach(device_t, device_t, void *);
+static int nvmm_detach(device_t, int);
+
+extern struct cfdriver nvmm_cd;
+
+CFATTACH_DECL_NEW(nvmm, 0, nvmm_match, nvmm_attach, nvmm_detach, NULL);
+
+static struct cfdata nvmm_cfdata[] = {
+	{
+		.cf_name = "nvmm",
+		.cf_atname = "nvmm",
+		.cf_unit = 0,
+		.cf_fstate = FSTATE_STAR,
+		.cf_loc = NULL,
+		.cf_flags = 0,
+		.cf_pspec = NULL,
+	},
+	{ NULL, NULL, 0, FSTATE_NOTFOUND, NULL, 0, NULL }
+};
+
+static int
+nvmm_match(device_t self, cfdata_t cfdata, void *arg)
+{
+	return 1;
+}
+
+static void
+nvmm_attach(device_t parent, device_t self, void *aux)
+{
+	int error;
+
+	error = nvmm_init();
+	if (error)
+		panic("%s: impossible", __func__);
+	aprint_normal_dev(self, "attached\n");
+}
+
+static int
+nvmm_detach(device_t self, int flags)
+{
+	if (nmachines > 0)
+		return EBUSY;
+	nvmm_fini();
+	return 0;
+}
+
 void
 nvmmattach(int nunits)
 {
@@ -1177,51 +1229,83 @@ nvmmattach(int nunits)
 
 MODULE(MODULE_CLASS_MISC, nvmm, NULL);
 
+#if defined(_MODULE)
+CFDRIVER_DECL(nvmm, DV_VIRTUAL, NULL);
+#endif
+
 static int
 nvmm_modcmd(modcmd_t cmd, void *arg)
 {
+#if defined(_MODULE)
+	devmajor_t bmajor = NODEVMAJOR;
+	devmajor_t cmajor = 345;
+#endif
 	int error;
 
 	switch (cmd) {
 	case MODULE_CMD_INIT:
-		error = nvmm_init();
+		if (nvmm_ident() == NULL) {
+			aprint_error("%s: cpu not supported\n",
+			nvmm_cd.cd_name);
+			return ENOTSUP;
+		}
+#if defined(_MODULE)
+		error = config_cfdriver_attach(_cd);
 		if (error)
 			return error;
+#endif
+		error = config_cfattach_attach(nvmm_cd.cd_name, _ca);
+		if (error) {
+			config_cfdriver_detach(_cd);
+			aprint_error("%s: config_cfattach_attach failed\n",
+			nvmm_cd.cd_name);
+			return error;
+		}
+
+		error = config_cfdata_attach(nvmm_cfdata, 1);
+		if (error) {
+			config_cfattach_detach(nvmm_cd.cd_name, _ca);
+			config_cfdriver_detach(_cd);
+			aprint_error("%s: unable to register cfdata\n",
+			nvmm_cd.cd_name);
+			return error;
+		}
+
+		if (config_attach_pseudo(nvmm_cfdata) == NULL) {
+			aprint_error("%s: config_attach_pseudo failed\n",
+			nvmm_cd.cd_name);
+			

CVS commit: src/tests/sbin/ifconfig

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 16:57:00 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_tap.sh

Log Message:
Instead of UINT_MAX + 2, test what is claimed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/ifconfig/t_tap.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_tap.sh
diff -u src/tests/sbin/ifconfig/t_tap.sh:1.3 src/tests/sbin/ifconfig/t_tap.sh:1.4
--- src/tests/sbin/ifconfig/t_tap.sh:1.3	Thu Jun 25 16:52:49 2020
+++ src/tests/sbin/ifconfig/t_tap.sh	Thu Jun 25 16:57:00 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_tap.sh,v 1.3 2020/06/25 16:52:49 jruoho Exp $
+# $NetBSD: t_tap.sh,v 1.4 2020/06/25 16:57:00 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -83,15 +83,15 @@ overflow_head() {
 
 overflow_body() {
 	atf_skip "The test causes a panic (PR kern/53546)"
-	ifconfig tap65537 create
+	ifconfig tap9 create
 }
 
 overflow_cleanup() {
 
-	ifconfig tap65537 create
+	ifconfig tap9
 
 	if [ $? -eq 0 ]; then
-		ifconfig tap65537 destroy
+		ifconfig tap9 destroy
 	fi
 }
 



CVS commit: src/tests/sbin/ifconfig

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 16:52:50 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_tap.sh

Log Message:
Actually create the tap(4) with a negative device number. Doh.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/ifconfig/t_tap.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_tap.sh
diff -u src/tests/sbin/ifconfig/t_tap.sh:1.2 src/tests/sbin/ifconfig/t_tap.sh:1.3
--- src/tests/sbin/ifconfig/t_tap.sh:1.2	Thu Jun 25 15:43:26 2020
+++ src/tests/sbin/ifconfig/t_tap.sh	Thu Jun 25 16:52:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_tap.sh,v 1.2 2020/06/25 15:43:26 jruoho Exp $
+# $NetBSD: t_tap.sh,v 1.3 2020/06/25 16:52:49 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -88,7 +88,7 @@ overflow_body() {
 
 overflow_cleanup() {
 
-	ifconfig tap65537
+	ifconfig tap65537 create
 
 	if [ $? -eq 0 ]; then
 		ifconfig tap65537 destroy



CVS commit: src/sys/dev/pci

2020-06-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jun 25 16:40:40 UTC 2020

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

Log Message:
Include all necessary letters in the word "Cryptographic".


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/amdccp_pci.c

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

Modified files:

Index: src/sys/dev/pci/amdccp_pci.c
diff -u src/sys/dev/pci/amdccp_pci.c:1.1 src/sys/dev/pci/amdccp_pci.c:1.2
--- src/sys/dev/pci/amdccp_pci.c:1.1	Wed Jun 24 03:38:01 2020
+++ src/sys/dev/pci/amdccp_pci.c	Thu Jun 25 16:40:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_pci.c,v 1.1 2020/06/24 03:38:01 thorpej Exp $ */
+/* $NetBSD: amdccp_pci.c,v 1.2 2020/06/25 16:40:40 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_pci.c,v 1.1 2020/06/24 03:38:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_pci.c,v 1.2 2020/06/25 16:40:40 thorpej Exp $");
 
 #include 
 #include 
@@ -101,7 +101,7 @@ amdccp_pci_attach(device_t parent, devic
 	sc->sc_dev = self;
 
 	aprint_naive("\n");
-	aprint_normal(": AMD Cryptographc Coprocessor\n");
+	aprint_normal(": AMD Cryptographic Coprocessor\n");
 
 	type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AMDCCP_MEM_BAR);
 	if (PCI_MAPREG_TYPE(type) != PCI_MAPREG_TYPE_MEM) {



CVS commit: src/sys/uvm

2020-06-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jun 25 16:36:43 UTC 2020

Modified Files:
src/sys/uvm: uvm_param.h

Log Message:
If ubc_winshift gets constified, the extern declaration must be too.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/uvm/uvm_param.h

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

Modified files:

Index: src/sys/uvm/uvm_param.h
diff -u src/sys/uvm/uvm_param.h:1.38 src/sys/uvm/uvm_param.h:1.39
--- src/sys/uvm/uvm_param.h:1.38	Wed Aug 22 01:05:24 2018
+++ src/sys/uvm/uvm_param.h	Thu Jun 25 16:36:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_param.h,v 1.38 2018/08/22 01:05:24 msaitoh Exp $	*/
+/*	$NetBSD: uvm_param.h,v 1.39 2020/06/25 16:36:43 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -212,7 +212,7 @@ extern unsigned int user_thread_stack_gu
 #endif
 
 extern int		ubc_nwins;	/* number of UBC mapping windows */
-extern int		ubc_winshift;	/* shift for a UBC mapping window */
+extern const int	ubc_winshift;	/* shift for a UBC mapping window */
 extern u_int		uvm_emap_size;	/* size of emap */
 
 #else



CVS commit: src/tests/sbin/ifconfig

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 16:34:49 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_repeated_updown.sh

Log Message:
Reference also PR kern/52526.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/ifconfig/t_repeated_updown.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_repeated_updown.sh
diff -u src/tests/sbin/ifconfig/t_repeated_updown.sh:1.1 src/tests/sbin/ifconfig/t_repeated_updown.sh:1.2
--- src/tests/sbin/ifconfig/t_repeated_updown.sh:1.1	Thu Jun 25 15:41:40 2020
+++ src/tests/sbin/ifconfig/t_repeated_updown.sh	Thu Jun 25 16:34:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_updown.sh,v 1.1 2020/06/25 15:41:40 jruoho Exp $
+# $NetBSD: t_repeated_updown.sh,v 1.2 2020/06/25 16:34:49 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -30,8 +30,8 @@
 atf_test_case repeated_updown
 repeated_updown_head() {
 	atf_set "require.user" "root"
-	atf_set "descr" "Test with ifconfig(8) that repeated " \
-		"up/down does not cause a panic (PR kern/52771)"
+	atf_set "descr" "Test with ifconfig(8) that repeated up/down " \
+		"does not cause a panic (PR kern/52526; PR kern/52771)"
 }
 
 repeated_updown_body() {



CVS commit: src/sys/kern

2020-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jun 25 16:19:07 UTC 2020

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

Log Message:
Fix NULL deref. The original code before Jaromir's cleanup had an #ifndef
block that wrongly contained the 'else' statement, causing the NULL check
to have no effect.

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


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/kern/sys_pipe.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_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.149 src/sys/kern/sys_pipe.c:1.150
--- src/sys/kern/sys_pipe.c:1.149	Thu Jun 25 14:22:18 2020
+++ src/sys/kern/sys_pipe.c	Thu Jun 25 16:19:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.149 2020/06/25 14:22:18 jdolecek Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.150 2020/06/25 16:19:07 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.149 2020/06/25 14:22:18 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.150 2020/06/25 16:19:07 maxv Exp $");
 
 #include 
 #include 
@@ -778,7 +778,8 @@ pipe_ioctl(file_t *fp, u_long cmd, void 
 		pipe = pipe->pipe_peer;
 		if (pipe == NULL)
 			*(int *)data = 0;
-		*(int *)data = pipe->pipe_buffer.cnt;
+		else
+			*(int *)data = pipe->pipe_buffer.cnt;
 		mutex_exit(lock);
 		return (0);
 



CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 16:16:49 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/kernel: Makefile
Added Files:
src/tests/kernel: t_nointerpreter.sh

Log Message:
Add a test case for PR kern/52744, which no longer appears to be present.


To generate a diff of this commit:
cvs rdiff -u -r1.851 -r1.852 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.66 -r1.67 src/tests/kernel/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/kernel/t_nointerpreter.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.851 src/distrib/sets/lists/tests/mi:1.852
--- src/distrib/sets/lists/tests/mi:1.851	Thu Jun 25 15:41:40 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 16:16:49 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.851 2020/06/25 15:41:40 jruoho Exp $
+# $NetBSD: mi,v 1.852 2020/06/25 16:16:49 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -2200,6 +2200,7 @@
 ./usr/tests/kernel/t_lwpctl			tests-obsolete		obsolete
 ./usr/tests/kernel/t_mkdir			tests-obsolete		obsolete
 ./usr/tests/kernel/t_mqueue			tests-kernel-tests	compattestfile,atf
+./usr/tests/kernel/t_nointerpreter		tests-kernel-tests	atf
 ./usr/tests/kernel/t_origin			tests-kernel-tests	compattestfile,atf
 ./usr/tests/kernel/t_pipe			tests-obsolete		obsolete
 ./usr/tests/kernel/t_poll3w			tests-obsolete		obsolete

Index: src/tests/kernel/Makefile
diff -u src/tests/kernel/Makefile:1.66 src/tests/kernel/Makefile:1.67
--- src/tests/kernel/Makefile:1.66	Sun Mar  1 18:08:15 2020
+++ src/tests/kernel/Makefile	Thu Jun 25 16:16:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.66 2020/03/01 18:08:15 christos Exp $
+# $NetBSD: Makefile,v 1.67 2020/06/25 16:16:48 jruoho Exp $
 
 NOMAN=		# defined
 
@@ -26,6 +26,7 @@ TESTS_SH+=	t_umountstress
 TESTS_SH+=	t_ps_strings
 TESTS_SH+=	t_trapsignal
 TESTS_SH+=	t_interp
+TESTS_SH+=	t_nointerpreter
 TESTS_SH+=	t_origin
 TESTS_SH+=	t_procpath
 TESTS_SH+=	t_fexecve

Added files:

Index: src/tests/kernel/t_nointerpreter.sh
diff -u /dev/null src/tests/kernel/t_nointerpreter.sh:1.1
--- /dev/null	Thu Jun 25 16:16:49 2020
+++ src/tests/kernel/t_nointerpreter.sh	Thu Jun 25 16:16:48 2020
@@ -0,0 +1,59 @@
+# $NetBSD: t_nointerpreter.sh,v 1.1 2020/06/25 16:16:48 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+tmp="/tmp/nointerpreter"
+
+atf_test_case nointerpreter cleanup
+nointerpreter_head() {
+	atf_set "descr" "Check that executing shell scripts without a " \
+		"specified interpreter does not spam (PR kern/52744)"
+}
+
+nointerpreter_body() {
+
+	echo "echo hello world" > $tmp
+	chmod u+x $tmp
+	. $tmp
+	spam=$(dmesg | grep "check exec failed")
+
+	if [ ! -z $spam ]; then
+		atf_fail "Kernel spams harmless diagnostics"
+	fi
+}
+
+nointerpreter_cleanup() {
+
+	if [ -f $tmp ]; then
+		rm $tmp
+	fi
+}
+
+atf_init_test_cases() {
+	atf_add_test_case nointerpreter
+}



CVS commit: src/usr.bin/make

2020-06-25 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Jun 25 15:45:37 UTC 2020

Modified Files:
src/usr.bin/make: meta.c

Log Message:
filemon_read: report error if lseek fails

Reviewed by: riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/usr.bin/make/meta.c

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

Modified files:

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.81 src/usr.bin/make/meta.c:1.82
--- src/usr.bin/make/meta.c:1.81	Fri Apr  3 03:32:28 2020
+++ src/usr.bin/make/meta.c	Thu Jun 25 15:45:37 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.81 2020/04/03 03:32:28 sjg Exp $ */
+/*  $NetBSD: meta.c,v 1.82 2020/06/25 15:45:37 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -170,14 +170,18 @@ filemon_read(FILE *mfp, int fd)
 	return 0;
 }
 /* rewind */
-(void)lseek(fd, (off_t)0, SEEK_SET);
-
-error = 0;
-fprintf(mfp, "\n-- filemon acquired metadata --\n");
+if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
+	error = errno;
+	warn("Could not rewind filemon");
+	fprintf(mfp, "\n");
+} else {
+	error = 0;
+	fprintf(mfp, "\n-- filemon acquired metadata --\n");
 
-while ((n = read(fd, buf, sizeof(buf))) > 0) {
-	if ((int)fwrite(buf, 1, n, mfp) < n)
-	error = EIO;
+	while ((n = read(fd, buf, sizeof(buf))) > 0) {
+	if ((int)fwrite(buf, 1, n, mfp) < n)
+		error = EIO;
+	}
 }
 fflush(mfp);
 if (close(fd) < 0)



CVS commit: src/tests

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 15:43:27 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_tap.sh
src/tests/usr.sbin/cpuctl: t_cpuctl.sh

Log Message:
Fix pastos.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/ifconfig/t_tap.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.sbin/cpuctl/t_cpuctl.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_tap.sh
diff -u src/tests/sbin/ifconfig/t_tap.sh:1.1 src/tests/sbin/ifconfig/t_tap.sh:1.2
--- src/tests/sbin/ifconfig/t_tap.sh:1.1	Thu Jun 25 14:24:46 2020
+++ src/tests/sbin/ifconfig/t_tap.sh	Thu Jun 25 15:43:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_tap.sh,v 1.1 2020/06/25 14:24:46 jruoho Exp $
+# $NetBSD: t_tap.sh,v 1.2 2020/06/25 15:43:26 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,7 +50,7 @@ manytaps_body() {
 		fi
 
 		ifconfig "tap$tap" create
-		echo "Created $tap"
+		echo "Created tap$tap"
 
 	done < $taps
 }

Index: src/tests/usr.sbin/cpuctl/t_cpuctl.sh
diff -u src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.2 src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.3
--- src/tests/usr.sbin/cpuctl/t_cpuctl.sh:1.2	Wed Jun 24 10:07:13 2020
+++ src/tests/usr.sbin/cpuctl/t_cpuctl.sh	Thu Jun 25 15:43:26 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_cpuctl.sh,v 1.2 2020/06/24 10:07:13 jruoho Exp $
+# $NetBSD: t_cpuctl.sh,v 1.3 2020/06/25 15:43:26 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -126,13 +126,13 @@ err_body() {
 		-o empty -x cpuctl nointr -1
 
 	atf_check -s exit:1 -e ignore \
-		-o empty -x cpuctl identify $(exp ncpu + 1)
+		-o empty -x cpuctl identify $(expr ncpu + 1)
 
 	atf_check -s exit:1 -e ignore \
-		-o empty -x cpuctl offline $(exp ncpu + 1)
+		  -o empty -x cpuctl offline $(expr ncpu + 1)
 
 	atf_check -s exit:1 -e ignore \
-		-o empty -x cpuctl nointr $(exp ncpu + 1)
+		-o empty -x cpuctl nointr $(expr ncpu + 1)
 }
 
 err_cleanup() {



CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 15:41:40 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/sbin/ifconfig: Makefile
Added Files:
src/tests/sbin/ifconfig: t_repeated_updown.sh

Log Message:
Add a test case for kern/52771.


To generate a diff of this commit:
cvs rdiff -u -r1.850 -r1.851 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/ifconfig/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/ifconfig/t_repeated_updown.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.850 src/distrib/sets/lists/tests/mi:1.851
--- src/distrib/sets/lists/tests/mi:1.850	Thu Jun 25 15:01:35 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 15:41:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.850 2020/06/25 15:01:35 jruoho Exp $
+# $NetBSD: mi,v 1.851 2020/06/25 15:41:40 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3995,6 +3995,7 @@
 ./usr/tests/sbin/ifconfig/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
 ./usr/tests/sbin/ifconfig/t_nonexistent		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_repeated_scan	tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/ifconfig/t_repeated_updown	tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_tap			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfstests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfs/Atffile			tests-sbin-tests	compattestfile,atf

Index: src/tests/sbin/ifconfig/Makefile
diff -u src/tests/sbin/ifconfig/Makefile:1.3 src/tests/sbin/ifconfig/Makefile:1.4
--- src/tests/sbin/ifconfig/Makefile:1.3	Thu Jun 25 14:24:46 2020
+++ src/tests/sbin/ifconfig/Makefile	Thu Jun 25 15:41:40 2020
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.3 2020/06/25 14:24:46 jruoho Exp $
+# $NetBSD: Makefile,v 1.4 2020/06/25 15:41:40 jruoho Exp $
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/sbin/ifconfig
 
-TESTS_SH=	t_nonexistent t_repeated_scan t_tap
+TESTS_SH=	t_nonexistent t_repeated_scan t_repeated_updown t_tap
 
 .include 

Added files:

Index: src/tests/sbin/ifconfig/t_repeated_updown.sh
diff -u /dev/null src/tests/sbin/ifconfig/t_repeated_updown.sh:1.1
--- /dev/null	Thu Jun 25 15:41:40 2020
+++ src/tests/sbin/ifconfig/t_repeated_updown.sh	Thu Jun 25 15:41:40 2020
@@ -0,0 +1,70 @@
+# $NetBSD: t_repeated_updown.sh,v 1.1 2020/06/25 15:41:40 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+atf_test_case repeated_updown
+repeated_updown_head() {
+	atf_set "require.user" "root"
+	atf_set "descr" "Test with ifconfig(8) that repeated " \
+		"up/down does not cause a panic (PR kern/52771)"
+}
+
+repeated_updown_body() {
+
+	# Try to avoid stalling any automated test runs.
+	#
+	n=35
+
+	for i in $(ifconfig -l); do
+
+		state="up"
+		ifconfig -s $i
+
+		if [ $? -eq 1 ]; then
+			state="down"
+			ifconfig $i up
+			echo "Initialized $i up"
+		fi
+
+		while [ $n -gt 0 ]; do
+			ifconfig $i down
+			echo "Test $n: $i down"
+			ifconfig $i up
+			echo "Test $n: $i up"
+			n=$(expr $n - 1)
+		done
+
+		ifconfig $i $state
+		echo "Restored state of $i to $state"
+		sleep 1
+	done
+}
+
+atf_init_test_cases() {
+	atf_add_test_case repeated_updown
+}



CVS commit: src/usr.bin/logger

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 15:21:57 UTC 2020

Modified Files:
src/usr.bin/logger: logger.1

Log Message:
Fix PR kern/5.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/logger/logger.1

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

Modified files:

Index: src/usr.bin/logger/logger.1
diff -u src/usr.bin/logger/logger.1:1.15 src/usr.bin/logger/logger.1:1.16
--- src/usr.bin/logger/logger.1:1.15	Sun May 13 17:08:31 2012
+++ src/usr.bin/logger/logger.1	Thu Jun 25 15:21:56 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: logger.1,v 1.15 2012/05/13 17:08:31 njoly Exp $
+.\"	$NetBSD: logger.1,v 1.16 2020/06/25 15:21:56 jruoho Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)logger.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd April 26, 2012
+.Dd June 25, 2020
 .Dt LOGGER 1
 .Os
 .Sh NAME
@@ -54,8 +54,12 @@ Options:
 .Pp
 .Bl -tag -width "messageXX"
 .It Fl c
-Log to console
-.Dv ( LOG_CONS ) .
+Log to console as a fallback
+.Dv ( LOG_CONS ) :
+if the message cannot be passed to
+.Xr syslogd 8 ,
+the message is written to
+.Pa /dev/console .
 .It Fl d Ar sd
 Log this in the structured data (SD) field.
 .Po



CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 15:01:36 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/etc/mtree: NetBSD.dist.tests
src/tests/sbin: Makefile
Added Files:
src/tests/sbin/envstat: Makefile t_envstat.sh

Log Message:
Add a test case for PR kern/53410.


To generate a diff of this commit:
cvs rdiff -u -r1.849 -r1.850 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.166 -r1.167 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.7 -r1.8 src/tests/sbin/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/envstat/Makefile \
src/tests/sbin/envstat/t_envstat.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.849 src/distrib/sets/lists/tests/mi:1.850
--- src/distrib/sets/lists/tests/mi:1.849	Thu Jun 25 14:24:45 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 15:01:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.849 2020/06/25 14:24:45 jruoho Exp $
+# $NetBSD: mi,v 1.850 2020/06/25 15:01:35 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3967,6 +3967,10 @@
 ./usr/tests/sbintests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/Atffile			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/Kyuafile			tests-sbin-tests	compattestfile,atf,kyua
+./usr/tests/sbin/envstat			tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/envstat/Atffile		tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/envstat/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
+./usr/tests/sbin/envstat/t_envstat		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/fsck_ffs			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/fsck_ffs/Atffile		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/fsck_ffs/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.166 src/etc/mtree/NetBSD.dist.tests:1.167
--- src/etc/mtree/NetBSD.dist.tests:1.166	Wed Jun 24 10:05:07 2020
+++ src/etc/mtree/NetBSD.dist.tests	Thu Jun 25 15:01:35 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.166 2020/06/24 10:05:07 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.167 2020/06/25 15:01:35 jruoho Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -371,6 +371,7 @@
 ./usr/tests/rump/rumpnet
 ./usr/tests/rump/rumpvfs
 ./usr/tests/sbin
+./usr/tests/sbin/envstat
 ./usr/tests/sbin/fsck_ffs
 ./usr/tests/sbin/gpt
 ./usr/tests/sbin/ifconfig

Index: src/tests/sbin/Makefile
diff -u src/tests/sbin/Makefile:1.7 src/tests/sbin/Makefile:1.8
--- src/tests/sbin/Makefile:1.7	Fri Dec  4 17:20:38 2015
+++ src/tests/sbin/Makefile	Thu Jun 25 15:01:35 2020
@@ -1,10 +1,12 @@
-#	$NetBSD: Makefile,v 1.7 2015/12/04 17:20:38 christos Exp $
+#	$NetBSD: Makefile,v 1.8 2020/06/25 15:01:35 jruoho Exp $
 #
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/sbin
 
-TESTS_SUBDIRS+=	fsck_ffs gpt ifconfig newfs newfs_msdos resize_ffs route sysctl
+TESTS_SUBDIRS+=	envstat fsck_ffs gpt ifconfig \
+		newfs newfs_msdos resize_ffs \
+		route sysctl
 
 .include 

Added files:

Index: src/tests/sbin/envstat/Makefile
diff -u /dev/null src/tests/sbin/envstat/Makefile:1.1
--- /dev/null	Thu Jun 25 15:01:36 2020
+++ src/tests/sbin/envstat/Makefile	Thu Jun 25 15:01:35 2020
@@ -0,0 +1,8 @@
+# $NetBSD: Makefile,v 1.1 2020/06/25 15:01:35 jruoho Exp $
+
+.include 
+
+TESTSDIR=	${TESTSBASE}/sbin/envstat
+TESTS_SH=	t_envstat
+
+.include 
Index: src/tests/sbin/envstat/t_envstat.sh
diff -u /dev/null src/tests/sbin/envstat/t_envstat.sh:1.1
--- /dev/null	Thu Jun 25 15:01:36 2020
+++ src/tests/sbin/envstat/t_envstat.sh	Thu Jun 25 15:01:35 2020
@@ -0,0 +1,67 @@
+# $NetBSD: t_envstat.sh,v 1.1 2020/06/25 15:01:35 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 

CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-25 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 14:59:51 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: opensnoop.1m

Log Message:
Try to improve markup.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.3 src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.4
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.3	Thu Jun 25 09:39:19 2020
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m	Thu Jun 25 14:59:51 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: opensnoop.1m,v 1.3 2020/06/25 09:39:19 sevan Exp $
+.\" $NetBSD: opensnoop.1m,v 1.4 2020/06/25 14:59:51 uwe Exp $
 .Dd June 25, 2020
 .Dt OPENSNOOP 1
 .Os
@@ -16,12 +16,12 @@
 tracks file opens.
 As a process issues a file open, details such as UID, PID and pathname are
 printed out.
-The returned file descriptor is printed, a value of -1 indicates an error.
+The returned file descriptor is printed, a value of \-1 indicates an error.
 This can be useful for troubleshooting to determine if appliacions are
 attempting to open files that do not exist.
 Since this uses DTrace, only the root user or users with the
 dtrace_kernel privilege can run this command.
-.Bl -tag -width Ds
+.Bl -tag -width Fl
 .It Fl a
 print all data
 .It Fl A
@@ -47,51 +47,49 @@ process name to snoop
 .It Fl p Ar PID
 process ID to snoop
 .El
-.Bl -column fieldtitle description
+.Bl -column "STRTIME"
 .It Sy Fields Ta Sy Description
-.It ZONE Ta Zone name
-.It UID	Ta User ID
-.It PID Ta Process ID
-.It PPID Ta Parent Process ID
-.It FD Ta File Descriptor (-1 is error)
-.It ERR Ta errno value ( see
-.Pa /usr/include/sys/errno.h
-)
-.It CWD Ta current working directory of process
-.It PATH Ta pathname for file open
-.It COMM Ta command name for the process
-.It ARGS Ta argument listing for the process
-.It TIME Ta timestamp for the open event, us
-.It STRTIME Ta timestamp for the open event, string
+.It ZONE  Ta Zone name
+.It UID   Ta User ID
+.It PID   Ta Process ID
+.It PPID  Ta Parent Process ID
+.It FDTa File Descriptor
+.Pq \-1 is error
+.It ERR   Ta Va errno
+value
+.Pq see Pa /usr/include/sys/errno.h
+.It CWD   Ta current working directory of process
+.It PATH  Ta pathname for file open
+.It COMM  Ta command name for the process
+.It ARGS  Ta argument listing for the process
+.It TIME  Ta timestamp for the open event, us
+.It STRTIME   Ta timestamp for the open event, string
 .El
 .Sh EXAMPLES
 Default output, print file opens by process as they occur,
-.Bd -literal -offset indent
-.Ic opensnoop
-.Ed
+.Pp
+.Dl Ic opensnoop
 .Pp
 Print human readable timestamps,
-.Bd -literal -offset indent
-.Ic opensnoop -v
-.Ed
+.Pp
+.Dl Ic opensnoop -v
 .Pp
 See error codes,
-.Bd -literal -offset indent
-.Ic opensnoop -e
-.Ed
+.Pp
+.Dl Ic opensnoop -e
 .Pp
 Snoop this file only,
-.Bd -literal -offset indent
-.Ic opensnoop -f /etc/passwd
-.Ed
+.Pp
+.Dl Ic opensnoop -f /etc/passwd
 .Sh STABILITY
-stable - needs the syscall provider.
+stable \(em needs the syscall provider.
 .Sh DOCUMENTATION
 See the DTraceToolkit for further documentation under the Docs directory.
 The DTraceToolkit docs may include full worked examples with verbose
 descriptions explaining the output.
 .Sh EXIT
-opensnoop will run forever until Ctrl\-C is hit.
+.Nm
+will run forever until Ctrl\-C is hit.
 .Sh SEE ALSO
 .Xr dtrace 1
 .Sh AUTHORS
@@ -100,8 +98,7 @@ opensnoop will run forever until Ctrl\-C
 .Sh BUGS
 Occasionally the pathname for the file open cannot be read and the following
 error will be seen,
-.Bd -literal -offset indent
-dtrace: error on enabled probe ID 6 (...): invalid address
-.Ed
+.Pp
+.Dl dtrace: error on enabled probe ID 6 (...): invalid address
 .Pp
 this is normal behaviour.



CVS commit: src/sys/conf

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 14:52:26 UTC 2020

Modified Files:
src/sys/conf: Makefile.kern.inc

Log Message:
enable gcc stack usage limit for kernel functions, set to 3.5 KiB for now
as that seems to be enough to accomodate the current biggest stack usages

there are about six functions which use over 3KiB local stack, and
about a dozen between 2-3 KiB, so pushing this further needs more work
if desired

compile tested on amd64, i386, sparc64, sparc, powerpc (evbppc - BookE),
m68k (mac68k)


To generate a diff of this commit:
cvs rdiff -u -r1.273 -r1.274 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.273 src/sys/conf/Makefile.kern.inc:1.274
--- src/sys/conf/Makefile.kern.inc:1.273	Fri Jun 19 00:58:17 2020
+++ src/sys/conf/Makefile.kern.inc	Thu Jun 25 14:52:26 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.273 2020/06/19 00:58:17 simonb Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.274 2020/06/25 14:52:26 jdolecek Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -108,7 +108,7 @@ AFLAGS+=	-D_LOCORE -Wa,--fatal-warnings
 #find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n
 .if ${MACHINE} != "vax"
 # GCC/vax 8.4 does not support -fstack-usage.
-CFLAGS+=	${${ACTIVE_CC} == "gcc":? -fstack-usage :}
+CFLAGS+=	${${ACTIVE_CC} == "gcc":? -fstack-usage -Wstack-usage=3584 :}
 .endif
 
 # XXX



CVS commit: src/sys/arch/powerpc/booke/dev

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 14:52:00 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3obio.c

Log Message:
avoid variable-length array


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/booke/dev/pq3obio.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/powerpc/booke/dev/pq3obio.c
diff -u src/sys/arch/powerpc/booke/dev/pq3obio.c:1.3 src/sys/arch/powerpc/booke/dev/pq3obio.c:1.4
--- src/sys/arch/powerpc/booke/dev/pq3obio.c:1.3	Sat May 28 05:27:20 2011
+++ src/sys/arch/powerpc/booke/dev/pq3obio.c	Thu Jun 25 14:52:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3obio.c,v 1.3 2011/05/28 05:27:20 matt Exp $	*/
+/*	$NetBSD: pq3obio.c,v 1.4 2020/06/25 14:52:00 jdolecek Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,7 +40,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v 1.3 2011/05/28 05:27:20 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v 1.4 2020/06/25 14:52:00 jdolecek Exp $");
 
 #include 
 #include 
@@ -53,6 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: pq3obio.c,v 
 #include 
 #include 
 
+#define OBIO_PORTS	8
+
 static int pq3obio_match(device_t, cfdata_t, void *);
 static void pq3obio_attach(device_t, device_t, void *);
 
@@ -189,7 +191,7 @@ pq3obio_attach(device_t parent, device_t
 		return;
 	}
 
-	for (u_int i = 0; i < 8; i++) {
+	for (u_int i = 0; i < OBIO_PORTS; i++) {
 		struct pq3lbc_softc * const lbc = >sc_lbcs[i];
 		uint32_t br = bus_space_read_4(sc->sc_bst, sc->sc_bsh, BRn(i));
 		if (br & BR_V) {
@@ -210,10 +212,10 @@ pq3obio_attach(device_t parent, device_t
 	t->pbs_limit = 0;
 	t->pbs_flags = _BUS_SPACE_BIG_ENDIAN;
 
-	u_int sorted[found];
+	u_int sorted[OBIO_PORTS];
 	u_int nsorted = 0;
 
-	for (u_int i = 0; i < 8; i++) {
+	for (u_int i = 0; i < OBIO_PORTS; i++) {
 		struct pq3lbc_softc * const lbc = >sc_lbcs[i];
 		if ((lbc->lbc_br & BR_V) == 0)
 			continue;



CVS commit: src

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 14:24:46 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/sbin/ifconfig: Makefile
Added Files:
src/tests/sbin/ifconfig: t_tap.sh

Log Message:
Add test cases for PR kern/53546 and PR kern/55417. Both are skipped as
both reproduce panics.


To generate a diff of this commit:
cvs rdiff -u -r1.848 -r1.849 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/ifconfig/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/sbin/ifconfig/t_tap.sh

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.848 src/distrib/sets/lists/tests/mi:1.849
--- src/distrib/sets/lists/tests/mi:1.848	Wed Jun 24 10:05:07 2020
+++ src/distrib/sets/lists/tests/mi	Thu Jun 25 14:24:45 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.848 2020/06/24 10:05:07 jruoho Exp $
+# $NetBSD: mi,v 1.849 2020/06/25 14:24:45 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3991,6 +3991,7 @@
 ./usr/tests/sbin/ifconfig/Kyuafile		tests-sbin-tests	compattestfile,atf,kyua
 ./usr/tests/sbin/ifconfig/t_nonexistent		tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/ifconfig/t_repeated_scan	tests-sbin-tests	compattestfile,atf
+./usr/tests/sbin/ifconfig/t_tap			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfstests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfs/Atffile			tests-sbin-tests	compattestfile,atf
 ./usr/tests/sbin/newfs/Kyuafile			tests-sbin-tests	compattestfile,atf,kyua

Index: src/tests/sbin/ifconfig/Makefile
diff -u src/tests/sbin/ifconfig/Makefile:1.2 src/tests/sbin/ifconfig/Makefile:1.3
--- src/tests/sbin/ifconfig/Makefile:1.2	Wed Jun 24 09:11:26 2020
+++ src/tests/sbin/ifconfig/Makefile	Thu Jun 25 14:24:46 2020
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.2 2020/06/24 09:11:26 jruoho Exp $
+# $NetBSD: Makefile,v 1.3 2020/06/25 14:24:46 jruoho Exp $
 
 .include 
 
 TESTSDIR=	${TESTSBASE}/sbin/ifconfig
 
-TESTS_SH=	t_nonexistent t_repeated_scan
+TESTS_SH=	t_nonexistent t_repeated_scan t_tap
 
 .include 

Added files:

Index: src/tests/sbin/ifconfig/t_tap.sh
diff -u /dev/null src/tests/sbin/ifconfig/t_tap.sh:1.1
--- /dev/null	Thu Jun 25 14:24:46 2020
+++ src/tests/sbin/ifconfig/t_tap.sh	Thu Jun 25 14:24:46 2020
@@ -0,0 +1,101 @@
+# $NetBSD: t_tap.sh,v 1.1 2020/06/25 14:24:46 jruoho Exp $
+#
+# Copyright (c) 2020 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jukka Ruohonen.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+taps="/tmp/taps"
+
+atf_test_case manytaps cleanup
+manytaps_head() {
+	atf_set "require.user" "root"
+	atf_set "descr" "Test creating many, many tap(4)'s (PR kern/55417)"
+}
+
+manytaps_body() {
+
+	atf_skip "The test causes a panic (PR kern/55417)"
+	seq 65535 64000 > $taps
+
+	while read tap; do
+
+		ifconfig "tap$tap"
+
+		if [ $? -eq 0 ]; then
+			echo "Skipping existing tap$tap"
+			continue
+		fi
+
+		ifconfig "tap$tap" create
+		echo "Created $tap"
+
+	done < $taps
+}
+
+manytaps_cleanup() {
+
+	if [ -f $taps ]; then
+
+		while read tap; do
+
+			ifconfig "tap$tap"
+
+			if [ $? -eq 0 ]; then
+ifconfig "tap$tap" destroy
+echo "Destroyed tap$tap"
+			fi
+
+		done < $taps
+
+		rm $taps
+	fi
+}
+
+atf_test_case overflow cleanup
+overflow_head() {
+	atf_set "require.user" "root"
+	atf_set "descr" "Test creating a tap(4) with a " \
+		"negative device number (PR kern/53546)"
+}
+
+overflow_body() {
+	atf_skip "The test causes a panic (PR kern/53546)"
+	ifconfig 

CVS commit: src/sys

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 14:22:19 UTC 2020

Modified Files:
src/sys/kern: sys_pipe.c
src/sys/sys: pipe.h

Log Message:
remove experimental direct pipe code (using uvm_loan()) I added in 2001 - it's
slower than the non-direct variant on MP systems, if anybody wants
to hack on this further it's available in Attic


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.36 -r1.37 src/sys/sys/pipe.h

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

Modified files:

Index: src/sys/kern/sys_pipe.c
diff -u src/sys/kern/sys_pipe.c:1.148 src/sys/kern/sys_pipe.c:1.149
--- src/sys/kern/sys_pipe.c:1.148	Fri Apr 26 17:24:23 2019
+++ src/sys/kern/sys_pipe.c	Thu Jun 25 14:22:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pipe.c,v 1.148 2019/04/26 17:24:23 mlelstv Exp $	*/
+/*	$NetBSD: sys_pipe.c,v 1.149 2020/06/25 14:22:18 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.148 2019/04/26 17:24:23 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.149 2020/06/25 14:22:18 jdolecek Exp $");
 
 #include 
 #include 
@@ -92,24 +92,6 @@ __KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v
 #include 
 #include 
 
-/*
- * Use this to disable direct I/O and decrease the code size:
- * #define PIPE_NODIRECT
- */
-
-/* XXX Disabled for now; rare hangs switching between direct/buffered */
-#define PIPE_NODIRECT
-
-#ifndef PIPE_NODIRECT
-#include 
-
-#if !defined(PMAP_DIRECT)
-#  define PIPE_NODIRECT		/* Direct map interface not available */
-#endif
-
-bool pipe_direct = true;
-#endif
-
 static int	pipe_read(file_t *, off_t *, struct uio *, kauth_cred_t, int);
 static int	pipe_write(file_t *, off_t *, struct uio *, kauth_cred_t, int);
 static int	pipe_close(file_t *);
@@ -159,19 +141,10 @@ static int	pipe_create(struct pipe **, p
 static int	pipelock(struct pipe *, bool);
 static inline void pipeunlock(struct pipe *);
 static void	pipeselwakeup(struct pipe *, struct pipe *, int);
-#ifndef PIPE_NODIRECT
-static int	pipe_direct_write(file_t *, struct pipe *, struct uio *);
-#endif
 static int	pipespace(struct pipe *, int);
 static int	pipe_ctor(void *, void *, int);
 static void	pipe_dtor(void *, void *);
 
-#ifndef PIPE_NODIRECT
-static int	pipe_loan_alloc(struct pipe *, int);
-static void	pipe_loan_free(struct pipe *);
-static int	pipe_direct_process_read(void *, size_t, void *);
-#endif /* PIPE_NODIRECT */
-
 static pool_cache_t	pipe_wr_cache;
 static pool_cache_t	pipe_rd_cache;
 
@@ -439,16 +412,6 @@ pipeselwakeup(struct pipe *selp, struct 
 	fownsignal(sigp->pipe_pgid, SIGIO, code, band, selp);
 }
 
-#ifndef PIPE_NODIRECT
-static int
-pipe_direct_process_read(void *va, size_t len, void *arg)
-{
-	struct uio *uio = (struct uio *)arg;
-
-	return uiomove(va, len, uio);
-}
-#endif
-
 static int
 pipe_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred,
 int flags)
@@ -507,45 +470,6 @@ again:
 			continue;
 		}
 
-#ifndef PIPE_NODIRECT
-		if ((rpipe->pipe_state & PIPE_DIRECTR) != 0) {
-			struct pipemapping * const rmap = >pipe_map;
-			voff_t pgoff;
-			u_int pgst, npages;
-
-			/*
-			 * Direct copy, bypassing a kernel buffer.
-			 */
-			KASSERT(rpipe->pipe_state & PIPE_DIRECTW);
-
-			size = MIN(rmap->cnt, uio->uio_resid);
-
-			if (size > 0) {
-KASSERT(size > 0);
-mutex_exit(lock);
-
-pgst = rmap->pos >> PAGE_SHIFT;
-pgoff = rmap->pos & PAGE_MASK;
-npages = (size + pgoff + PAGE_SIZE - 1) >> PAGE_SHIFT;
-KASSERTMSG(npages > 0 && (pgst + npages) <= rmap->npages, "npages %u pgst %u rmap->npages %u", npages, pgst, rmap->npages);
-
-error = uvm_direct_process(>pgs[pgst], npages,
-pgoff, size, pipe_direct_process_read, uio);
-mutex_enter(lock);
-
-nread += size;
-rmap->pos += size;
-rmap->cnt -= size;
-			}
-
-			if (rmap->cnt == 0) {
-rpipe->pipe_state &= ~PIPE_DIRECTR;
-cv_broadcast(>pipe_wcv);
-			}
-
-			continue;
-		}
-#endif
 		/*
 		 * Break if some data was read.
 		 */
@@ -574,12 +498,6 @@ again:
 		 */
 		pipeunlock(rpipe);
 
-		/*
-		 * Re-check to see if more direct writes are pending.
-		 */
-		if ((rpipe->pipe_state & PIPE_DIRECTR) != 0)
-			goto again;
-
 #if 1   /* XXX (dsl) I'm sure these aren't needed here ... */
 		/*
 		 * We want to read more, wake up select/poll.
@@ -634,189 +552,6 @@ unlocked_error:
 	return (error);
 }
 
-#ifndef PIPE_NODIRECT
-/*
- * Allocate structure for loan transfer.
- */
-static int
-pipe_loan_alloc(struct pipe *wpipe, int npages)
-{
-	struct pipemapping * const wmap = >pipe_map;
-
-	KASSERT(wmap->npages == 0);
-
-	if (npages > wmap->maxpages) {
-		pipe_loan_free(wpipe);
-
-		wmap->pgs = kmem_alloc(npages * sizeof(struct vm_page *), KM_NOSLEEP);
-		if (wmap->pgs == NULL)
-			return ENOMEM;
-		wmap->maxpages = 

CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-25 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Jun 25 14:08:48 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: dtruss.1m

Log Message:
Try to improve markup.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.4 src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.5
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.4	Thu Jun 25 09:39:19 2020
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m	Thu Jun 25 14:08:48 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: dtruss.1m,v 1.4 2020/06/25 09:39:19 sevan Exp $
+.\" $NetBSD: dtruss.1m,v 1.5 2020/06/25 14:08:48 uwe Exp $
 .Dd June 25, 2020
 .Dt DTRUSS 1
 .Os
@@ -22,17 +22,19 @@ consuming CPU cycles.
 .Pp
 Since this uses DTrace, only the root user or users with the dtrace_kernel
 privilege can run this command.
-.Bl -tag -width Ds
+.Bl -tag -width Fl
 .It Fl a
 print all details
 .It Fl b Ar bufsize
 dynamic variable buffer size.
 Increase this if you notice dynamic variable drop errors.
-The default is "4m" for 4 megabytes per CPU.
+The default is
+.Ql "4m"
+for 4\~megabytes per CPU.
 .It Fl c
 print system call counts
 .It Fl d
-print relative timestamps, us
+print relative timestamps, us (microseconds)
 .It Fl e
 print elapsed times, us
 .It Fl f
@@ -52,41 +54,42 @@ examine this PID
 .It Fl t Ar syscall
 examine this syscall only
 .El
-.Bl -column fieldtitle description
-.It Sy Fields Ta Sy Description
-.It PID/LWPID	Process ID / Lightweight Process ID
-.It RELATIVE	relative timestamps to the start of the thread, us (microseconds)
-.It ELAPSD	elapsed time for this system call, us
-.It CPU	on-cpu time for this system call, us
-.It SYSCALL(args)	system call name, with arguments (some may be evaluated)
+.Bl -column "SYSCALL(args)"
+.It Sy Field  Ta Sy Description
+.It PID/LWPID Ta Process ID\|/\|Lightweight Process ID
+.It RELATIVE  Ta relative timestamps to the start of the thread, us
+.It ELAPSDTa elapsed time for this system call, us
+.It CPU	  Ta on-cpu time for this system call, us
+.It SYSCALL(args) Ta system call name, with arguments (some may be evaluated)
 .El
 .Sh EXAMPLES
-run and examine the "df -h" command
-.Bd -literal -offset indent
-.Ic dtruss df -h
-.Ed
+run and examine the
+.Ql df -h
+command
+.Pp
+.Dl Ic dtruss df -h
 .Pp
 examine PID 1871
-.Bd -literal -offset indent
-.Ic dtruss -p 1871
-.Ed
+.Pp
+.Dl Ic dtruss -p 1871
 .Pp
 examine all processes called "tar"
-.Bd -literal -offset indent
-.Ic dtruss -n tar
-.Ed
-.Pp
-run test.sh and follow children
-.Bd -literal -offset indent
-.Ic dtruss -f test.sh
-.Ed
-.Pp
-run the "date" command and print elapsed and on cpu times,
-.Bd -literal -offset indent
-.Ic dtruss -eo date
-.Ed
+.Pp
+.Dl Ic dtruss -n tar
+.Pp
+run
+.Ql test.sh
+and follow children
+.Pp
+.Dl Ic dtruss -f test.sh
+.Pp
+run the
+.Ql date
+command and print elapsed and on cpu times,
+.Pp
+.Dl Ic dtruss -eo date
 .Sh STABILITY
-stable - needs the syscall provider.
+stable \(em needs the syscall provider.
 .Sh DOCUMENTATION
 See the DTraceToolkit for further documentation under the Docs directory.
 The DTraceToolkit docs may include full worked examples with verbose



CVS commit: src/sys/uvm

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 14:04:30 UTC 2020

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

Log Message:
make ubc_winshift / ubc_winsize constant, and based on whatever is bigger
of (1 << UBC_WINSHIFT, MAX_PAGE_SIZE)

given that default UBC_WINSHIFT is 13, this changes behaviour only
for mips and powerpc (BookE/OEA), which will now have twice as much
memory used for UBC windows; if this ever becomes a problem, it's
possible to reduce ubc_nwins in MD code similar to what is done on sparc

this eliminates variable-length arrays in ubc_fault(),
ubc_uiomove(), and ubc_zerorange() so that the stack usage can be
determined and checked in compile time


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/uvm/uvm_bio.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.117 src/sys/uvm/uvm_bio.c:1.118
--- src/sys/uvm/uvm_bio.c:1.117	Mon May 25 19:29:08 2020
+++ src/sys/uvm/uvm_bio.c	Thu Jun 25 14:04:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.117 2020/05/25 19:29:08 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.118 2020/06/25 14:04:30 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.117 2020/05/25 19:29:08 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.118 2020/06/25 14:04:30 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 
 #include 
 #include 
 #include 
+#include 		/* for ilog2() */
 
 #include 
 #include 
@@ -120,9 +121,13 @@ const struct uvm_pagerops ubc_pager = {
 	/* ... rest are NULL */
 };
 
+/* Use value at least as big as maximum page size supported by architecture */
+#define UBC_MAX_WINSHIFT	\
+((1 << UBC_WINSHIFT) > MAX_PAGE_SIZE ? UBC_WINSHIFT : ilog2(MAX_PAGE_SIZE))
+
 int ubc_nwins = UBC_NWINS;
-int ubc_winshift __read_mostly = UBC_WINSHIFT;
-int ubc_winsize __read_mostly;
+const int ubc_winshift = UBC_MAX_WINSHIFT;
+const int ubc_winsize = 1 << UBC_MAX_WINSHIFT;
 #if defined(PMAP_PREFER)
 int ubc_nqueues;
 #define UBC_NQUEUES ubc_nqueues
@@ -161,9 +166,7 @@ ubc_init(void)
 	/*
 	 * Make sure ubc_winshift is sane.
 	 */
-	if (ubc_winshift < PAGE_SHIFT)
-		ubc_winshift = PAGE_SHIFT;
-	ubc_winsize = 1 << ubc_winshift;
+	KASSERT(ubc_winshift >= PAGE_SHIFT);
 
 	/*
 	 * init ubc_object.
@@ -304,7 +307,7 @@ ubc_fault(struct uvm_faultinfo *ufi, vad
 	struct uvm_object *uobj;
 	struct ubc_map *umap;
 	vaddr_t va, eva, ubc_offset, slot_offset;
-	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
+	struct vm_page *pgs[howmany(ubc_winsize, MIN_PAGE_SIZE)];
 	int i, error, npages;
 	vm_prot_t prot;
 
@@ -732,7 +735,7 @@ ubc_uiomove(struct uvm_object *uobj, str
 int flags)
 {
 	const bool overwrite = (flags & UBC_FAULTBUSY) != 0;
-	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
+	struct vm_page *pgs[howmany(ubc_winsize, MIN_PAGE_SIZE)];
 	voff_t off;
 	int error, npages;
 
@@ -798,7 +801,7 @@ ubc_uiomove(struct uvm_object *uobj, str
 void
 ubc_zerorange(struct uvm_object *uobj, off_t off, size_t len, int flags)
 {
-	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
+	struct vm_page *pgs[howmany(ubc_winsize, MIN_PAGE_SIZE)];
 	int npages;
 
 #ifdef UBC_USE_PMAP_DIRECT
@@ -975,7 +978,7 @@ ubc_uiomove_direct(struct uvm_object *uo
 	const bool overwrite = (flags & UBC_FAULTBUSY) != 0;
 	voff_t off;
 	int error, npages;
-	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
+	struct vm_page *pgs[howmany(ubc_winsize, MIN_PAGE_SIZE)];
 
 	KASSERT(todo <= uio->uio_resid);
 	KASSERT(((flags & UBC_WRITE) != 0 && uio->uio_rw == UIO_WRITE) ||
@@ -1043,7 +1046,7 @@ static void __noinline
 ubc_zerorange_direct(struct uvm_object *uobj, off_t off, size_t todo, int flags)
 {
 	int error, npages;
-	struct vm_page *pgs[ubc_winsize >> PAGE_SHIFT];
+	struct vm_page *pgs[howmany(ubc_winsize, MIN_PAGE_SIZE)];
 
 	flags |= UBC_WRITE;
 



CVS commit: src/sys/arch/mips/mips

2020-06-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jun 25 11:48:40 UTC 2020

Modified Files:
src/sys/arch/mips/mips: fp.S

Log Message:
Fix a tyop in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mips/mips/fp.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/mips/mips/fp.S
diff -u src/sys/arch/mips/mips/fp.S:1.50 src/sys/arch/mips/mips/fp.S:1.51
--- src/sys/arch/mips/mips/fp.S:1.50	Sat Apr  6 03:06:26 2019
+++ src/sys/arch/mips/mips/fp.S	Thu Jun 25 11:48:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fp.S,v 1.50 2019/04/06 03:06:26 thorpej Exp $	*/
+/*	$NetBSD: fp.S,v 1.51 2020/06/25 11:48:39 simonb Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1848,7 +1848,7 @@ cvt_d_w:
 	move	t3, zero
 	b	result_fs_d
 /*
- * Find out how many leading zero bits are in t2 and put in at.
+ * Find out how many leading zero bits are in t2 and put in v1.
  */
 #if __mips == 32 || __mips == 64
 	clz	v1, t2



CVS commit: src/sys/dev/ofw

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 11:31:45 UTC 2020

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

Log Message:
no need for alloca() in of_compatible(), malloc() is fine


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ofw/ofw_subr.c

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

Modified files:

Index: src/sys/dev/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.36 src/sys/dev/ofw/ofw_subr.c:1.37
--- src/sys/dev/ofw/ofw_subr.c:1.36	Fri Jun 12 14:52:11 2020
+++ src/sys/dev/ofw/ofw_subr.c	Thu Jun 25 11:31:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.36 2020/06/12 14:52:11 thorpej Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.37 2020/06/25 11:31:45 jdolecek Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.36 2020/06/12 14:52:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.37 2020/06/25 11:31:45 jdolecek Exp $");
 
 #include 
 #include 
@@ -100,7 +100,7 @@ int
 of_compatible(int phandle, const char * const *strings)
 {
 
-	int len, olen, allocated, nstr, cstr, rv;
+	int len, olen, nstr, cstr, rv;
 	char *buf;
 	const char *sp, *nsp;
 
@@ -108,13 +108,7 @@ of_compatible(int phandle, const char * 
 	if (len <= 0)
 		return (-1);
 
-	if (len > OFW_MAX_STACK_BUF_SIZE) {
-		buf = malloc(len, M_TEMP, M_WAITOK);
-		allocated = 1;
-	} else {
-		buf = alloca(len);
-		allocated = 0;
-	}
+	buf = malloc(len, M_TEMP, M_WAITOK);
 
 	/* 'compatible' size should not change. */
 	if (OF_getprop(phandle, "compatible", buf, len) != len) {
@@ -150,8 +144,7 @@ of_compatible(int phandle, const char * 
 	rv = -1;
 
 out:
-	if (allocated)
-		free(buf, M_TEMP);
+	free(buf, M_TEMP);
 	return (rv);
 }
 



CVS commit: src/tests/sbin/ifconfig

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 11:26:05 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_repeated_scan.sh

Log Message:
Reference also PR kern/53860.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/sbin/ifconfig/t_repeated_scan.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_repeated_scan.sh
diff -u src/tests/sbin/ifconfig/t_repeated_scan.sh:1.3 src/tests/sbin/ifconfig/t_repeated_scan.sh:1.4
--- src/tests/sbin/ifconfig/t_repeated_scan.sh:1.3	Thu Jun 25 10:34:34 2020
+++ src/tests/sbin/ifconfig/t_repeated_scan.sh	Thu Jun 25 11:26:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_scan.sh,v 1.3 2020/06/25 10:34:34 jruoho Exp $
+# $NetBSD: t_repeated_scan.sh,v 1.4 2020/06/25 11:26:05 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -31,7 +31,7 @@ atf_test_case repeated_scan
 repeated_scan_head() {
 	atf_set "require.user" "root"
 	atf_set "descr" "Test with ifconfig(8) that repeated 802.11 " \
-		"scanning does not cause a panic (PR kern/55389)"
+		"scanning does not panic (PR kern/53860; PR kern/55389)"
 }
 
 repeated_scan_body() {



CVS commit: src/tests

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 11:12:03 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_kevent.c
src/tests/lib/libm: t_hypot.c
src/tests/usr.bin/gdb: t_regress.sh
src/tests/usr.bin/vmstat: t_vmstat.sh
src/tests/usr.bin/xlint/lint1: d_long_double_int.c t_integration.sh

Log Message:
Reference PRs consistently.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libc/sys/t_kevent.c
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libm/t_hypot.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/gdb/t_regress.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/vmstat/t_vmstat.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/d_long_double_int.c
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/t_integration.sh

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

Modified files:

Index: src/tests/lib/libc/sys/t_kevent.c
diff -u src/tests/lib/libc/sys/t_kevent.c:1.7 src/tests/lib/libc/sys/t_kevent.c:1.8
--- src/tests/lib/libc/sys/t_kevent.c:1.7	Thu Feb  5 13:55:37 2015
+++ src/tests/lib/libc/sys/t_kevent.c	Thu Jun 25 11:12:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_kevent.c,v 1.7 2015/02/05 13:55:37 isaki Exp $ */
+/*	$NetBSD: t_kevent.c,v 1.8 2020/06/25 11:12:03 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: t_kevent.c,v 1.7 2015/02/05 13:55:37 isaki Exp $");
+__RCSID("$NetBSD: t_kevent.c,v 1.8 2020/06/25 11:12:03 jruoho Exp $");
 
 #include 
 #include 
@@ -85,7 +85,7 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
 
 	ATF_REQUIRE((kq = kqueue()) != -1);
 
-	// atf_tc_skip("crashes kernel (PR 46463)");
+	// atf_tc_skip("crashes kernel (PR kern/46463)");
 
 	ATF_REQUIRE(socketpair(AF_LOCAL, SOCK_STREAM, 0, s) != -1);
 	msg = malloc(CMSG_SPACE(sizeof(int)));

Index: src/tests/lib/libm/t_hypot.c
diff -u src/tests/lib/libm/t_hypot.c:1.1 src/tests/lib/libm/t_hypot.c:1.2
--- src/tests/lib/libm/t_hypot.c:1.1	Sun Jan 24 20:26:47 2016
+++ src/tests/lib/libm/t_hypot.c	Thu Jun 25 11:12:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_hypot.c,v 1.1 2016/01/24 20:26:47 gson Exp $ */
+/* $NetBSD: t_hypot.c,v 1.2 2020/06/25 11:12:03 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@ ATF_TC_BODY(hypotf_integer, tc)
 ATF_TC(pr50698);
 ATF_TC_HEAD(pr50698, tc)
 {
-	atf_tc_set_md_var(tc, "descr", "Check for the bug of PR 50698");
+	atf_tc_set_md_var(tc, "descr", "Check for the bug of PR lib/50698");
 }
 
 ATF_TC_BODY(pr50698, tc)

Index: src/tests/usr.bin/gdb/t_regress.sh
diff -u src/tests/usr.bin/gdb/t_regress.sh:1.2 src/tests/usr.bin/gdb/t_regress.sh:1.3
--- src/tests/usr.bin/gdb/t_regress.sh:1.2	Fri Jun  7 19:05:15 2019
+++ src/tests/usr.bin/gdb/t_regress.sh	Thu Jun 25 11:12:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_regress.sh,v 1.2 2019/06/07 19:05:15 gson Exp $
+# $NetBSD: t_regress.sh,v 1.3 2020/06/25 11:12:03 jruoho Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,11 +27,10 @@
 
 # Regression tests for some GDB PRs
 
-# PR 47430
-
 atf_test_case threads
 threads_head() {
-	atf_set "descr" "Test that gdb works with threaded programs"
+	atf_set "descr" "Test that gdb works with " \
+		"threaded programs (PR bin/47430)"
 	atf_set "require.progs" "gdb"
 }
 threads_body() {
@@ -50,11 +49,10 @@ EOF
 	atf_check -s exit:1 -o ignore -e ignore grep "Program received signal SIGTRAP" gdb.out
 }
 
-# PR 48250
-
 atf_test_case pie
 pie_head() {
-	atf_set "descr" "Test that gdb works with PIE executables"
+	atf_set "descr" "Test that gdb works with " \
+		"PIE executables (PR bin/48250)"
 	atf_set "require.progs" "cc gdb"
 }
 pie_body() {
@@ -71,11 +69,10 @@ EOF
 	atf_check -s exit:1 -o ignore -e ignore grep "annot access memory" gdb.out
 }
 
-# PR 54154
-
 atf_test_case xml
 xml_head() {
-	atf_set "descr" "Test that gdb was built with XML support"
+	atf_set "descr" "Test that gdb was built " \
+		"with XML support (PR bin/54154)"
 	atf_set "require.progs" "gdb"
 }
 xml_body() {

Index: src/tests/usr.bin/vmstat/t_vmstat.sh
diff -u src/tests/usr.bin/vmstat/t_vmstat.sh:1.1 src/tests/usr.bin/vmstat/t_vmstat.sh:1.2
--- src/tests/usr.bin/vmstat/t_vmstat.sh:1.1	Tue Jan  7 16:47:13 2014
+++ src/tests/usr.bin/vmstat/t_vmstat.sh	Thu Jun 25 11:12:03 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_vmstat.sh,v 1.1 2014/01/07 16:47:13 gson Exp $
+# $NetBSD: t_vmstat.sh,v 1.2 2020/06/25 11:12:03 jruoho Exp $
 #
 # Copyright (c) 2013 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,7 +27,8 @@
 
 atf_test_case default
 default_head() {
-	atf_set "descr" "Test that vmstat(1) returns success when run with no arguments"
+	atf_set "descr" "Test that vmstat(1) returns " \
+		"success when run with no arguments"
 }
 default_body() {
 	atf_check -s exit:0 -o ignore -e empty vmstat
@@ -35,7 +36,8 @@ default_body() {
 
 atf_test_case opt_s
 

CVS commit: src/tests/sbin/ifconfig

2020-06-25 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Jun 25 10:34:34 UTC 2020

Modified Files:
src/tests/sbin/ifconfig: t_repeated_scan.sh

Log Message:
Require root privileges.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/sbin/ifconfig/t_repeated_scan.sh

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

Modified files:

Index: src/tests/sbin/ifconfig/t_repeated_scan.sh
diff -u src/tests/sbin/ifconfig/t_repeated_scan.sh:1.2 src/tests/sbin/ifconfig/t_repeated_scan.sh:1.3
--- src/tests/sbin/ifconfig/t_repeated_scan.sh:1.2	Wed Jun 24 10:07:13 2020
+++ src/tests/sbin/ifconfig/t_repeated_scan.sh	Thu Jun 25 10:34:34 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_repeated_scan.sh,v 1.2 2020/06/24 10:07:13 jruoho Exp $
+# $NetBSD: t_repeated_scan.sh,v 1.3 2020/06/25 10:34:34 jruoho Exp $
 #
 # Copyright (c) 2020 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -29,6 +29,7 @@
 
 atf_test_case repeated_scan
 repeated_scan_head() {
+	atf_set "require.user" "root"
 	atf_set "descr" "Test with ifconfig(8) that repeated 802.11 " \
 		"scanning does not cause a panic (PR kern/55389)"
 }



CVS commit: src/sys/uvm

2020-06-25 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Jun 25 09:58:44 UTC 2020

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

Log Message:
use maximum-size fixed size array instead of variable-length array
in uvm_aio_aiodone() so that the stack usage can be determined and
checked in compile time; this is not called recursively not
particularly deep in call stack, so there is no need to save every
last drop of stack space here


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/uvm/uvm_pager.c

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

Modified files:

Index: src/sys/uvm/uvm_pager.c
diff -u src/sys/uvm/uvm_pager.c:1.125 src/sys/uvm/uvm_pager.c:1.126
--- src/sys/uvm/uvm_pager.c:1.125	Sun Apr 19 21:53:38 2020
+++ src/sys/uvm/uvm_pager.c	Thu Jun 25 09:58:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pager.c,v 1.125 2020/04/19 21:53:38 ad Exp $	*/
+/*	$NetBSD: uvm_pager.c,v 1.126 2020/06/25 09:58:44 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.125 2020/04/19 21:53:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.126 2020/06/25 09:58:44 jdolecek Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -516,17 +516,19 @@ uvm_aio_aiodone_pages(struct vm_page **p
  * uvm_aio_aiodone: do iodone processing for async i/os.
  * this should be called in thread context, not interrupt context.
  */
-
 void
 uvm_aio_aiodone(struct buf *bp)
 {
-	int npages = bp->b_bufsize >> PAGE_SHIFT;
-	struct vm_page *pgs[npages];
+	const int npages = bp->b_bufsize >> PAGE_SHIFT;
+	struct vm_page *pgs[howmany(MAXPHYS, MIN_PAGE_SIZE)];
 	int i, error;
 	bool write;
 	UVMHIST_FUNC("uvm_aio_aiodone"); UVMHIST_CALLED(ubchist);
 	UVMHIST_LOG(ubchist, "bp %#jx", (uintptr_t)bp, 0,0,0);
 
+	KASSERT(bp->b_bufsize <= MAXPHYS);
+	KASSERT(npages <= __arraycount(pgs));
+
 	error = bp->b_error;
 	write = (bp->b_flags & B_READ) == 0;
 



CVS commit: src/external/cddl/dtracetoolkit/dist

2020-06-25 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jun 25 09:48:29 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist: Makefile

Log Message:
space, tab


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/cddl/dtracetoolkit/dist/Makefile

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Makefile
diff -u src/external/cddl/dtracetoolkit/dist/Makefile:1.1 src/external/cddl/dtracetoolkit/dist/Makefile:1.2
--- src/external/cddl/dtracetoolkit/dist/Makefile:1.1	Sun Sep 17 00:00:39 2017
+++ src/external/cddl/dtracetoolkit/dist/Makefile	Thu Jun 25 09:48:29 2020
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.1 2017/09/17 00:00:39 sevan Exp $
+# $NetBSD: Makefile,v 1.2 2020/06/25 09:48:29 sevan Exp $
 
 .include 
 
 .if (${MKDTRACE} != "no")
-FILES= 	dtruss
+FILES=		dtruss
 FILES+= 	execsnoop
 FILES+= 	opensnoop
 FILES+= 	procsystime



CVS commit: src/external/cddl/dtracetoolkit/dist/Man/man1m

2020-06-25 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Jun 25 09:39:19 UTC 2020

Modified Files:
src/external/cddl/dtracetoolkit/dist/Man/man1m: dtruss.1m opensnoop.1m

Log Message:
Fix column layout


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m
cvs rdiff -u -r1.2 -r1.3 \
src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m

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

Modified files:

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.3 src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.4
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m:1.3	Wed Jun 24 18:49:01 2020
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/dtruss.1m	Thu Jun 25 09:39:19 2020
@@ -1,5 +1,5 @@
-.\" $NetBSD: dtruss.1m,v 1.3 2020/06/24 18:49:01 sevan Exp $
-.Dd June 24, 2020
+.\" $NetBSD: dtruss.1m,v 1.4 2020/06/25 09:39:19 sevan Exp $
+.Dd June 25, 2020
 .Dt DTRUSS 1
 .Os
 .Sh NAME
@@ -52,19 +52,13 @@ examine this PID
 .It Fl t Ar syscall
 examine this syscall only
 .El
-.Pp
-Description of fields
-.Bl -column
-.It PID/LWPID
-Process ID / Lightweight Process ID
-.It RELATIVE
-relative timestamps to the start of the thread, us (microseconds)
-.It ELAPSD
-elapsed time for this system call, us
-.It CPU
-on-cpu time for this system call, us
-.It SYSCALL(args)
-system call name, with arguments (some may be evaluated)
+.Bl -column fieldtitle description
+.It Sy Fields Ta Sy Description
+.It PID/LWPID	Process ID / Lightweight Process ID
+.It RELATIVE	relative timestamps to the start of the thread, us (microseconds)
+.It ELAPSD	elapsed time for this system call, us
+.It CPU	on-cpu time for this system call, us
+.It SYSCALL(args)	system call name, with arguments (some may be evaluated)
 .El
 .Sh EXAMPLES
 run and examine the "df -h" command

Index: src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m
diff -u src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.2 src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.3
--- src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m:1.2	Wed Jun 24 18:06:01 2020
+++ src/external/cddl/dtracetoolkit/dist/Man/man1m/opensnoop.1m	Thu Jun 25 09:39:19 2020
@@ -1,5 +1,5 @@
-.\" $NetBSD: opensnoop.1m,v 1.2 2020/06/24 18:06:01 sevan Exp $
-.Dd June 24, 2020
+.\" $NetBSD: opensnoop.1m,v 1.3 2020/06/25 09:39:19 sevan Exp $
+.Dd June 25, 2020
 .Dt OPENSNOOP 1
 .Os
 .Sh NAME
@@ -47,35 +47,22 @@ process name to snoop
 .It Fl p Ar PID
 process ID to snoop
 .El
-.Pp
-Description of fields
-.Bl -column
-.It ZONE
-Zone name
-.It UID
-User ID
-.It PID
-Process ID
-.It PPID
-Parent Process ID
-.It FD
-File Descriptor (-1 is error)
-.It ERR
-errno value (see
+.Bl -column fieldtitle description
+.It Sy Fields Ta Sy Description
+.It ZONE Ta Zone name
+.It UID	Ta User ID
+.It PID Ta Process ID
+.It PPID Ta Parent Process ID
+.It FD Ta File Descriptor (-1 is error)
+.It ERR Ta errno value ( see
 .Pa /usr/include/sys/errno.h
 )
-.It CWD
-current working directory of process
-.It PATH
-pathname for file open
-.It COMM
-command name for the process
-.It ARGS
-argument listing for the process
-.It TIME
-timestamp for the open event, us
-.It STRTIME
-timestamp for the open event, string
+.It CWD Ta current working directory of process
+.It PATH Ta pathname for file open
+.It COMM Ta command name for the process
+.It ARGS Ta argument listing for the process
+.It TIME Ta timestamp for the open event, us
+.It STRTIME Ta timestamp for the open event, string
 .El
 .Sh EXAMPLES
 Default output, print file opens by process as they occur,



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-06-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jun 25 09:39:15 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: vdev_disk.c

Log Message:
Don't assume everything is a wedge and has a parent device. On non-wedges
this crashes.

Instead, just talk to the referenced device and rely on the dk driver
to pass requests correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.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/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.17 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.18
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.17	Sun Jun 21 21:29:11 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Thu Jun 25 09:39:15 2020
@@ -222,19 +222,18 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 
 	pdk = NULL;
 	if (getdiskinfo(vp, ) == 0)
-		pdk = disk_find(dkw.dkw_parent);
+		pdk = disk_find(dkw.dkw_devname);
 
 	/* XXXNETBSD Once tls-maxphys gets merged this block becomes:
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
 		struct buf buf = {
+			.b_dev = vp->v_rdev,
 			.b_bcount = MAXPHYS,
 		};
-		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys) {
-			buf.b_dev = pdk->dk_rawvp->v_rdev;
+		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
 			(*pdk->dk_driver->d_minphys)();
-		}
 		dvd->vd_maxphys = buf.b_bcount;
 	}
 



CVS commit: src/sys/arch/mips/mips

2020-06-25 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jun 25 08:00:49 UTC 2020

Modified Files:
src/sys/arch/mips/mips: trap.c

Log Message:
Fix tyop in an acient comment.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/arch/mips/mips/trap.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/mips/mips/trap.c
diff -u src/sys/arch/mips/mips/trap.c:1.253 src/sys/arch/mips/mips/trap.c:1.254
--- src/sys/arch/mips/mips/trap.c:1.253	Thu Apr  9 06:49:37 2020
+++ src/sys/arch/mips/mips/trap.c	Thu Jun 25 08:00:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.253 2020/04/09 06:49:37 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.254 2020/06/25 08:00:49 simonb Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.253 2020/04/09 06:49:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.254 2020/06/25 08:00:49 simonb Exp $");
 
 #include "opt_cputype.h"	/* which mips CPU levels do we support? */
 #include "opt_ddb.h"
@@ -695,7 +695,7 @@ ast(void)
 }
 
 
-/* XXX need to rewrite acient comment XXX
+/* XXX need to rewrite ancient comment XXX
  * This routine is called by procxmt() to single step one instruction.
  * We do this by storing a break instruction after the current instruction,
  * resuming execution, and then restoring the old instruction.



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

2020-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 25 07:53:02 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: if_sriov.c ixgbe.c ixgbe.h ixgbe_netbsd.c
ixgbe_osdep.h ixv.c

Log Message:
Reduce ixgbe's busy loop using with workqueue and kpause.

- Use workqueue instead of softint to make some functions sleepable.
- Use new workqueue and enqueue it in ixgbe_local_timer() and
  ixgbe_recovery_mode_timer() to make them sleepable.
- Make new ixgbe_delay() and use it. This functions sleeps if the time is
  more than equals 1 tick. If it's not, do delay().


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.232 -r1.233 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/ixgbe/ixgbe_netbsd.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/ixgbe/ixgbe_osdep.h
cvs rdiff -u -r1.150 -r1.151 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.6 src/sys/dev/pci/ixgbe/if_sriov.c:1.7
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.6	Thu Jun 27 05:55:40 2019
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Thu Jun 25 07:53:01 2020
@@ -645,7 +645,6 @@ ixgbe_handle_mbx(void *context, int pend
 
 	hw = >hw;
 
-	IXGBE_CORE_LOCK(adapter);
 	for (i = 0; i < adapter->num_vfs; i++) {
 		vf = >vfs[i];
 
@@ -660,7 +659,6 @@ ixgbe_handle_mbx(void *context, int pend
 ixgbe_process_vf_ack(adapter, vf);
 		}
 	}
-	IXGBE_CORE_UNLOCK(adapter);
 } /* ixgbe_handle_mbx */
 
 int

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.232 src/sys/dev/pci/ixgbe/ixgbe.c:1.233
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.232	Thu Jun 18 09:00:11 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Jun 25 07:53:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.232 2020/06/18 09:00:11 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.233 2020/06/25 07:53:01 msaitoh Exp $ */
 
 /**
 
@@ -179,7 +179,7 @@ static void	ixgbe_media_status(struct if
 static int	ixgbe_media_change(struct ifnet *);
 static int	ixgbe_allocate_pci_resources(struct adapter *,
 		const struct pci_attach_args *);
-static void	ixgbe_free_softint(struct adapter *);
+static void	ixgbe_free_workqueue(struct adapter *);
 static void	ixgbe_get_slot_info(struct adapter *);
 static int	ixgbe_allocate_msix(struct adapter *,
 		const struct pci_attach_args *);
@@ -189,12 +189,14 @@ static int	ixgbe_configure_interrupts(st
 static void	ixgbe_free_pciintr_resources(struct adapter *);
 static void	ixgbe_free_pci_resources(struct adapter *);
 static void	ixgbe_local_timer(void *);
-static void	ixgbe_local_timer1(void *);
+static void	ixgbe_handle_timer(struct work *, void *);
 static void	ixgbe_recovery_mode_timer(void *);
+static void	ixgbe_handle_recovery_mode_timer(struct work *, void *);
 static int	ixgbe_setup_interface(device_t, struct adapter *);
 static void	ixgbe_config_gpie(struct adapter *);
 static void	ixgbe_config_dmac(struct adapter *);
 static void	ixgbe_config_delay_values(struct adapter *);
+static void	ixgbe_schedule_admin_tasklet(struct adapter *);
 static void	ixgbe_config_link(struct adapter *);
 static void	ixgbe_check_wol_support(struct adapter *);
 static int	ixgbe_setup_low_power_mode(struct adapter *);
@@ -262,17 +264,17 @@ static int	ixgbe_legacy_irq(void *);
 
 /* The MSI/MSI-X Interrupt handlers */
 static int	ixgbe_msix_que(void *);
-static int	ixgbe_msix_link(void *);
+static int	ixgbe_msix_admin(void *);
 
-/* Software interrupts for deferred work */
+/* Event handlers running on workqueue */
 static void	ixgbe_handle_que(void *);
 static void	ixgbe_handle_link(void *);
+static void	ixgbe_handle_msf(void *);
 static void	ixgbe_handle_mod(void *);
 static void	ixgbe_handle_phy(void *);
 
-static void	ixgbe_handle_msf(struct work *, void *);
-
-/* Workqueue handler for deferred work */
+/* Deferred workqueue handlers */
+static void	ixgbe_handle_admin(struct work *, void *);
 static void	ixgbe_handle_que_work(struct work *, void *);
 
 static const ixgbe_vendor_info_t *ixgbe_lookup(const struct pci_attach_args *);
@@ -783,6 +785,7 @@ ixgbe_attach(device_t parent, device_t d
 	struct pci_attach_args *pa = aux;
 	bool unsupported_sfp = false;
 	const char *str;
+	char wqname[MAXCOMLEN];
 	char buf[256];
 
 	INIT_DEBUGOUT("ixgbe_attach: begin");
@@ -807,11 +810,20 @@ ixgbe_attach(device_t parent, device_t d
 	aprint_normal(": %s, Version - %s\n",
 	ixgbe_strings[ent->index], ixgbe_driver_version);
 
-	/* Core Lock Init*/
+	/* Core Lock Init */
 	IXGBE_CORE_LOCK_INIT(adapter, device_xname(dev));
 
-	/* Set up the timer callout */
+	/* Set up the timer callout and workqueue */
 	callout_init(>timer, IXGBE_CALLOUT_FLAGS);
+	snprintf(wqname, 

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

2020-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 25 06:45:10 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_82598.c

Log Message:
 Use unsigned to avoid undefined behavior in ixgbe_fc_enable_generic().
Same as ixgbe_common.c rev. 1.24. Found by KUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/ixgbe/ixgbe_82598.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_82598.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.14 src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.15
--- src/sys/dev/pci/ixgbe/ixgbe_82598.c:1.14	Fri Jan  3 12:59:46 2020
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.c	Thu Jun 25 06:45:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_82598.c,v 1.14 2020/01/03 12:59:46 pgoyette Exp $ */
+/* $NetBSD: ixgbe_82598.c,v 1.15 2020/06/25 06:45:10 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -538,7 +538,7 @@ s32 ixgbe_fc_enable_82598(struct ixgbe_h
 	}
 
 	/* Configure pause time (2 TCs per register) */
-	reg = hw->fc.pause_time * 0x00010001;
+	reg = (u32)hw->fc.pause_time * 0x00010001;
 	for (i = 0; i < (IXGBE_DCB_MAX_TRAFFIC_CLASS / 2); i++)
 		IXGBE_WRITE_REG(hw, IXGBE_FCTTV(i), reg);