CVS commit: src/tests/net/if_vlan

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 16 06:31:00 UTC 2017

Modified Files:
src/tests/net/if_vlan: t_vlan.sh

Log Message:
 Add test case of vlan(4)'s re-configure without destroy
(see also if_vlan.c rev. 1.104). Written by s-yamaguchi@iij.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/if_vlan/t_vlan.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/net/if_vlan/t_vlan.sh
diff -u src/tests/net/if_vlan/t_vlan.sh:1.4 src/tests/net/if_vlan/t_vlan.sh:1.5
--- src/tests/net/if_vlan/t_vlan.sh:1.4	Wed Oct 11 08:10:53 2017
+++ src/tests/net/if_vlan/t_vlan.sh	Thu Nov 16 06:31:00 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_vlan.sh,v 1.4 2017/10/11 08:10:53 msaitoh Exp $
+#	$NetBSD: t_vlan.sh,v 1.5 2017/11/16 06:31:00 msaitoh Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -456,7 +456,13 @@ vlan_configs_body_common()
 	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
 	atf_check -s not-exit:0 -e match:'File exists' \
 	rump.ifconfig vlan1 vlan 10 vlanif shmif0
-	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 10 vlanif shmif1
+
+	atf_check -s exit:0 rump.ifconfig vlan1 -vlanif shmif1
+	atf_check -s exit:0 rump.ifconfig vlan1 vlan 10 vlanif shmif1
+
+	atf_check -s exit:0 rump.ifconfig vlan0 -vlanif shmif0
+	atf_check -s exit:0 rump.ifconfig vlan0 vlan 10 vlanif shmif0
 }
 
 atf_test_case vlan_configs cleanup



CVS commit: src/sys

2017-11-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Nov 16 03:07:18 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_emac.c
src/sys/dev/ic: dwc_gmac.c
src/sys/dev/pci: if_wm.c
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
src/sys/net: if.h if_bridge.c if_ethersubr.c if_gif.c if_l2tp.c
if_loop.c if_pppoe.c if_vlan.c
src/sys/netcan: if_canloop.c
src/sys/netinet: ip_carp.c

Log Message:
Unify IFEF_*_MPSAFE into IFEF_MPSAFE

There are already two flags for if_output and if_start, however, it seems such
MPSAFE flags are eventually needed for all if_XXX operations. Having discrete
flags for each operation is wasteful of if_extflags bits. So let's unify
the flags into one: IFEF_MPSAFE.

Fortunately IFEF_*_MPSAFE flags have never been included in any releases, so
we can change them without breaking backward compatibility of the releases
(though the kernel version of -current should be bumped).

Note that if an interface have both MP-safe and non-MP-safe operations at a
time, we have to set the IFEF_MPSAFE flag and let callees of non-MP-safe
opeartions take the kernel lock.

Proposed on tech-kern@ and tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/sunxi_emac.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.542 -r1.543 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.241 -r1.242 src/sys/net/if.h
cvs rdiff -u -r1.139 -r1.140 src/sys/net/if_bridge.c
cvs rdiff -u -r1.245 -r1.246 src/sys/net/if_ethersubr.c
cvs rdiff -u -r1.131 -r1.132 src/sys/net/if_gif.c
cvs rdiff -u -r1.14 -r1.15 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.97 -r1.98 src/sys/net/if_loop.c
cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.106 -r1.107 src/sys/net/if_vlan.c
cvs rdiff -u -r1.2 -r1.3 src/sys/netcan/if_canloop.c
cvs rdiff -u -r1.91 -r1.92 src/sys/netinet/ip_carp.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.8 src/sys/arch/arm/sunxi/sunxi_emac.c:1.9
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.8	Sun Oct  1 15:05:09 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Thu Nov 16 03:07:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.8 2017/10/01 15:05:09 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.9 2017/11/16 03:07:17 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.8 2017/10/01 15:05:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.9 2017/11/16 03:07:17 ozaki-r Exp $");
 
 #include 
 #include 
@@ -1381,7 +1381,7 @@ sunxi_emac_attach(device_t parent, devic
 	snprintf(ifp->if_xname, IFNAMSIZ, EMAC_IFNAME, device_unit(self));
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 #ifdef EMAC_MPSAFE
-	ifp->if_extflags = IFEF_START_MPSAFE;
+	ifp->if_extflags = IFEF_MPSAFE;
 #endif
 	ifp->if_start = sunxi_emac_start;
 	ifp->if_ioctl = sunxi_emac_ioctl;

Index: src/sys/dev/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.42 src/sys/dev/ic/dwc_gmac.c:1.43
--- src/sys/dev/ic/dwc_gmac.c:1.42	Mon Oct 23 15:08:05 2017
+++ src/sys/dev/ic/dwc_gmac.c	Thu Nov 16 03:07:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.42 2017/10/23 15:08:05 jakllsch Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.43 2017/11/16 03:07:17 ozaki-r Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.42 2017/10/23 15:08:05 jakllsch Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.43 2017/11/16 03:07:17 ozaki-r Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -223,7 +223,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	ifp->if_softc = sc;
 	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	ifp->if_extflags = IFEF_START_MPSAFE;
+	ifp->if_extflags = IFEF_MPSAFE;
 	ifp->if_ioctl = dwc_gmac_ioctl;
 	ifp->if_start = dwc_gmac_start;
 	ifp->if_init = dwc_gmac_init;
@@ -836,7 +836,7 @@ static void
 dwc_gmac_start(struct ifnet *ifp)
 {
 	struct dwc_gmac_softc *sc = ifp->if_softc;
-	KASSERT(ifp->if_extflags & IFEF_START_MPSAFE);
+	KASSERT(if_is_mpsafe(ifp));
 
 	mutex_enter(sc->sc_lock);
 	if (!sc->sc_stopping) {

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.542 src/sys/dev/pci/if_wm.c:1.543
--- src/sys/dev/pci/if_wm.c:1.542	Mon Oct 23 23:29:38 2017
+++ src/sys/dev/pci/if_wm.c	Thu Nov 16 03:07:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.542 2017/10/23 23:29:38 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.543 2017/11/16 03:07:18 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi 

CVS commit: src/share/dict

2017-11-15 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Nov 16 01:24:42 UTC 2017

Modified Files:
src/share/dict: web2

Log Message:
Add missing words beginning with 'a' from FreeBSD's copy of src/share/dict/web2.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/share/dict/web2

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

Modified files:

Index: src/share/dict/web2
diff -u src/share/dict/web2:1.37 src/share/dict/web2:1.38
--- src/share/dict/web2:1.37	Thu Nov 16 00:10:31 2017
+++ src/share/dict/web2	Thu Nov 16 01:24:42 2017
@@ -922,6 +922,7 @@ accidentalness
 accidented
 accidential
 accidentiality
+accidently
 accidia
 accidie
 accinge
@@ -2630,6 +2631,7 @@ adjutorious
 adjutory
 adjutrice
 adjuvant
+Adlai
 adlay
 adless
 adlet
@@ -3876,6 +3878,7 @@ agee
 Agelacrinites
 Agelacrinitidae
 Agelaius
+agelast
 Agelaus
 ageless
 agelessness
@@ -3996,6 +3999,7 @@ agist
 agistator
 agistment
 agistor
+agita
 agitable
 agitant
 agitate
@@ -4284,6 +4288,8 @@ Ahir
 ahluwalia
 ahmadi
 Ahmadiya
+Ahmed
+Ahmet
 Ahnfeltia
 aho
 Ahom
@@ -4604,6 +4610,7 @@ Aladdinize
 Aladfar
 Aladinist
 alaihi
+Alain
 alaite
 Alaki
 Alala
@@ -4660,6 +4667,7 @@ Alaska
 alaskaite
 Alaskan
 alaskite
+Alastair
 Alaster
 alastrim
 alate
@@ -4708,6 +4716,7 @@ Albertine
 Albertinian
 Albertist
 albertite
+Alberto
 albertustaler
 albertype
 albescence
@@ -4999,6 +5008,7 @@ alefzero
 alegar
 alehoof
 alehouse
+Alejandro
 alem
 alemana
 Alemanni
@@ -5058,6 +5068,7 @@ Aleutic
 aleutite
 alevin
 alewife
+Alex
 Alexander
 alexanders
 Alexandra
@@ -5499,6 +5510,7 @@ alleluiatic
 allemand
 allemande
 allemontite
+Allen
 allenarly
 allene
 Allentiac
@@ -6296,6 +6308,7 @@ amaritude
 amarity
 amaroid
 amaroidal
+Amarth
 amarthritis
 amaryllid
 Amaryllidaceae
@@ -6526,6 +6539,7 @@ Ambystomidae
 amchoor
 ame
 amebiform
+Amedeo
 ameed
 ameen
 Ameiuridae
@@ -6709,6 +6723,7 @@ amidships
 amidst
 amidstream
 amidulin
+Amigo
 Amiidae
 amil
 Amiles
@@ -6874,11 +6889,13 @@ amnesia
 amnesic
 amnestic
 amnesty
+amnia
 amniac
 amniatic
 amnic
 Amnigenia
 amnioallantoic
+amniocentesis
 amniochorial
 amnioclepsis
 amniomancy
@@ -6889,6 +6906,7 @@ amnionic
 amniorrhea
 Amniota
 amniote
+amniotic
 amniotitis
 amniotome
 amober
@@ -7892,8 +7910,10 @@ Anatinacea
 Anatinae
 anatine
 anatocism
+Anatole
 Anatolian
 Anatolic
+Anatoly
 anatomic
 anatomical
 anatomically
@@ -8050,6 +8070,7 @@ Andarko
 Andaste
 Ande
 Andean
+Anderson
 Andesic
 andesine
 andesinite
@@ -8074,9 +8095,11 @@ andradite
 andranatomy
 andrarchy
 Andre
+Andrea
 Andreaea
 Andreaeaceae
 Andreaeales
+Andreas
 Andrena
 andrenid
 Andrenidae
@@ -8086,6 +8109,7 @@ Andria
 Andriana
 Andrias
 andric
+Andries
 androcentric
 androcephalous
 androcephalum
@@ -8878,9 +8902,11 @@ Annamese
 Annamite
 Annamitic
 Annapurna
+Annard
 annat
 annates
 annatto
+Anne
 anneal
 annealer
 annectent
@@ -10909,6 +10935,7 @@ antoecian
 antoecians
 Antoinette
 Anton
+Antonella
 Antonia
 Antonina
 antoninianus
@@ -10918,6 +10945,7 @@ antonomastic
 antonomastical
 antonomastically
 antonomasy
+Antony
 antonym
 antonymous
 antonymy
@@ -13264,6 +13292,7 @@ arkite
 arkose
 arkosic
 arksutite
+Arlene
 Arleng
 arles
 Arline
@@ -13359,6 +13388,7 @@ arn
 arna
 Arnaut
 arnberry
+Arne
 Arneb
 Arnebia
 arnee
@@ -16580,6 +16610,7 @@ avertedly
 averter
 avertible
 Avertin
+Avery
 Aves
 Avesta
 Avestan
@@ -16794,6 +16825,7 @@ axal
 axbreaker
 axe
 axed
+Axel
 axenic
 axes
 axfetch



CVS commit: src/share/dict

2017-11-15 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Nov 16 00:10:31 UTC 2017

Modified Files:
src/share/dict: web2

Log Message:
Add software
Realised missing word through David Cantrell & Andrew Fresh.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/share/dict/web2

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

Modified files:

Index: src/share/dict/web2
diff -u src/share/dict/web2:1.36 src/share/dict/web2:1.37
--- src/share/dict/web2:1.36	Mon Aug 14 05:29:02 2017
+++ src/share/dict/web2	Thu Nov 16 00:10:31 2017
@@ -183726,6 +183726,7 @@ softner
 softness
 softship
 softtack
+software
 softwood
 softy
 sog



CVS commit: src/sys/ufs/ffs

2017-11-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov 15 21:21:18 UTC 2017

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
PR/52728: Izumi Tsutsui: "mount -u /dev/ /" triggers kernel panic
Simplify the control flow of the mount code and make sure that the
mountfrom argument can be converted to a block device in the update
case.
XXX: pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 src/sys/ufs/ffs/ffs_vfsops.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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.354 src/sys/ufs/ffs/ffs_vfsops.c:1.355
--- src/sys/ufs/ffs/ffs_vfsops.c:1.354	Sun Aug 20 08:51:38 2017
+++ src/sys/ufs/ffs/ffs_vfsops.c	Wed Nov 15 16:21:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.354 2017/08/20 12:51:38 maya Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.355 2017/11/15 21:21:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.354 2017/08/20 12:51:38 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_vfsops.c,v 1.355 2017/11/15 21:21:18 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -418,12 +418,13 @@ ffs_mount(struct mount *mp, const char *
 		return EINVAL;
 	}
 
+	ump = VFSTOUFS(mp);
+	if ((mp->mnt_flag & (MNT_GETARGS|MNT_UPDATE)) && ump == NULL) {
+		DPRINTF("no ump");
+		return EIO;
+	}
+
 	if (mp->mnt_flag & MNT_GETARGS) {
-		ump = VFSTOUFS(mp);
-		if (ump == NULL) {
-			DPRINTF("no ump");
-			return EIO;
-		}
 		args->fspec = NULL;
 		*data_len = sizeof *args;
 		return 0;
@@ -432,7 +433,13 @@ ffs_mount(struct mount *mp, const char *
 	update = mp->mnt_flag & MNT_UPDATE;
 
 	/* Check arguments */
-	if (args->fspec != NULL) {
+	if (args->fspec == NULL) {
+		if (!update) {
+			/* New mounts must have a filename for the device */
+			DPRINTF("no filename for mount");
+			return EINVAL;
+		}
+	} else {
 		/*
 		 * Look up the name and verify that it's sane.
 		 */
@@ -443,48 +450,43 @@ ffs_mount(struct mount *mp, const char *
 			return error;
 		}
 
-		if (!update) {
-			/*
-			 * Be sure this is a valid block device
-			 */
-			if (devvp->v_type != VBLK) {
-DPRINTF("non block device %d", devvp->v_type);
-error = ENOTBLK;
-			} else if (bdevsw_lookup(devvp->v_rdev) == NULL) {
-DPRINTF("can't find block device 0x%jx",
-devvp->v_rdev);
-error = ENXIO;
-			}
-		} else {
+		/*
+		 * Be sure this is a valid block device
+		 */
+		if (devvp->v_type != VBLK) {
+			DPRINTF("non block device %d", devvp->v_type);
+			error = ENOTBLK;
+			goto fail;
+		}
+
+		if (bdevsw_lookup(devvp->v_rdev) == NULL) {
+			DPRINTF("can't find block device 0x%jx",
+			devvp->v_rdev);
+			error = ENXIO;
+			goto fail;
+		}
+
+		if (update) {
 			/*
 			 * Be sure we're still naming the same device
 			 * used for our initial mount
 			 */
-			ump = VFSTOUFS(mp);
-			if (devvp != ump->um_devvp) {
-if (devvp->v_rdev != ump->um_devvp->v_rdev) {
-	DPRINTF("wrong device 0x%jx != 0x%jx",
-	(uintmax_t)devvp->v_rdev,
-	(uintmax_t)ump->um_devvp->v_rdev);
-	error = EINVAL;
-} else {
-	vrele(devvp);
-	devvp = ump->um_devvp;
-	vref(devvp);
-}
+			if (devvp != ump->um_devvp &&
+			devvp->v_rdev != ump->um_devvp->v_rdev) {
+DPRINTF("wrong device 0x%jx != 0x%jx",
+(uintmax_t)devvp->v_rdev,
+(uintmax_t)ump->um_devvp->v_rdev);
+error = EINVAL;
+goto fail;
 			}
+			vrele(devvp);
+			devvp = NULL;
 		}
-	} else {
-		if (!update) {
-			/* New mounts must have a filename for the device */
-			DPRINTF("no filename for mount");
-			return EINVAL;
-		} else {
-			/* Use the extant mount */
-			ump = VFSTOUFS(mp);
-			devvp = ump->um_devvp;
-			vref(devvp);
-		}
+	}
+
+	if (devvp == NULL) {
+		devvp = ump->um_devvp;
+		vref(devvp);
 	}
 
 	/*
@@ -495,25 +497,17 @@ ffs_mount(struct mount *mp, const char *
 	 * updating the mount is okay (for example, as far as securelevel goes)
 	 * which leaves us with the normal check.
 	 */
-	if (error == 0) {
-		accessmode = VREAD;
-		if (update ?
-		(mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
-		(mp->mnt_flag & MNT_RDONLY) == 0)
-			accessmode |= VWRITE;
-		vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
-		error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
-		KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp,
-		KAUTH_ARG(accessmode));
-		if (error) {
-			DPRINTF("kauth returned %d", error);
-		}
-		VOP_UNLOCK(devvp);
-	}
-
+	accessmode = VREAD;
+	if (update ? (mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
+	(mp->mnt_flag & MNT_RDONLY) == 0)
+		accessmode |= VWRITE;
+	vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
+	error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MOUNT,
+	KAUTH_REQ_SYSTEM_MOUNT_DEVICE, mp, devvp, KAUTH_ARG(accessmode));
+	VOP_UNLOCK(devvp);
 	if (error) {
-		

CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 15 20:45:16 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: elf.c mm.c prekern.h

Log Message:
Small cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/stand/prekern/elf.c \
src/sys/arch/amd64/stand/prekern/prekern.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amd64/stand/prekern/mm.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/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.14 src/sys/arch/amd64/stand/prekern/elf.c:1.15
--- src/sys/arch/amd64/stand/prekern/elf.c:1.14	Wed Nov 15 18:02:36 2017
+++ src/sys/arch/amd64/stand/prekern/elf.c	Wed Nov 15 20:45:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.c,v 1.14 2017/11/15 18:02:36 maxv Exp $	*/
+/*	$NetBSD: elf.c,v 1.15 2017/11/15 20:45:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -372,11 +372,6 @@ elf_kernel_reloc(void)
 	print_state(true, "ELF info created");
 
 	/*
-	 * The loaded sections are: SHT_PROGBITS, SHT_NOBITS, SHT_STRTAB,
-	 * SHT_SYMTAB.
-	 */
-
-	/*
 	 * Update all symbol values with the appropriate offset.
 	 */
 	for (i = 0; i < eif.ehdr->e_shnum; i++) {
Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.14 src/sys/arch/amd64/stand/prekern/prekern.h:1.15
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.14	Wed Nov 15 18:44:34 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Wed Nov 15 20:45:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.14 2017/11/15 18:44:34 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.15 2017/11/15 20:45:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -41,7 +41,6 @@
 typedef uint64_t paddr_t;
 typedef uint64_t vaddr_t;
 typedef uint64_t pt_entry_t;
-typedef uint64_t pd_entry_t;
 typedef uint64_t pte_prot_t;
 #define WHITE_ON_BLACK 0x07
 #define RED_ON_BLACK 0x04

Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.16 src/sys/arch/amd64/stand/prekern/mm.c:1.17
--- src/sys/arch/amd64/stand/prekern/mm.c:1.16	Wed Nov 15 20:25:29 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Wed Nov 15 20:45:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.16 2017/11/15 20:25:29 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.17 2017/11/15 20:45:16 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -36,6 +36,13 @@
 
 #define ELFROUND	64
 
+static const int pads[4] = {
+	[BTSEG_NONE] = 0x00,
+	[BTSEG_TEXT] = 0xCC,
+	[BTSEG_RODATA] = 0x00,
+	[BTSEG_DATA] = 0x00
+};
+
 #define MM_PROT_READ	0x00
 #define MM_PROT_WRITE	0x01
 #define MM_PROT_EXECUTE	0x02
@@ -107,7 +114,7 @@ mm_vatopa(vaddr_t va)
 }
 
 static void
-mm_mprotect(vaddr_t startva, size_t size, int prot)
+mm_mprotect(vaddr_t startva, size_t size, pte_prot_t prot)
 {
 	size_t i, npages;
 	vaddr_t va;
@@ -127,7 +134,7 @@ mm_mprotect(vaddr_t startva, size_t size
 void
 mm_bootspace_mprotect(void)
 {
-	int prot;
+	pte_prot_t prot;
 	size_t i;
 
 	/* Remap the kernel segments with proper permissions. */
@@ -242,7 +249,7 @@ mm_map_head(void)
 }
 
 static vaddr_t
-mm_randva_kregion(size_t size, size_t align)
+mm_randva_kregion(size_t size, size_t pagesz)
 {
 	vaddr_t sva, eva;
 	vaddr_t randva;
@@ -253,7 +260,7 @@ mm_randva_kregion(size_t size, size_t al
 	while (1) {
 		rnd = mm_rand_num64();
 		randva = rounddown(KASLR_WINDOW_BASE +
-		rnd % (KASLR_WINDOW_SIZE - size), align);
+		rnd % (KASLR_WINDOW_SIZE - size), pagesz);
 
 		/* Detect collisions */
 		ok = true;
@@ -329,6 +336,8 @@ mm_shift_segment(vaddr_t va, size_t page
 		elfalign = ELFROUND;
 	}
 
+	ASSERT(pagesz >= elfalign);
+	ASSERT(pagesz % elfalign == 0);
 	shiftsize = roundup(elfsz, pagesz) - roundup(elfsz, elfalign);
 	if (shiftsize == 0) {
 		return 0;
@@ -368,13 +377,7 @@ mm_map_segment(int segtype, paddr_t pa, 
 	offset = mm_shift_segment(randva, pagesz, elfsz, elfalign);
 	ASSERT(offset + elfsz <= size);
 
-	if (segtype == BTSEG_TEXT) {
-		pad = PAD_TEXT;
-	} else if (segtype == BTSEG_RODATA) {
-		pad = PAD_RODATA;
-	} else {
-		pad = PAD_DATA;
-	}
+	pad = pads[segtype];
 	memset((void *)randva, pad, offset);
 	memset((void *)(randva + offset + elfsz), pad, size - elfsz - offset);
 



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 15 20:25:29 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c

Log Message:
Mmh, should be <=.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/stand/prekern/mm.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/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.15 src/sys/arch/amd64/stand/prekern/mm.c:1.16
--- src/sys/arch/amd64/stand/prekern/mm.c:1.15	Wed Nov 15 18:44:34 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Wed Nov 15 20:25:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.15 2017/11/15 18:44:34 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.16 2017/11/15 20:25:29 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -350,7 +350,7 @@ mm_map_segment(int segtype, paddr_t pa, 
 	vaddr_t randva;
 	char pad;
 
-	if (elfsz < PAGE_SIZE) {
+	if (elfsz <= PAGE_SIZE) {
 		pagesz = NBPD_L1;
 	} else {
 		pagesz = NBPD_L2;



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 15 18:44:34 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c prekern.h

Log Message:
Define MM_PROT_* locally.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/stand/prekern/prekern.h

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.14 src/sys/arch/amd64/stand/prekern/mm.c:1.15
--- src/sys/arch/amd64/stand/prekern/mm.c:1.14	Wed Nov 15 18:02:36 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Wed Nov 15 18:44:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.14 2017/11/15 18:02:36 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.15 2017/11/15 18:44:34 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -36,6 +36,10 @@
 
 #define ELFROUND	64
 
+#define MM_PROT_READ	0x00
+#define MM_PROT_WRITE	0x01
+#define MM_PROT_EXECUTE	0x02
+
 static const pt_entry_t protection_codes[3] = {
 	[MM_PROT_READ] = PG_RO | PG_NX,
 	[MM_PROT_WRITE] = PG_RW | PG_NX,

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.13 src/sys/arch/amd64/stand/prekern/prekern.h:1.14
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.13	Wed Nov 15 18:02:36 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Wed Nov 15 18:44:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.13 2017/11/15 18:02:36 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.14 2017/11/15 18:44:34 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -37,10 +37,6 @@
 #include "pdir.h"
 #include "redef.h"
 
-#define MM_PROT_READ	0x00
-#define MM_PROT_WRITE	0x01
-#define MM_PROT_EXECUTE	0x02
-
 #define ASSERT(a) if (!(a)) fatal("ASSERT");
 typedef uint64_t paddr_t;
 typedef uint64_t vaddr_t;



CVS commit: src/sys

2017-11-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Nov 15 18:02:37 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64
src/sys/arch/amd64/stand/prekern: elf.c mm.c prekern.h
src/sys/arch/x86/x86: pmap.c
src/sys/lib/libsa: loadfile_elf32.c

Log Message:
Support large pages on KASLR kernels, in a way that does not reduce
randomness, but on the contrary that increases it.

The size of the kernel sub-blocks is changed to be 1MB. This produces a
kernel with sections that are always < 2MB in size, that can fit a large
page.

Each section is put in a 2MB physical chunk. In this chunk, there is a
padding of approximately 1MB. The prekern uses a random offset aligned to
sh_addralign, to shift the section in physical memory.

For example, physical memory layout created by the bootloader for .text.4
and .rodata.0:
 +~~~+~~~+
 |+---+  |+---+  |
 ||.text.4|   PAD||   .rodata.0   |   PAD|
 |+---+  |+---+  |
 +~~~+~~~+
 PA  PA+2MB PA+4MB

Then, physical memory layout, after having been shifted by the prekern:
 +~~~+~~~+
 | P +---+   |  +---+|
 | A |.text.4|  PAD  |   PAD|   .rodata.0   |   PAD  |
 | D +---+   |  +---+|
 +~~~+~~~+
 PA  PA+2MB PA+4MB

The kernel maps these 2MB physical chunks with 2MB large pages. Therefore,
randomness is enforced at both the virtual and physical levels, and the
resulting entropy is higher than that of our current implementaion until
now.

The padding around the section is filled by the prekern. Not to consume
too much memory, the sections that are smaller than PAGE_SIZE are mapped
with normal pages - because there is no point in optimizing them. In these
normal pages, the same shift is applied.

This change has two additional advantages: (a) the cache attacks based on
the TLB are mostly mitigated, because even if you are able to determine
that a given page-aligned range is mapped as executable you don't know
where exactly within that range the section actually begins, and (b) given
that we are slightly randomizing the physical layout we are making some
rare physical attacks more difficult to conduct.

NOTE: after this change you need to update GENERIC_KASLR / prekern /
bootloader.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/stand/prekern/elf.c \
src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/stand/prekern/prekern.h
cvs rdiff -u -r1.264 -r1.265 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.50 -r1.51 src/sys/lib/libsa/loadfile_elf32.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/amd64/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.63 src/sys/arch/amd64/conf/Makefile.amd64:1.64
--- src/sys/arch/amd64/conf/Makefile.amd64:1.63	Tue Nov 14 10:15:40 2017
+++ src/sys/arch/amd64/conf/Makefile.amd64	Wed Nov 15 18:02:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.63 2017/11/14 10:15:40 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.64 2017/11/15 18:02:37 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -62,7 +62,7 @@ KERN_AS=	library
 ##
 TEXTADDR?=	0x8020
 .if defined(KASLR)
-EXTRA_LINKFLAGS=	--split-by-file=0x20 -r -d
+EXTRA_LINKFLAGS=	--split-by-file=0x10 -r -d
 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
 .else
 EXTRA_LINKFLAGS=	-z max-page-size=0x20

Index: src/sys/arch/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.13 src/sys/arch/amd64/stand/prekern/elf.c:1.14
--- src/sys/arch/amd64/stand/prekern/elf.c:1.13	Tue Nov 14 07:06:34 2017
+++ src/sys/arch/amd64/stand/prekern/elf.c	Wed Nov 15 18:02:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.c,v 1.13 2017/11/14 07:06:34 maxv Exp $	*/
+/*	$NetBSD: elf.c,v 1.14 2017/11/15 18:02:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -267,7 +267,7 @@ elf_map_sections(void)
 	int segtype;
 	vaddr_t secva;
 	paddr_t secpa;
-	size_t i, secsz;
+	size_t i, secsz, secalign;
 
 	for (i = 0; i < eif.ehdr->e_shnum; i++) {
 		shdr = [i];
@@ -289,10 +289,11 @@ elf_map_sections(void)
 		}
 		secpa = basepa + shdr->sh_offset;
 		secsz = shdr->sh_size;
+		secalign = shdr->sh_addralign;
 		ASSERT(shdr->sh_offset != 0);
 		

CVS commit: src/distrib/atari/floppies/install

2017-11-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 15 16:37:00 UTC 2017

Modified Files:
src/distrib/atari/floppies/install: list

Log Message:
Put back /bin/cp and /sbin/sysctl to installation binaries.

- cp(1) is explicitly required by sysinst(8), cp_to_target() in
  src/usr.sbin/sysinst/target.c, to copy bootloader to targetroot
- sysctl(8) is required by src/distrib/atari/floppies/common/dot.profile
  to detect the root device (fd or md)

This might cause floppy overflow on HEAD again, but works on 8.0_BETA.

Should be pulled up to netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/atari/floppies/install/list

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

Modified files:

Index: src/distrib/atari/floppies/install/list
diff -u src/distrib/atari/floppies/install/list:1.20 src/distrib/atari/floppies/install/list:1.21
--- src/distrib/atari/floppies/install/list:1.20	Wed Feb  8 16:12:59 2017
+++ src/distrib/atari/floppies/install/list	Wed Nov 15 16:37:00 2017
@@ -1,8 +1,8 @@
-#	$NetBSD: list,v 1.20 2017/02/08 16:12:59 rin Exp $
+#	$NetBSD: list,v 1.21 2017/11/15 16:37:00 tsutsui Exp $
 
 PROG	bin/cat
 PROG	bin/chmod
-#PROG	bin/cp
+PROG	bin/cp
 PROG	bin/dd
 PROG	bin/df
 PROG	bin/ln
@@ -31,7 +31,7 @@ PROG	sbin/newfs	sbin/mount_mfs
 PROG	sbin/ping
 PROG	sbin/reboot	sbin/halt
 PROG	sbin/route
-#PROG	sbin/sysctl
+PROG	sbin/sysctl
 PROG	sbin/umount
 
 PROG	usr/bin/ftp



CVS commit: src/distrib/atari/floppies/common

2017-11-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Nov 15 16:19:19 UTC 2017

Modified Files:
src/distrib/atari/floppies/common: dot.profile

Log Message:
Avoid use of expr(1).

It was removed from src/distrib/atari/floppies/install/list since rev 1.19
and the install script complains expr is not found.

Should be pulled up to netbsd-8.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/atari/floppies/common/dot.profile

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

Modified files:

Index: src/distrib/atari/floppies/common/dot.profile
diff -u src/distrib/atari/floppies/common/dot.profile:1.5 src/distrib/atari/floppies/common/dot.profile:1.6
--- src/distrib/atari/floppies/common/dot.profile:1.5	Sat Jan 30 00:52:11 2016
+++ src/distrib/atari/floppies/common/dot.profile	Wed Nov 15 16:19:19 2017
@@ -1,4 +1,4 @@
-# $NetBSD: dot.profile,v 1.5 2016/01/30 00:52:11 tsutsui Exp $
+# $NetBSD: dot.profile,v 1.6 2017/11/15 16:19:19 tsutsui Exp $
 #
 # Copyright (c) 1995 Jason R. Thorpe
 # Copyright (c) 1994 Christopher G. Demetriou
@@ -79,7 +79,7 @@ if [ "X${DONEPROFILE}" = "X" ]; then
 		_num=0
 		for i in $_maps; do
 			echo "	$_num  $i"
-			_num=`expr $_num + 1`
+			_num=$(( $_num + 1 ))
 		done
 		echo
 		echo -n "Select the number of the map you want to activate: "



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

2017-11-15 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Nov 15 13:53:27 UTC 2017

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

Log Message:
honour non-removable and broken-cd properties


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

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.16 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.17
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.16	Sat Oct 28 13:13:45 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Wed Nov 15 13:53:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.16 2017/10/28 13:13:45 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.17 2017/11/15 13:53:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.16 2017/10/28 13:13:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.17 2017/11/15 13:53:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -188,6 +188,9 @@ struct sunxi_mmc_softc {
 	struct fdtbus_regulator *sc_reg_vqmmc;
 
 	struct fdtbus_mmc_pwrseq *sc_pwrseq;
+
+	bool sc_non_removable;
+	bool sc_broken_cd;
 };
 
 CFATTACH_DECL_NEW(sunxi_mmc, sizeof(struct sunxi_mmc_softc),
@@ -334,6 +337,9 @@ sunxi_mmc_attach(device_t parent, device
 	sc->sc_gpio_cd_inverted = of_hasprop(phandle, "cd-inverted") ? 0 : 1;
 	sc->sc_gpio_wp_inverted = of_hasprop(phandle, "wp-inverted") ? 0 : 1;
 
+	sc->sc_non_removable = of_hasprop(phandle, "non-removable");
+	sc->sc_broken_cd = of_hasprop(phandle, "broken-cd");
+
 	if (sunxi_mmc_dmabounce_setup(sc) != 0 ||
 	sunxi_mmc_idma_setup(sc) != 0) {
 		aprint_error_dev(self, "failed to setup DMA\n");
@@ -638,9 +644,14 @@ sunxi_mmc_card_detect(sdmmc_chipset_hand
 {
 	struct sunxi_mmc_softc *sc = sch;
 
-	if (sc->sc_gpio_cd == NULL) {
-		return 1;	/* no card detect pin, assume present */
-	} else {
+	if (sc->sc_non_removable || sc->sc_broken_cd) {
+		/*
+		 * Non-removable or broken card detect flag set in
+		 * DT, assume always present
+		 */
+		return 1;
+	} else if (sc->sc_gpio_cd != NULL) {
+		/* Use card detect GPIO */
 		int v = 0, i;
 		for (i = 0; i < 5; i++) {
 			v += (fdtbus_gpio_read(sc->sc_gpio_cd) ^
@@ -652,6 +663,11 @@ sunxi_mmc_card_detect(sdmmc_chipset_hand
 		else if (v == 0)
 			sc->sc_mmc_present = 1;
 		return sc->sc_mmc_present;
+	} else {
+		/* Use CARD_PRESENT field of SD_STATUS register */
+		const uint32_t present = MMC_READ(sc, SUNXI_MMC_STATUS) &
+		SUNXI_MMC_STATUS_CARD_PRESENT;
+		return present != 0;
 	}
 }
 



CVS commit: src/sys

2017-11-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Nov 15 10:42:41 UTC 2017

Modified Files:
src/sys/net: if_stf.c if_stf.h
src/sys/netinet: in_gif.c in_gif.h in_l2tp.c ip_encap.c ip_encap.h
ip_mroute.c
src/sys/netinet6: in6_gif.c in6_gif.h in6_l2tp.c
src/sys/netipsec: xform.h xform_ipip.c

Log Message:
Add argument to encapsw->pr_input() instead of m_tag.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/net/if_stf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/net/if_stf.h
cvs rdiff -u -r1.88 -r1.89 src/sys/netinet/in_gif.c
cvs rdiff -u -r1.16 -r1.17 src/sys/netinet/in_gif.h
cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/in_l2tp.c
cvs rdiff -u -r1.65 -r1.66 src/sys/netinet/ip_encap.c
cvs rdiff -u -r1.22 -r1.23 src/sys/netinet/ip_encap.h
cvs rdiff -u -r1.147 -r1.148 src/sys/netinet/ip_mroute.c
cvs rdiff -u -r1.86 -r1.87 src/sys/netinet6/in6_gif.c
cvs rdiff -u -r1.15 -r1.16 src/sys/netinet6/in6_gif.h
cvs rdiff -u -r1.6 -r1.7 src/sys/netinet6/in6_l2tp.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netipsec/xform.h
cvs rdiff -u -r1.54 -r1.55 src/sys/netipsec/xform_ipip.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_stf.c
diff -u src/sys/net/if_stf.c:1.102 src/sys/net/if_stf.c:1.103
--- src/sys/net/if_stf.c:1.102	Mon Oct 23 09:32:55 2017
+++ src/sys/net/if_stf.c	Wed Nov 15 10:42:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.c,v 1.102 2017/10/23 09:32:55 msaitoh Exp $	*/
+/*	$NetBSD: if_stf.c,v 1.103 2017/11/15 10:42:41 knakahara Exp $	*/
 /*	$KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
 
 /*
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.102 2017/10/23 09:32:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.103 2017/11/15 10:42:41 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -591,16 +591,18 @@ stf_checkaddr6(struct stf_softc *sc, con
 }
 
 void
-in_stf_input(struct mbuf *m, int off, int proto)
+in_stf_input(struct mbuf *m, int off, int proto, void *eparg)
 {
 	int s;
-	struct stf_softc *sc;
+	struct stf_softc *sc = eparg;
 	struct ip *ip;
 	struct ip6_hdr *ip6;
 	uint8_t otos, itos;
 	struct ifnet *ifp;
 	size_t pktlen;
 
+	KASSERT(sc != NULL);
+
 	if (proto != IPPROTO_IPV6) {
 		m_freem(m);
 		return;
@@ -608,9 +610,7 @@ in_stf_input(struct mbuf *m, int off, in
 
 	ip = mtod(m, struct ip *);
 
-	sc = (struct stf_softc *)encap_getarg(m);
-
-	if (sc == NULL || (sc->sc_if.if_flags & IFF_UP) == 0) {
+	if ((sc->sc_if.if_flags & IFF_UP) == 0) {
 		m_freem(m);
 		return;
 	}

Index: src/sys/net/if_stf.h
diff -u src/sys/net/if_stf.h:1.7 src/sys/net/if_stf.h:1.8
--- src/sys/net/if_stf.h:1.7	Thu Aug 18 11:38:58 2016
+++ src/sys/net/if_stf.h	Wed Nov 15 10:42:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.h,v 1.7 2016/08/18 11:38:58 knakahara Exp $	*/
+/*	$NetBSD: if_stf.h,v 1.8 2017/11/15 10:42:41 knakahara Exp $	*/
 /*	$KAME: if_stf.h,v 1.3 2000/03/25 07:23:33 sumikawa Exp $	*/
 
 /*
@@ -39,6 +39,6 @@
 #define	STF_MTU_MIN	(1280)	/* Minimum MTU */
 #define	STF_MTU_MAX	(8192)	/* Maximum MTU */
 
-void	in_stf_input(struct mbuf *, int, int);
+void	in_stf_input(struct mbuf *, int, int, void *);
 
 #endif /* !_NET_IF_STF_H_ */

Index: src/sys/netinet/in_gif.c
diff -u src/sys/netinet/in_gif.c:1.88 src/sys/netinet/in_gif.c:1.89
--- src/sys/netinet/in_gif.c:1.88	Thu Sep 21 09:42:03 2017
+++ src/sys/netinet/in_gif.c	Wed Nov 15 10:42:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.c,v 1.88 2017/09/21 09:42:03 knakahara Exp $	*/
+/*	$NetBSD: in_gif.c,v 1.89 2017/11/15 10:42:41 knakahara Exp $	*/
 /*	$KAME: in_gif.c,v 1.66 2001/07/29 04:46:09 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.88 2017/09/21 09:42:03 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_gif.c,v 1.89 2017/11/15 10:42:41 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -195,19 +195,18 @@ in_gif_output(struct ifnet *ifp, int fam
 }
 
 void
-in_gif_input(struct mbuf *m, int off, int proto)
+in_gif_input(struct mbuf *m, int off, int proto, void *eparg)
 {
-	struct ifnet *gifp = NULL;
+	struct ifnet *gifp = eparg;
 	const struct ip *ip;
 	int af;
 	u_int8_t otos;
 
-	ip = mtod(m, const struct ip *);
+	KASSERT(gifp != NULL);
 
-	gifp = (struct ifnet *)encap_getarg(m);
+	ip = mtod(m, const struct ip *);
 
-	if (gifp == NULL || (gifp->if_flags & (IFF_UP|IFF_RUNNING))
-		!= (IFF_UP|IFF_RUNNING)) {
+	if ((gifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING)) {
 		m_freem(m);
 		ip_statinc(IP_STAT_NOGIF);
 		return;

Index: src/sys/netinet/in_gif.h
diff -u src/sys/netinet/in_gif.h:1.16 src/sys/netinet/in_gif.h:1.17
--- src/sys/netinet/in_gif.h:1.16	Mon Jul  4 04:22:47 2016
+++ src/sys/netinet/in_gif.h	Wed Nov 15 10:42:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in_gif.h,v 1.16 2016/07/04 04:22:47 knakahara Exp $	*/
+/*	$NetBSD: in_gif.h,v 1.17 2017/11/15 10:42:41 

CVS commit: src/sys/dev/isa

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 15 10:13:11 UTC 2017

Modified Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 s/Id/NetBSD/. Pointed out by wiz!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/isa/wbsioreg.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/isa/wbsioreg.h
diff -u src/sys/dev/isa/wbsioreg.h:1.4 src/sys/dev/isa/wbsioreg.h:1.5
--- src/sys/dev/isa/wbsioreg.h:1.4	Wed Nov 15 09:13:26 2017
+++ src/sys/dev/isa/wbsioreg.h	Wed Nov 15 10:13:11 2017
@@ -1,4 +1,4 @@
-/* $Id: wbsioreg.h,v 1.4 2017/11/15 09:13:26 msaitoh Exp $ */
+/* $NetBSD: wbsioreg.h,v 1.5 2017/11/15 10:13:11 msaitoh Exp $ */
 
 /* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
 /*



CVS commit: src/sys/netinet

2017-11-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 15 09:56:31 UTC 2017

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Convert SYN_CACHE_TIMER_ARM macro to static inline function (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.362 -r1.363 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.362 src/sys/netinet/tcp_input.c:1.363
--- src/sys/netinet/tcp_input.c:1.362	Wed Nov 15 09:55:22 2017
+++ src/sys/netinet/tcp_input.c	Wed Nov 15 09:56:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.363 2017/11/15 09:56:31 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.363 2017/11/15 09:56:31 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3652,14 +3652,16 @@ static struct pool syn_cache_pool;
  * We don't estimate RTT with SYNs, so each packet starts with the default
  * RTT and each timer step has a fixed timeout value.
  */
-#define	SYN_CACHE_TIMER_ARM(sc)		\
-do {	\
-	TCPT_RANGESET((sc)->sc_rxtcur,	\
-	TCPTV_SRTTDFLT * tcp_backoff[(sc)->sc_rxtshift], TCPTV_MIN,	\
-	TCPTV_REXMTMAX);		\
-	callout_reset(&(sc)->sc_timer,	\
-	(sc)->sc_rxtcur * (hz / PR_SLOWHZ), syn_cache_timer, (sc));	\
-} while (/*CONSTCOND*/0)
+static inline void
+syn_cache_timer_arm(struct syn_cache *sc)
+{
+
+	TCPT_RANGESET(sc->sc_rxtcur,
+	TCPTV_SRTTDFLT * tcp_backoff[sc->sc_rxtshift], TCPTV_MIN,
+	TCPTV_REXMTMAX);
+	callout_reset(>sc_timer,
+	sc->sc_rxtcur * (hz / PR_SLOWHZ), syn_cache_timer, sc);
+}
 
 #define	SYN_CACHE_TIMESTAMP(sc)	(tcp_now - (sc)->sc_timebase)
 
@@ -3782,7 +3784,7 @@ syn_cache_insert(struct syn_cache *sc, s
 	 */
 	sc->sc_rxttot = 0;
 	sc->sc_rxtshift = 0;
-	SYN_CACHE_TIMER_ARM(sc);
+	syn_cache_timer_arm(sc);
 
 	/* Link it from tcpcb entry */
 	LIST_INSERT_HEAD(>t_sc, sc, sc_tpq);
@@ -3835,7 +3837,7 @@ syn_cache_timer(void *arg)
 
 	/* Advance the timer back-off. */
 	sc->sc_rxtshift++;
-	SYN_CACHE_TIMER_ARM(sc);
+	syn_cache_timer_arm(sc);
 
 	goto out;
 
@@ -4513,7 +4515,7 @@ syn_cache_add(struct sockaddr *src, stru
 		 * syn_cache_put() will try to schedule the timer, so
 		 * we need to initialize it
 		 */
-		SYN_CACHE_TIMER_ARM(sc);
+		syn_cache_timer_arm(sc);
 		syn_cache_put(sc);
 		splx(s);
 		TCP_STATINC(TCP_STAT_SC_DROPPED);



CVS commit: src/sys/netinet

2017-11-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 15 09:55:22 UTC 2017

Modified Files:
src/sys/netinet: tcp_input.c tcp_var.h

Log Message:
Make syn_cache_timer static


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.362 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.180 -r1.181 src/sys/netinet/tcp_var.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.361 src/sys/netinet/tcp_input.c:1.362
--- src/sys/netinet/tcp_input.c:1.361	Wed Nov 15 09:54:18 2017
+++ src/sys/netinet/tcp_input.c	Wed Nov 15 09:55:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.361 2017/11/15 09:54:18 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.361 2017/11/15 09:54:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.362 2017/11/15 09:55:22 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -249,6 +249,8 @@ static struct timeval tcp_rst_ppslim_las
 static int tcp_ackdrop_ppslim_count = 0;
 static struct timeval tcp_ackdrop_ppslim_last;
 
+static void syn_cache_timer(void *);
+
 #define TCP_PAWS_IDLE	(24U * 24 * 60 * 60 * PR_SLOWHZ)
 
 /* for modulo comparisons of timestamps */
@@ -3799,7 +3801,7 @@ syn_cache_insert(struct syn_cache *sc, s
  * If we have retransmitted an entry the maximum number of times, expire
  * that entry.
  */
-void
+static void
 syn_cache_timer(void *arg)
 {
 	struct syn_cache *sc = arg;

Index: src/sys/netinet/tcp_var.h
diff -u src/sys/netinet/tcp_var.h:1.180 src/sys/netinet/tcp_var.h:1.181
--- src/sys/netinet/tcp_var.h:1.180	Mon Jul 31 15:51:27 2017
+++ src/sys/netinet/tcp_var.h	Wed Nov 15 09:55:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_var.h,v 1.180 2017/07/31 15:51:27 maxv Exp $	*/
+/*	$NetBSD: tcp_var.h,v 1.181 2017/11/15 09:55:22 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -971,7 +971,6 @@ struct syn_cache *syn_cache_lookup(const
 void	 syn_cache_reset(struct sockaddr *, struct sockaddr *,
 		struct tcphdr *);
 int	 syn_cache_respond(struct syn_cache *, struct mbuf *);
-void	 syn_cache_timer(void *);
 void	 syn_cache_cleanup(struct tcpcb *);
 
 int	 tcp_input_checksum(int, struct mbuf *, const struct tcphdr *, int, int,



CVS commit: src/sys/netinet

2017-11-15 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov 15 09:54:18 UTC 2017

Modified Files:
src/sys/netinet: tcp_input.c

Log Message:
Reduce return points (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.360 -r1.361 src/sys/netinet/tcp_input.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/netinet/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.360 src/sys/netinet/tcp_input.c:1.361
--- src/sys/netinet/tcp_input.c:1.360	Thu Aug  3 06:32:51 2017
+++ src/sys/netinet/tcp_input.c	Wed Nov 15 09:54:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.360 2017/08/03 06:32:51 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.361 2017/11/15 09:54:18 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.360 2017/08/03 06:32:51 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.361 2017/11/15 09:54:18 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3806,15 +3806,12 @@ syn_cache_timer(void *arg)
 
 	mutex_enter(softnet_lock);
 	KERNEL_LOCK(1, NULL);
+
 	callout_ack(>sc_timer);
 
 	if (__predict_false(sc->sc_flags & SCF_DEAD)) {
 		TCP_STATINC(TCP_STAT_SC_DELAYED_FREE);
-		callout_destroy(>sc_timer);
-		pool_put(_cache_pool, sc);
-		KERNEL_UNLOCK_ONE(NULL);
-		mutex_exit(softnet_lock);
-		return;
+		goto free;
 	}
 
 	if (__predict_false(sc->sc_rxtshift == TCP_MAXRXTSHIFT)) {
@@ -3838,9 +3835,7 @@ syn_cache_timer(void *arg)
 	sc->sc_rxtshift++;
 	SYN_CACHE_TIMER_ARM(sc);
 
-	KERNEL_UNLOCK_ONE(NULL);
-	mutex_exit(softnet_lock);
-	return;
+	goto out;
 
  dropit:
 	TCP_STATINC(TCP_STAT_SC_TIMED_OUT);
@@ -3848,8 +3843,12 @@ syn_cache_timer(void *arg)
 	if (sc->sc_ipopts)
 		(void) m_free(sc->sc_ipopts);
 	rtcache_free(>sc_route);
+
+ free:
 	callout_destroy(>sc_timer);
 	pool_put(_cache_pool, sc);
+
+ out:
 	KERNEL_UNLOCK_ONE(NULL);
 	mutex_exit(softnet_lock);
 }



CVS commit: src/bin/sh

2017-11-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Nov 15 09:21:48 UTC 2017

Modified Files:
src/bin/sh: redir.c

Log Message:
DEBUG mode only change.   Add some tracing.   NFC (without DEBUG).


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/bin/sh/redir.c

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

Modified files:

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.58 src/bin/sh/redir.c:1.59
--- src/bin/sh/redir.c:1.58	Fri Jun 30 23:01:21 2017
+++ src/bin/sh/redir.c	Wed Nov 15 09:21:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.58 2017/06/30 23:01:21 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.59 2017/11/15 09:21:48 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.58 2017/06/30 23:01:21 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.59 2017/11/15 09:21:48 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -67,6 +67,7 @@ __RCSID("$NetBSD: redir.c,v 1.58 2017/06
 #include "memalloc.h"
 #include "mystring.h"
 #include "error.h"
+#include "show.h"
 
 
 #define EMPTY -2		/* marks an unused slot in redirtab */
@@ -278,6 +279,8 @@ openredirect(union node *redir, char mem
 			eflags = 0;
 		if ((f = open(fname, O_RDONLY|eflags)) < 0)
 			goto eopen;
+		VTRACE(DBG_REDIR, ("openredirect(< '%s') -> %d [%#x]",
+		fname, f, eflags));
 		if (eflags)
 			(void)fcntl(f, F_SETFL, fcntl(f, F_GETFL, 0) & ~eflags);
 		break;
@@ -285,6 +288,7 @@ openredirect(union node *redir, char mem
 		fname = redir->nfile.expfname;
 		if ((f = open(fname, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0)
 			goto ecreate;
+		VTRACE(DBG_REDIR, ("openredirect(<> '%s') -> %d", fname, f));
 		break;
 	case NTO:
 		if (Cflag) {
@@ -310,11 +314,13 @@ openredirect(union node *redir, char mem
 		fname = redir->nfile.expfname;
 		if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0)
 			goto ecreate;
+		VTRACE(DBG_REDIR, ("openredirect(> '%s') -> %d", fname, f));
 		break;
 	case NAPPEND:
 		fname = redir->nfile.expfname;
 		if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0)
 			goto ecreate;
+		VTRACE(DBG_REDIR, ("openredirect(>> '%s') -> %d", fname, f));
 		break;
 	case NTOFD:
 	case NFROMFD:
@@ -326,13 +332,19 @@ openredirect(union node *redir, char mem
 			(flags & REDIR_KEEP) == 0) < 0)
 error("Redirect (from %d to %d) failed: %s",
 redir->ndup.dupfd, fd, strerror(errno));
-		} else
+			VTRACE(DBG_REDIR, ("openredirect: %d%c&%d\n", fd,
+			"<>"[redir->nfile.type==NTOFD], redir->ndup.dupfd));
+		} else {
 			(void) close(fd);
+			VTRACE(DBG_REDIR, ("openredirect: %d%c&-\n", fd,
+			"<>"[redir->nfile.type==NTOFD]));
+		}
 		INTON;
 		return;
 	case NHERE:
 	case NXHERE:
 		f = openhere(redir);
+		VTRACE(DBG_REDIR, ("openredirect: %d<<...", fd));
 		break;
 	default:
 		abort();
@@ -340,6 +352,7 @@ openredirect(union node *redir, char mem
 
 	cloexec = fd > 2 && (flags & REDIR_KEEP) == 0 && !posix;
 	if (f != fd) {
+		VTRACE(DBG_REDIR, (" -> %d", fd));
 		if (copyfd(f, fd, cloexec) < 0) {
 			int e = errno;
 
@@ -350,6 +363,7 @@ openredirect(union node *redir, char mem
 		close(f);
 	} else if (cloexec)
 		(void)fcntl(f, F_SETFD, FD_CLOEXEC);
+	VTRACE(DBG_REDIR, ("%s\n", cloexec ? " cloexec" : ""));
 
 	INTON;
 	return;
@@ -549,6 +563,7 @@ to_upper_fd(int fd)
 {
 	int i;
 
+	VTRACE(DBG_REDIR|DBG_OUTPUT, ("to_upper_fd(%d)", fd));
 	if (big_sh_fd < 10)
 		find_big_fd();
 	do {
@@ -556,6 +571,7 @@ to_upper_fd(int fd)
 		if (i >= 0) {
 			if (fd != i)
 close(fd);
+			VTRACE(DBG_REDIR|DBG_OUTPUT, ("-> %d\n", i));
 			return i;
 		}
 		if (errno != EMFILE && errno != EINVAL)
@@ -569,6 +585,7 @@ to_upper_fd(int fd)
 	 * if the reassignment failed.
 	 */
 	(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
+	VTRACE(DBG_REDIR|DBG_OUTPUT, (" fails ->%d\n", fd));
 	return fd;
 }
 



CVS commit: src/bin/sh

2017-11-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Nov 15 09:21:20 UTC 2017

Modified Files:
src/bin/sh: mkoptions.sh

Log Message:
Sort options with long names that differ only by char case in
the same order that option flags with a similar property are sorted.
This corresponds with the change made to the sort order of the short
names made in the previous update (1.4).

Right now, this change makes no difference at all, as there are no
long option names that differ only in char case (yet.)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/bin/sh/mkoptions.sh

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

Modified files:

Index: src/bin/sh/mkoptions.sh
diff -u src/bin/sh/mkoptions.sh:1.4 src/bin/sh/mkoptions.sh:1.5
--- src/bin/sh/mkoptions.sh:1.4	Sat Jul  1 06:14:51 2017
+++ src/bin/sh/mkoptions.sh	Wed Nov 15 09:21:19 2017
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# $NetBSD: mkoptions.sh,v 1.4 2017/07/01 06:14:51 kre Exp $
+# $NetBSD: mkoptions.sh,v 1.5 2017/11/15 09:21:19 kre Exp $
 
 #
 # It would be more sensible to generate 2 .h files, one which
@@ -41,7 +41,7 @@ ${SED:-sed} <"${IF}"			\
 	-e '/^[ 	]*\//d'		\
 	-e '/^[ 	]*\*/d'		\
 	-e '/^[ 	]*;/d'			|
-sort -b -k2,2f -k2,2r < "${IF}"			|
+sort -b -k2,2f -k2,2 < "${IF}"			|
 while read line
 do
 	# Look for comments in various styles, and ignore them



CVS commit: src/sys/dev/isa

2017-11-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 15 09:13:26 UTC 2017

Modified Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/isa/wbsioreg.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/isa/wbsioreg.h
diff -u src/sys/dev/isa/wbsioreg.h:1.3 src/sys/dev/isa/wbsioreg.h:1.4
--- src/sys/dev/isa/wbsioreg.h:1.3	Fri Aug 18 04:07:51 2017
+++ src/sys/dev/isa/wbsioreg.h	Wed Nov 15 09:13:26 2017
@@ -1,3 +1,5 @@
+/* $Id: wbsioreg.h,v 1.4 2017/11/15 09:13:26 msaitoh Exp $ */
+
 /* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
 /*
  * Copyright (c) 2008 Mark Kettenis 



CVS commit: src/bin/sh

2017-11-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Nov 15 08:50:07 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Correct a typo:  s/ at / an /


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.172 src/bin/sh/sh.1:1.173
--- src/bin/sh/sh.1:1.172	Mon Oct 30 15:37:41 2017
+++ src/bin/sh/sh.1	Wed Nov 15 08:50:07 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.172 2017/10/30 15:37:41 wiz Exp $
+.\"	$NetBSD: sh.1,v 1.173 2017/11/15 08:50:07 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -2638,7 +2638,7 @@ It is an error to use
 .Ic local
 outside the scope of a function definition.
 When used inside a function, it exits with status 0,
-unless an undefined option is used, or at attempt is made to
+unless an undefined option is used, or an attempt is made to
 assign a value to a read-only variable.
 .Pp
 Note that either