CVS commit: src/sys/arch/sandpoint/stand/altboot

2019-06-25 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Jun 26 00:54:04 UTC 2019

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
Similar to changes made for x86, allow for the boot-loader to auto-push
a list of modules for file-system support.  This allows, for example,
booting from an ext2fs file-system when the kernel has no built-in ufs
or ext2fs modules.

XXX Untested, as I have no sandpoint hardware.  I'd appreciate it if
XXX someone with hardware can build and test.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/sandpoint/stand/altboot/main.c

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

Modified files:

Index: src/sys/arch/sandpoint/stand/altboot/main.c
diff -u src/sys/arch/sandpoint/stand/altboot/main.c:1.29 src/sys/arch/sandpoint/stand/altboot/main.c:1.30
--- src/sys/arch/sandpoint/stand/altboot/main.c:1.29	Thu Feb  8 09:05:18 2018
+++ src/sys/arch/sandpoint/stand/altboot/main.c	Wed Jun 26 00:54:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.29 2018/02/08 09:05:18 dholland Exp $ */
+/* $NetBSD: main.c,v 1.30 2019/06/26 00:54:04 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -90,6 +90,7 @@ uint32_t kmodloadp;
 int modules_enabled = 0;
 
 void module_add(const char *);
+void module_add_split(const char *);
 void module_load(const char *);
 int module_open(struct boot_module *);
 
@@ -367,7 +368,7 @@ main(int argc, char *argv[], char *boota
 
 		if (modules_enabled) {
 			if (fsmod != NULL)
-module_add(fsmod);
+module_add_split(fsmod);
 			kmodloadp = marks[MARK_END];
 			btinfo_modulelist = NULL;
 			module_load(bname);
@@ -423,6 +424,42 @@ bi_add(void *new, int type, int size)
 	bi_next += size;
 }
 
+/*
+ * Add a /-separated list of module names to the boot list
+ */
+static void
+module_add_split(const char *name)
+{
+	char mod_name[MAXMODNAME];
+	int i;
+	const char *mp = name;
+	char *ep;
+
+	while (*mp) {/* scan list of module names */
+		i = MAXMODNAME;
+		ep = mod_name;
+		while (--i) {			/* scan for end of first name */
+			*ep = *mp;
+			if (*ep == '/')		/* NUL-terminate the name */
+*ep = '\0';
+
+			if (*ep == 0 ) {	/* add non-empty name */
+if (ep != mod_name)
+	module_add(mod_name);
+break;
+			}
+			ep++; mp++;
+		}
+		if (*ep != 0) {
+			printf("module name too long\n");
+			return;
+		}
+		if  (*mp == '/') {		/* skip separator if more */
+			mp++;
+		}
+	}
+}
+
 void
 module_add(const char *name)
 {



CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 00:30:39 UTC 2019

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

Log Message:
whitespace around operators


To generate a diff of this commit:
cvs rdiff -u -r1.472 -r1.473 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.472 src/sys/kern/kern_exec.c:1.473
--- src/sys/kern/kern_exec.c:1.472	Tue Jun 25 17:32:58 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 25 20:30:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.472 2019/06/25 21:32:58 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.473 2019/06/26 00:30:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.472 2019/06/25 21:32:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.473 2019/06/26 00:30:39 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -661,7 +661,7 @@ exec_makepathbuf(struct lwp *l, const ch
 	tlen = path + MAXPATHLEN - bp;
 
 	memmove(path, bp, tlen);
-	path[tlen-1] = '\0';
+	path[tlen - 1] = '\0';
 	if (offs)
 		*offs = tlen - len;
 out:



CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 00:30:39 UTC 2019

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

Log Message:
whitespace around operators


To generate a diff of this commit:
cvs rdiff -u -r1.472 -r1.473 src/sys/kern/kern_exec.c

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



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

2019-06-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 25 22:23:39 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Honour _CRS mem ranges and translation offsets instead of assuming 1:1
mappings. Tested on Overdrive 1000.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/acpi/acpipchb.c

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

Modified files:

Index: src/sys/arch/arm/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.8 src/sys/arch/arm/acpi/acpipchb.c:1.9
--- src/sys/arch/arm/acpi/acpipchb.c:1.8	Wed Jun 19 13:39:18 2019
+++ src/sys/arch/arm/acpi/acpipchb.c	Tue Jun 25 22:23:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.8 2019/06/19 13:39:18 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.9 2019/06/25 22:23:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.8 2019/06/19 13:39:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.9 2019/06/25 22:23:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,12 +59,19 @@ __KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v
 
 #define	PCIHOST_CACHELINE_SIZE		arm_dcache_align
 
-struct acpipchb_bus_space {
-	struct bus_space	bs;
+#define	ACPIPCHB_MAX_RANGES	64	/* XXX arbitrary limit */
 
+struct acpipchb_bus_range {
 	bus_addr_t		min;
 	bus_addr_t		max;
 	bus_addr_t		offset;
+};
+
+struct acpipchb_bus_space {
+	struct bus_space	bs;
+
+	struct acpipchb_bus_range range[ACPIPCHB_MAX_RANGES];
+	int			nrange;
 
 	int			(*map)(void *, bus_addr_t, bus_size_t,
    int, bus_space_handle_t *);
@@ -73,19 +80,22 @@ struct acpipchb_bus_space {
 struct acpipchb_softc {
 	device_t		sc_dev;
 
+	bus_space_tag_t		sc_memt;
+
 	struct arm32_bus_dma_tag sc_dmat;
 	struct acpi_pci_context sc_ap;
 
 	ACPI_HANDLE		sc_handle;
 	ACPI_INTEGER		sc_bus;
 
+	struct acpipchb_bus_space sc_pcimem_bst;
 	struct acpipchb_bus_space sc_pciio_bst;
 };
 
 static int	acpipchb_match(device_t, cfdata_t, void *);
 static void	acpipchb_attach(device_t, device_t, void *);
 
-static void	acpipchb_setup_pciio(struct acpipchb_softc *, struct pcibus_attach_args *);
+static void	acpipchb_setup_ranges(struct acpipchb_softc *, struct pcibus_attach_args *);
 
 CFATTACH_DECL_NEW(acpipchb, sizeof(struct acpipchb_softc),
 	acpipchb_match, acpipchb_attach, NULL, NULL);
@@ -115,6 +125,7 @@ acpipchb_attach(device_t parent, device_
 	ACPI_INTEGER cca, seg;
 
 	sc->sc_dev = self;
+	sc->sc_memt = aa->aa_memt;
 	sc->sc_handle = aa->aa_node->ad_handle;
 
 	if (ACPI_FAILURE(acpi_eval_integer(sc->sc_handle, "_BBN", >sc_bus)))
@@ -143,9 +154,9 @@ acpipchb_attach(device_t parent, device_
 	}
 
 	memset(, 0, sizeof(pba));
-	pba.pba_flags = aa->aa_pciflags;
+	pba.pba_flags = aa->aa_pciflags & ~(PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY);
+	pba.pba_memt = 0;
 	pba.pba_iot = 0;
-	pba.pba_memt = aa->aa_memt;
 	pba.pba_dmat = >sc_dmat;
 #ifdef _PCI_HAVE_DMA64
 	pba.pba_dmat64 = >sc_dmat;
@@ -153,12 +164,12 @@ acpipchb_attach(device_t parent, device_
 	pba.pba_pc = >sc_ap.ap_pc;
 	pba.pba_bus = sc->sc_bus;
 
-	acpipchb_setup_pciio(sc, );
+	acpipchb_setup_ranges(sc, );
 
 	config_found_ia(self, "pcibus", , pcibusprint);
 }
 
-struct acpipchb_setup_pciio_args {
+struct acpipchb_setup_ranges_args {
 	struct acpipchb_softc *sc;
 	struct pcibus_attach_args *pba;
 };
@@ -168,61 +179,97 @@ acpipchb_bus_space_map(void *t, bus_addr
 bus_space_handle_t *bshp)
 {
 	struct acpipchb_bus_space * const abs = t;
+	int i;
 
-	if (bpa < abs->min || bpa + size >= abs->max)
+	if (size == 0)
 		return ERANGE;
 
-	return abs->map(t, bpa + abs->offset, size, flag, bshp);
+	for (i = 0; i < abs->nrange; i++) {
+		struct acpipchb_bus_range * const range = >range[i];
+		if (bpa >= range->min && bpa + size - 1 <= range->max) 
+			return abs->map(t, bpa + range->offset, size, flag, bshp);
+	}
+
+	return ERANGE;
 }
 
 static ACPI_STATUS
-acpipchb_setup_pciio_cb(ACPI_RESOURCE *res, void *ctx)
+acpipchb_setup_ranges_cb(ACPI_RESOURCE *res, void *ctx)
 {
-	struct acpipchb_setup_pciio_args * const args = ctx;
+	struct acpipchb_setup_ranges_args * const args = ctx;
 	struct acpipchb_softc * const sc = args->sc;
-	struct acpipchb_bus_space * const abs = >sc_pciio_bst;
 	struct pcibus_attach_args *pba = args->pba;
+	struct acpipchb_bus_space *abs;
+	struct acpipchb_bus_range *range;
+	const char *range_type;
+	u_int pci_flags;
 
 	if (res->Type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
 	res->Type != ACPI_RESOURCE_TYPE_ADDRESS64)
 		return AE_OK;
 
-	if (res->Data.Address.ResourceType != ACPI_IO_RANGE)
+	switch (res->Data.Address.ResourceType) {
+	case ACPI_IO_RANGE:
+		abs = >sc_pciio_bst;
+		range_type = "I/O";
+		pci_flags = PCI_FLAGS_IO_OKAY;
+		break;
+	case ACPI_MEMORY_RANGE:
+		abs = >sc_pcimem_bst;
+		range_type = "MEM";
+		pci_flags = PCI_FLAGS_MEM_OKAY;
+		break;
+	default:
 		return AE_OK;
+	}
 
-	

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

2019-06-25 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jun 25 22:23:39 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Honour _CRS mem ranges and translation offsets instead of assuming 1:1
mappings. Tested on Overdrive 1000.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/acpi/acpipchb.c

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



CVS commit: src/tests/lib/libcurses

2019-06-25 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Tue Jun 25 22:19:29 UTC 2019

Modified Files:
src/tests/lib/libcurses: t_curses.sh
src/tests/lib/libcurses/tests: mvscanw

Log Message:
Fixed mvscanw test but leave disabled for the moment, the return for
mvscanw is incorrect in libcurses, we need a major lib version bump
to correct it.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/t_curses.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/mvscanw

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



CVS commit: src/tests/lib/libcurses

2019-06-25 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Tue Jun 25 22:19:29 UTC 2019

Modified Files:
src/tests/lib/libcurses: t_curses.sh
src/tests/lib/libcurses/tests: mvscanw

Log Message:
Fixed mvscanw test but leave disabled for the moment, the return for
mvscanw is incorrect in libcurses, we need a major lib version bump
to correct it.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/lib/libcurses/t_curses.sh
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/mvscanw

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/libcurses/t_curses.sh
diff -u src/tests/lib/libcurses/t_curses.sh:1.13 src/tests/lib/libcurses/t_curses.sh:1.14
--- src/tests/lib/libcurses/t_curses.sh:1.13	Tue Jun 11 10:23:36 2019
+++ src/tests/lib/libcurses/t_curses.sh	Tue Jun 25 22:19:29 2019
@@ -802,7 +802,7 @@ atf_init_test_cases()
 	atf_add_test_case mvhline
 	atf_add_test_case mvinchnstr
 	atf_add_test_case mvprintw
-#	atf_add_test_case mvscanw # not working
+#	atf_add_test_case mvscanw # disable for now - return is wrong
 	atf_add_test_case mvvline
 #	atf_add_test_case pad # not working
 	atf_add_test_case nocbreak

Index: src/tests/lib/libcurses/tests/mvscanw
diff -u src/tests/lib/libcurses/tests/mvscanw:1.1 src/tests/lib/libcurses/tests/mvscanw:1.2
--- src/tests/lib/libcurses/tests/mvscanw:1.1	Sun May 26 09:54:33 2019
+++ src/tests/lib/libcurses/tests/mvscanw	Tue Jun 25 22:19:29 2019
@@ -1,4 +1,11 @@
 include start
 input "testing 1 2 3\n"
 call2 OK "testing" mvscanw 3 5 "%s"
-compare /dev/null
+input "testing 1 2 3\n"
+call2 OK "test" mvscanw 3 5 "%4s"
+# 50 will translate into number 2 in ascii
+input "50 12\n"
+call2 OK "2" mvscanw 3 5 "%d"
+input "aa bb 50 12\n"
+# expect ERR becauss input has alpha and scanw wants integer
+call2 ERR "2" mvscanw 3 5 "%d"



CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 25 21:32:58 UTC 2019

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

Log Message:
Fail if getcwd fails. Pointed out by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.471 -r1.472 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.471 src/sys/kern/kern_exec.c:1.472
--- src/sys/kern/kern_exec.c:1.471	Tue Jun 25 15:47:35 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 25 17:32:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.471 2019/06/25 19:47:35 wiz Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.472 2019/06/25 21:32:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.471 2019/06/25 19:47:35 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.472 2019/06/25 21:32:58 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -630,9 +630,8 @@ exec_makepathbuf(struct lwp *l, const ch
 		error = copyinstr(upath, path, MAXPATHLEN, );
 	}
 	if (error) {
-		PNBUF_PUT(path);
 		DPRINTF(("%s: copyin path @%p %d\n", __func__, upath, error));
-		return error;
+		goto err;
 	}
 
 	if (path[0] == '/') {
@@ -657,7 +656,7 @@ exec_makepathbuf(struct lwp *l, const ch
 	if (error) {
 		DPRINTF(("%s: getcwd_common path %s %d\n", __func__, path,
 		error));
-		goto out;
+		goto err;
 	}
 	tlen = path + MAXPATHLEN - bp;
 
@@ -668,6 +667,9 @@ exec_makepathbuf(struct lwp *l, const ch
 out:
 	*pbp = pathbuf_assimilate(path);
 	return 0;
+err:
+	PNBUF_PUT(path);
+	return error;
 }
 
 vaddr_t



CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 25 21:32:58 UTC 2019

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

Log Message:
Fail if getcwd fails. Pointed out by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.471 -r1.472 src/sys/kern/kern_exec.c

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



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

2019-06-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 25 21:26:04 UTC 2019

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

Log Message:
s/cpulwp/curlwp/


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mips/mips/mipsX_subr.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/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.104 src/sys/arch/mips/mips/mipsX_subr.S:1.105
--- src/sys/arch/mips/mips/mipsX_subr.S:1.104	Sun Aug 20 09:47:13 2017
+++ src/sys/arch/mips/mips/mipsX_subr.S	Tue Jun 25 21:26:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.104 2017/08/20 09:47:13 maya Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.105 2019/06/25 21:26:04 skrll Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -1659,7 +1659,7 @@ NESTED_NOPROFILE(MIPSX(systemcall), CALL
 	 * Save all the registers but kernel temporaries onto the stack.
 	 */
 	KERN_ENTRY_ERRATA
-	/* k1 already contains cpulwp */
+	/* k1 already contains curlwp */
 	PTR_L	k0, L_PCB(k1)			# XXXuvm_lwp_getuarea
 	PTR_ADDU k0, USPACE - TF_SIZ - CALLFRAME_SIZ
 	#REG_S	AT, CALLFRAME_SIZ+TF_REG_AST(k0)



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

2019-06-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jun 25 21:26:04 UTC 2019

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

Log Message:
s/cpulwp/curlwp/


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/mips/mips/mipsX_subr.S

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



CVS commit: src/usr.bin/msgc

2019-06-25 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jun 25 21:09:33 UTC 2019

Modified Files:
src/usr.bin/msgc: msg_sys.def

Log Message:
Do the fmtcheck for both message lookups to satisfy format string
literal checks.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/msgc/msg_sys.def

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



Re: CVS commit: src/sbin/gpt

2019-06-25 Thread Christos Zoulas
In article <201906250354.x5p3suvz009...@server.cornerstoneservice.ca>,
John Nemeth   wrote:
>On Jun 25,  3:42am, "John Nemeth" wrote:
>} 
>} Module Name: src
>} Committed By:jnemeth
>} Date:Tue Jun 25 03:42:46 UTC 2019
>} 
>} Modified Files:
>}  src/sbin/gpt: gpt.h
>} 
>} Log Message:
>} gpt.c
>
> ARGH!  Message should have read:
>
>Add gpt_change_hdr() similar to gpt_change_ent() for changing
>arbitrary header fields.
>
>Updated in repository.

If you did, then the git sync is broken :-( I guess it is time to turn
off "cvs admin -m"...

christos



CVS commit: src/sys/kern

2019-06-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jun 25 19:47:35 UTC 2019

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

Log Message:
Fix word (direct -> directory) in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.470 -r1.471 src/sys/kern/kern_exec.c

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



CVS commit: src/sys/kern

2019-06-25 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jun 25 19:47:35 UTC 2019

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

Log Message:
Fix word (direct -> directory) in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.470 -r1.471 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.470 src/sys/kern/kern_exec.c:1.471
--- src/sys/kern/kern_exec.c:1.470	Tue Jun 25 18:06:29 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 25 19:47:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.470 2019/06/25 18:06:29 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.471 2019/06/25 19:47:35 wiz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.470 2019/06/25 18:06:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.471 2019/06/25 19:47:35 wiz Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -611,7 +611,7 @@ exec_autoload(void)
 /*
  * Copy the user or kernel supplied upath to the allocated pathbuffer pbp
  * making it absolute in the process, by prepending the current working
- * direct if it is not. If offs is supplied it will contain the offset
+ * directory if it is not. If offs is supplied it will contain the offset
  * where the original supplied copy of upath starts.
  */
 int



Re: CVS commit: src/sys/kern

2019-06-25 Thread Maxime Villard

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

Module Name:src
Committed By:   christos
Date:   Tue Jun 25 18:06:29 UTC 2019

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

Log Message:
add a comment explaining what this does.


To generate a diff of this commit:
cvs rdiff -u -r1.469 -r1.470 src/sys/kern/kern_exec.c

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


While you're at it, it would be nice to also explain whether the fact that
we don't actually return an error in the two last error conditions is
intentional or not. Because, it does look a lot like in these cases it is
returning garbage.


CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 25 18:06:29 UTC 2019

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

Log Message:
add a comment explaining what this does.


To generate a diff of this commit:
cvs rdiff -u -r1.469 -r1.470 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.469 src/sys/kern/kern_exec.c:1.470
--- src/sys/kern/kern_exec.c:1.469	Tue Jun 25 12:58:02 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 25 14:06:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.470 2019/06/25 18:06:29 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.470 2019/06/25 18:06:29 christos Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -608,6 +608,12 @@ exec_autoload(void)
 #endif
 }
 
+/*
+ * Copy the user or kernel supplied upath to the allocated pathbuffer pbp
+ * making it absolute in the process, by prepending the current working
+ * direct if it is not. If offs is supplied it will contain the offset
+ * where the original supplied copy of upath starts.
+ */
 int
 exec_makepathbuf(struct lwp *l, const char *upath, enum uio_seg seg,
 struct pathbuf **pbp, size_t *offs)



CVS commit: src/sys/kern

2019-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jun 25 18:06:29 UTC 2019

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

Log Message:
add a comment explaining what this does.


To generate a diff of this commit:
cvs rdiff -u -r1.469 -r1.470 src/sys/kern/kern_exec.c

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



CVS commit: src/sys/kern

2019-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 25 16:58:02 UTC 2019

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

Log Message:
Fix buffer overflow. It seems that some people need to go back to the
basics of C programming.

Reported-by: syzbot+8665827f389a9fac5...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.468 src/sys/kern/kern_exec.c:1.469
--- src/sys/kern/kern_exec.c:1.468	Tue Jun 18 23:53:55 2019
+++ src/sys/kern/kern_exec.c	Tue Jun 25 16:58:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -656,7 +656,7 @@ exec_makepathbuf(struct lwp *l, const ch
 	tlen = path + MAXPATHLEN - bp;
 
 	memmove(path, bp, tlen);
-	path[tlen] = '\0';
+	path[tlen-1] = '\0';
 	if (offs)
 		*offs = tlen - len;
 out:



CVS commit: src/sys/kern

2019-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Jun 25 16:58:02 UTC 2019

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

Log Message:
Fix buffer overflow. It seems that some people need to go back to the
basics of C programming.

Reported-by: syzbot+8665827f389a9fac5...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.468 -r1.469 src/sys/kern/kern_exec.c

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



CVS commit: src/sys

2019-06-25 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Jun 25 15:33:56 UTC 2019

Modified Files:
src/sys/kern: compat_stub.c
src/sys/netinet: sctp_asconf.c sctp_asconf.h sctp_usrreq.c
src/sys/netinet6: sctp6_usrreq.c
Added Files:
src/sys/netinet: sctp_route.h

Log Message:
Split out the prototypes for add/delete address into a separate header file.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/compat_stub.c
cvs rdiff -u -r1.11 -r1.12 src/sys/netinet/sctp_asconf.c
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/sctp_asconf.h
cvs rdiff -u -r0 -r1.1 src/sys/netinet/sctp_route.h
cvs rdiff -u -r1.18 -r1.19 src/sys/netinet/sctp_usrreq.c
cvs rdiff -u -r1.19 -r1.20 src/sys/netinet6/sctp6_usrreq.c

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



CVS commit: src/usr.bin/netstat

2019-06-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jun 25 14:52:56 UTC 2019

Modified Files:
src/usr.bin/netstat: mbuf.c

Log Message:
Limit maximum owner name to appease gcc


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/netstat/mbuf.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/netstat/mbuf.c
diff -u src/usr.bin/netstat/mbuf.c:1.33 src/usr.bin/netstat/mbuf.c:1.34
--- src/usr.bin/netstat/mbuf.c:1.33	Tue Jul 28 19:46:42 2015
+++ src/usr.bin/netstat/mbuf.c	Tue Jun 25 14:52:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.c,v 1.33 2015/07/28 19:46:42 christos Exp $	*/
+/*	$NetBSD: mbuf.c,v 1.34 2019/06/25 14:52:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "from: @(#)mbuf.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mbuf.c,v 1.33 2015/07/28 19:46:42 christos Exp $");
+__RCSID("$NetBSD: mbuf.c,v 1.34 2019/06/25 14:52:55 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -239,7 +239,7 @@ dump_drain:
 		mo->mo_counter[MOWNER_COUNTER_CLUSTER_CLAIMS] ==
 		mo->mo_counter[MOWNER_COUNTER_CLUSTER_RELEASES])
 			continue;
-		snprintf(buf, sizeof(buf), "%16s %-13s",
+		snprintf(buf, sizeof(buf), "%16.16s %-13s",
 		mo->mo_name, mo->mo_descr);
 		if ((lines % 24) == 0 || lines > 24) {
 			printf("%30s %-8s %10s %10s %10s\n",



CVS commit: src/usr.bin/netstat

2019-06-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jun 25 14:52:56 UTC 2019

Modified Files:
src/usr.bin/netstat: mbuf.c

Log Message:
Limit maximum owner name to appease gcc


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/netstat/mbuf.c

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



CVS commit: src/sys/dev/audio

2019-06-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 25 13:07:48 UTC 2019

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
Put the lowered mixing volume back when all playback tracks are closed.
TODO: about long life descriptor.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/audio/audiodef.h

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.19 src/sys/dev/audio/audio.c:1.20
--- src/sys/dev/audio/audio.c:1.19	Sun Jun 23 01:46:56 2019
+++ src/sys/dev/audio/audio.c	Tue Jun 25 13:07:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.19 2019/06/23 01:46:56 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.20 2019/06/25 13:07:48 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.19 2019/06/23 01:46:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.20 2019/06/25 13:07:48 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -587,7 +587,6 @@ static int audio_hw_validate_format(stru
 static int audio_mixers_set_format(struct audio_softc *,
 	const struct audio_info *);
 static void audio_mixers_get_format(struct audio_softc *, struct audio_info *);
-static int audio_sysctl_volume(SYSCTLFN_PROTO);
 static int audio_sysctl_blk_ms(SYSCTLFN_PROTO);
 static int audio_sysctl_multiuser(SYSCTLFN_PROTO);
 #if defined(AUDIO_DEBUG)
@@ -1013,13 +1012,6 @@ audioattach(device_t parent, device_t se
 	if (node != NULL) {
 		sysctl_createv(>sc_log, 0, NULL, NULL,
 		CTLFLAG_READWRITE,
-		CTLTYPE_INT, "volume",
-		SYSCTL_DESCR("software volume test"),
-		audio_sysctl_volume, 0, (void *)sc, 0,
-		CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
-
-		sysctl_createv(>sc_log, 0, NULL, NULL,
-		CTLFLAG_READWRITE,
 		CTLTYPE_INT, "blk_ms",
 		SYSCTL_DESCR("blocksize in msec"),
 		audio_sysctl_blk_ms, 0, (void *)sc, 0,
@@ -2159,6 +2151,13 @@ audio_close(struct audio_softc *sc, audi
 
 		KASSERT(sc->sc_popens > 0);
 		sc->sc_popens--;
+
+		/* Restore mixing volume if all tracks are gone. */
+		if (sc->sc_popens == 0) {
+			mutex_enter(sc->sc_intr_lock);
+			sc->sc_pmixer->volume = 256;
+			mutex_exit(sc->sc_intr_lock);
+		}
 	}
 	if (file->rtrack) {
 		/* Call hw halt_input if this is the last recording track. */
@@ -5016,8 +5015,8 @@ audio_pmixer_process(struct audio_softc 
 if (mixer->volume > 128) {
 	mixer->volume =
 	(mixer->volume * 95) / 100;
-	device_printf(sc->sc_dev,
-	"auto volume adjust: volume %d\n",
+	TRACE(2,
+	"auto volume adjust: volume %d",
 	mixer->volume);
 }
 			}
@@ -7266,38 +7265,6 @@ audio_indexof_format(const struct audio_
 }
 
 /*
- * Get or set software master volume: 0..256
- * XXX It's for debug.
- */
-static int
-audio_sysctl_volume(SYSCTLFN_ARGS)
-{
-	struct sysctlnode node;
-	struct audio_softc *sc;
-	int t, error;
-
-	node = *rnode;
-	sc = node.sysctl_data;
-
-	if (sc->sc_pmixer)
-		t = sc->sc_pmixer->volume;
-	else
-		t = -1;
-	node.sysctl_data = 
-	error = sysctl_lookup(SYSCTLFN_CALL());
-	if (error || newp == NULL)
-		return error;
-
-	if (sc->sc_pmixer == NULL)
-		return EINVAL;
-	if (t < 0)
-		return EINVAL;
-
-	sc->sc_pmixer->volume = t;
-	return 0;
-}
-
-/*
  * Get or set hardware blocksize in msec.
  * XXX It's for debug.
  */

Index: src/sys/dev/audio/audiodef.h
diff -u src/sys/dev/audio/audiodef.h:1.4 src/sys/dev/audio/audiodef.h:1.5
--- src/sys/dev/audio/audiodef.h:1.4	Mon Jun 10 13:49:39 2019
+++ src/sys/dev/audio/audiodef.h	Tue Jun 25 13:07:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiodef.h,v 1.4 2019/06/10 13:49:39 isaki Exp $	*/
+/*	$NetBSD: audiodef.h,v 1.5 2019/06/25 13:07:48 isaki Exp $	*/
 
 /*
  * Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -187,7 +187,11 @@ struct audio_trackmixer {
 
 	int		frames_per_block; /* number of frames in a block */
 
-	u_int		volume;		/* software master volume (0..256) */
+	/*
+	 * software master volume (0..256)
+	 * Must be protected by sc_intr_lock.
+	 */
+	u_int		volume;
 
 	audio_format2_t	mixfmt;
 	void		*mixsample;	/* mixing buf in double-sized int */



CVS commit: src/sys/dev/audio

2019-06-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 25 13:07:48 UTC 2019

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
Put the lowered mixing volume back when all playback tracks are closed.
TODO: about long life descriptor.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/audio/audiodef.h

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



CVS commit: src/sys/net

2019-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 25 12:30:50 UTC 2019

Modified Files:
src/sys/net: if_gif.c if_ipsec.c if_l2tp.c if_ppp.c if_vlan.c

Log Message:
 Simplify "LIST_HEAD();" to make the code more understandable.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/net/if_gif.c
cvs rdiff -u -r1.21 -r1.22 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.164 -r1.165 src/sys/net/if_ppp.c
cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.147 src/sys/net/if_gif.c:1.148
--- src/sys/net/if_gif.c:1.147	Tue Jun 18 07:50:43 2019
+++ src/sys/net/if_gif.c	Tue Jun 25 12:30:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.147 2019/06/18 07:50:43 msaitoh Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.148 2019/06/25 12:30:50 msaitoh Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.147 2019/06/18 07:50:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.148 2019/06/25 12:30:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -97,9 +97,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1
 /*
  * gif global variable definitions
  */
-LIST_HEAD(gif_sclist, gif_softc);
 static struct {
-	struct gif_sclist list;
+	LIST_HEAD(gif_sclist, gif_softc) list;
 	kmutex_t lock;
 } gif_softcs __cacheline_aligned;
 

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.21 src/sys/net/if_ipsec.c:1.22
--- src/sys/net/if_ipsec.c:1.21	Thu Mar 14 03:52:40 2019
+++ src/sys/net/if_ipsec.c	Tue Jun 25 12:30:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.22 2019/06/25 12:30:50 msaitoh Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.22 2019/06/25 12:30:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -139,9 +139,8 @@ static int if_ipsec_set_addr_port(struct
  */
 
 /* This list is used in ioctl context only. */
-LIST_HEAD(ipsec_sclist, ipsec_softc);
 static struct {
-	struct ipsec_sclist list;
+	LIST_HEAD(ipsec_sclist, ipsec_softc) list;
 	kmutex_t lock;
 } ipsec_softcs __cacheline_aligned;
 

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.34 src/sys/net/if_l2tp.c:1.35
--- src/sys/net/if_l2tp.c:1.34	Fri Apr 26 11:51:56 2019
+++ src/sys/net/if_l2tp.c	Tue Jun 25 12:30:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.34 2019/04/26 11:51:56 pgoyette Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.35 2019/06/25 12:30:50 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.34 2019/04/26 11:51:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.35 2019/06/25 12:30:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -95,9 +95,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 
 /*
  * l2tp global variable definitions
  */
-LIST_HEAD(l2tp_sclist, l2tp_softc);
 static struct {
-	struct l2tp_sclist list;
+	LIST_HEAD(l2tp_sclist, l2tp_softc) list;
 	kmutex_t lock;
 } l2tp_softcs __cacheline_aligned;
 

Index: src/sys/net/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.164 src/sys/net/if_ppp.c:1.165
--- src/sys/net/if_ppp.c:1.164	Fri Jan 25 08:51:29 2019
+++ src/sys/net/if_ppp.c	Tue Jun 25 12:30:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.164 2019/01/25 08:51:29 knakahara Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.164 2019/01/25 08:51:29 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -206,9 +206,8 @@ static int ppp_clone_destroy(struct ifne
 
 static struct ppp_softc *ppp_create(const char *, int);
 
-LIST_HEAD(ppp_sclist, ppp_softc);
 static struct {
-	struct ppp_sclist list;
+	LIST_HEAD(ppp_sclist, ppp_softc) list;
 	kmutex_t lock;
 } ppp_softcs __cacheline_aligned;
 

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.137 src/sys/net/if_vlan.c:1.138
--- src/sys/net/if_vlan.c:1.137	Tue Jun 18 08:36:52 2019
+++ src/sys/net/if_vlan.c	Tue Jun 25 12:30:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.137 2019/06/18 08:36:52 msaitoh Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.138 2019/06/25 12:30:50 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.137 

CVS commit: src/sys/net

2019-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun 25 12:30:50 UTC 2019

Modified Files:
src/sys/net: if_gif.c if_ipsec.c if_l2tp.c if_ppp.c if_vlan.c

Log Message:
 Simplify "LIST_HEAD();" to make the code more understandable.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/net/if_gif.c
cvs rdiff -u -r1.21 -r1.22 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.34 -r1.35 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.164 -r1.165 src/sys/net/if_ppp.c
cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_vlan.c

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



CVS commit: src/external/bsd/llvm/librt

2019-06-25 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Jun 25 10:30:29 UTC 2019

Modified Files:
src/external/bsd/llvm/librt: Makefile

Log Message:
move a .WAIT such that it helps all the target code below,
not just radeon.  should fix build issues reported:

AArch64BaseInfo.h:297:12: fatal error:
AArch64GenSystemOperands.inc: No such file or directory


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/llvm/librt/Makefile

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



Re: CVS commit: src/sys/dev/usb

2019-06-25 Thread Ryota Ozaki
On Tue, Jun 25, 2019 at 4:03 PM Nick Hudson  wrote:
>
> On 24/06/2019 10:40, Ryota Ozaki wrote:
> > On Mon, Jun 24, 2019 at 6:27 PM matthew green  wrote:
> >>
> >>> Only KERNEL_LOCK (and some splsoftnet) is required for the network stack
> >>> now.  Remaining splnets are for network drivers.  (softnet_lock is also 
> >>> required
> >>> in some cases but it's another story...)
> >>
> >> great!  i studied the code and i couldn't find any issues
> >> in any of the relevant paths, so i'm glad to hear it's
> >> supposed to be like this.
> >>
> >> for one particular case (ether_ioctl) how is this diff:
> >>
> >> - * Common ioctls for Ethernet interfaces.  Note, we must be
> >> - * called at splnet().
> >> + * Common ioctls for Ethernet interfaces.
> >> + *
> >> + * Non IFEF_MPSAFE drivers must call this function at at least called
> >> + * at splsoftnet().
> >>
> >> or should they also be with kernel lock?
> >
> > Yes.
> >
> > Also I think splnet is still needed for ether_ioctl for sure because
> > it has to care not only the network stack but also network drivers.
>
> If a driver is made MP safe and regardless of if it is marked
> IFEF_MPSAFE then I think the splnet part can be dropped.  That is,
> struct ifnet is either KERNEL_LOCK / IFNET_LOCK AND driver mutex
> protected.  The driver mutexes provide appropriate mutex exclusion
> between threads and interrupts.
>
> Would you agree?

Oh, agree.  I assumed non MP-safe drivers, not non IFEF_MPSAFE drivers.

  ozaki-r


CVS commit: src/usr.sbin/sysinst

2019-06-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jun 25 07:14:45 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c

Log Message:
Assert that the label data is valid before invoking disklabel(8)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/disklabel.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.sbin/sysinst/disklabel.c
diff -u src/usr.sbin/sysinst/disklabel.c:1.4 src/usr.sbin/sysinst/disklabel.c:1.5
--- src/usr.sbin/sysinst/disklabel.c:1.4	Thu Jun 20 18:32:32 2019
+++ src/usr.sbin/sysinst/disklabel.c	Tue Jun 25 07:14:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.4 2019/06/20 18:32:32 martin Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.5 2019/06/25 07:14:45 martin Exp $	*/
 
 /*
  * Copyright 2018 The NetBSD Foundation, Inc.
@@ -272,6 +272,8 @@ disklabel_write_to_disk(struct disk_part
 	char *d;
 	size_t n;
 
+	assert(parts->l.d_secsize != 0);
+
 	sprintf(fname, "/tmp/disklabel.%u", getpid());
 	f = fopen(fname, "w");
 	if (f == NULL)



CVS commit: src/usr.sbin/sysinst

2019-06-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jun 25 07:14:45 UTC 2019

Modified Files:
src/usr.sbin/sysinst: disklabel.c

Log Message:
Assert that the label data is valid before invoking disklabel(8)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/disklabel.c

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



Re: CVS commit: src/sys/dev/usb

2019-06-25 Thread Nick Hudson

On 24/06/2019 10:40, Ryota Ozaki wrote:

On Mon, Jun 24, 2019 at 6:27 PM matthew green  wrote:



Only KERNEL_LOCK (and some splsoftnet) is required for the network stack
now.  Remaining splnets are for network drivers.  (softnet_lock is also required
in some cases but it's another story...)


great!  i studied the code and i couldn't find any issues
in any of the relevant paths, so i'm glad to hear it's
supposed to be like this.

for one particular case (ether_ioctl) how is this diff:

- * Common ioctls for Ethernet interfaces.  Note, we must be
- * called at splnet().
+ * Common ioctls for Ethernet interfaces.
+ *
+ * Non IFEF_MPSAFE drivers must call this function at at least called
+ * at splsoftnet().

or should they also be with kernel lock?


Yes.

Also I think splnet is still needed for ether_ioctl for sure because
it has to care not only the network stack but also network drivers.


If a driver is made MP safe and regardless of if it is marked
IFEF_MPSAFE then I think the splnet part can be dropped.  That is,
struct ifnet is either KERNEL_LOCK / IFNET_LOCK AND driver mutex
protected.  The driver mutexes provide appropriate mutex exclusion
between threads and interrupts.

Would you agree?

Thanks,
Nick