Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Sep 2017 04:24:13 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r324096 - in projects/runtime-coverage: sys/dev/hyperv/netvsc sys/dev/neta sys/dev/smc sys/dev/usb sys/dev/usb/net sys/fs/nfs sys/fs/nfsclient sys/i386/i386 sys/i386/include sys/i386/is...
Message-ID:  <201709290424.v8T4ODef036253@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Sep 29 04:24:13 2017
New Revision: 324096
URL: https://svnweb.freebsd.org/changeset/base/324096

Log:
  MFhead@r324095

Modified:
  projects/runtime-coverage/sys/dev/hyperv/netvsc/if_hn.c
  projects/runtime-coverage/sys/dev/neta/if_mvneta.c
  projects/runtime-coverage/sys/dev/smc/if_smc.c
  projects/runtime-coverage/sys/dev/usb/net/if_ure.c
  projects/runtime-coverage/sys/dev/usb/usbdevs
  projects/runtime-coverage/sys/fs/nfs/nfs_commonsubs.c
  projects/runtime-coverage/sys/fs/nfs/nfs_var.h
  projects/runtime-coverage/sys/fs/nfs/nfsport.h
  projects/runtime-coverage/sys/fs/nfsclient/nfs_clrpcops.c
  projects/runtime-coverage/sys/i386/i386/db_trace.c
  projects/runtime-coverage/sys/i386/i386/exception.s
  projects/runtime-coverage/sys/i386/i386/genassym.c
  projects/runtime-coverage/sys/i386/i386/locore.s
  projects/runtime-coverage/sys/i386/i386/machdep.c
  projects/runtime-coverage/sys/i386/i386/trap.c
  projects/runtime-coverage/sys/i386/include/asmacros.h
  projects/runtime-coverage/sys/i386/include/md_var.h
  projects/runtime-coverage/sys/i386/isa/npx.c
  projects/runtime-coverage/sys/kern/imgact_aout.c
  projects/runtime-coverage/sys/netgraph/ng_iface.c
  projects/runtime-coverage/sys/vm/vm_object.c
  projects/runtime-coverage/usr.sbin/config/config.h
  projects/runtime-coverage/usr.sbin/diskinfo/diskinfo.c
Directory Properties:
  projects/runtime-coverage/   (props changed)

Modified: projects/runtime-coverage/sys/dev/hyperv/netvsc/if_hn.c
==============================================================================
--- projects/runtime-coverage/sys/dev/hyperv/netvsc/if_hn.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/dev/hyperv/netvsc/if_hn.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
 #include "opt_rss.h"
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/counter.h>
 #include <sys/kernel.h>
@@ -77,7 +78,6 @@ __FBSDID("$FreeBSD$");
 #include <sys/sockio.h>
 #include <sys/sx.h>
 #include <sys/sysctl.h>
-#include <sys/systm.h>
 #include <sys/taskqueue.h>
 #include <sys/buf_ring.h>
 #include <sys/eventhandler.h>

Modified: projects/runtime-coverage/sys/dev/neta/if_mvneta.c
==============================================================================
--- projects/runtime-coverage/sys/dev/neta/if_mvneta.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/dev/neta/if_mvneta.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -3411,6 +3411,7 @@ sysctl_mvneta_init(struct mvneta_softc *sc)
 	};
 #undef MVNETA_SYSCTL_NAME
 
+#ifndef NO_SYSCTL_DESCR
 #define	MVNETA_SYSCTL_DESCR(num) "configuration parameters for queue " # num
 	static const char *sysctl_queue_descrs[] = {
 		MVNETA_SYSCTL_DESCR(0), MVNETA_SYSCTL_DESCR(1),
@@ -3419,6 +3420,7 @@ sysctl_mvneta_init(struct mvneta_softc *sc)
 		MVNETA_SYSCTL_DESCR(6), MVNETA_SYSCTL_DESCR(7),
 	};
 #undef MVNETA_SYSCTL_DESCR
+#endif
 
 
 	ctx = device_get_sysctl_ctx(sc->dev);
@@ -3442,15 +3444,14 @@ sysctl_mvneta_init(struct mvneta_softc *sc)
 	 */
 	/* dev.mvneta.[unit].mib.<mibs> */
 	for (i = 0; i < MVNETA_PORTMIB_NOCOUNTER; i++) {
-		const char *name = mvneta_mib_list[i].sysctl_name;
-		const char *desc = mvneta_mib_list[i].desc;
 		struct mvneta_sysctl_mib *mib_arg = &sc->sysctl_mib[i];
 
 		mib_arg->sc = sc;
 		mib_arg->index = i;
-		SYSCTL_ADD_PROC(ctx, mchildren, OID_AUTO, name,
+		SYSCTL_ADD_PROC(ctx, mchildren, OID_AUTO,
+		    mvneta_mib_list[i].sysctl_name,
 		    CTLTYPE_U64|CTLFLAG_RD, (void *)mib_arg, 0,
-		    sysctl_read_mib, "I", desc);
+		    sysctl_read_mib, "I", mvneta_mib_list[i].desc);
 	}
 	SYSCTL_ADD_UQUAD(ctx, mchildren, OID_AUTO, "rx_discard",
 	    CTLFLAG_RD, &sc->counter_pdfc, "Port Rx Discard Frame Counter");

Modified: projects/runtime-coverage/sys/dev/smc/if_smc.c
==============================================================================
--- projects/runtime-coverage/sys/dev/smc/if_smc.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/dev/smc/if_smc.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -782,7 +782,7 @@ smc_task_rx(void *context, int pending)
 }
 
 #ifdef DEVICE_POLLING
-static void
+static int
 smc_poll(struct ifnet *ifp, enum poll_cmd cmd, int count)
 {
 	struct smc_softc	*sc;
@@ -792,12 +792,13 @@ smc_poll(struct ifnet *ifp, enum poll_cmd cmd, int cou
 	SMC_LOCK(sc);
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
 		SMC_UNLOCK(sc);
-		return;
+		return (0);
 	}
 	SMC_UNLOCK(sc);
 
 	if (cmd == POLL_AND_CHECK_STATUS)
 		taskqueue_enqueue(sc->smc_tq, &sc->smc_intr);
+        return (0);
 }
 #endif
 

Modified: projects/runtime-coverage/sys/dev/usb/net/if_ure.c
==============================================================================
--- projects/runtime-coverage/sys/dev/usb/net/if_ure.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/dev/usb/net/if_ure.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -67,6 +67,7 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN
  */
 static const STRUCT_USB_HOST_ID ure_devs[] = {
 #define	URE_DEV(v,p,i)	{ USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
+	URE_DEV(LENOVO, RTL8153, 0),
 	URE_DEV(REALTEK, RTL8152, URE_FLAG_8152),
 	URE_DEV(REALTEK, RTL8153, 0),
 #undef URE_DEV

Modified: projects/runtime-coverage/sys/dev/usb/usbdevs
==============================================================================
--- projects/runtime-coverage/sys/dev/usb/usbdevs	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/dev/usb/usbdevs	Fri Sep 29 04:24:13 2017	(r324096)
@@ -2703,6 +2703,7 @@ product LEADTEK 9531		0x2101	9531 GPS
 /* Lenovo products */
 product LENOVO GIGALAN		0x304b	USB 3.0 Ethernet
 product LENOVO ETHERNET		0x7203	USB 2.0 Ethernet
+product LENOVO RTL8153		0x7205	USB 3.0 Ethernet
 
 /* Lexar products */
 product LEXAR JUMPSHOT		0x0001	jumpSHOT CompactFlash Reader

Modified: projects/runtime-coverage/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- projects/runtime-coverage/sys/fs/nfs/nfs_commonsubs.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/fs/nfs/nfs_commonsubs.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -3938,14 +3938,13 @@ newnfs_sndunlock(int *flagp)
 }
 
 APPLESTATIC int
-nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_storage *sa,
-    int *isudp)
+nfsv4_getipaddr(struct nfsrv_descript *nd, struct sockaddr_in *sin,
+    struct sockaddr_in6 *sin6, sa_family_t *saf, int *isudp)
 {
-	struct sockaddr_in *sad;
-	struct sockaddr_in6 *sad6;
 	struct in_addr saddr;
 	uint32_t portnum, *tl;
-	int af = 0, i, j, k;
+	int i, j, k;
+	sa_family_t af = AF_UNSPEC;
 	char addr[64], protocol[5], *cp;
 	int cantparse = 0, error = 0;
 	uint16_t portv;
@@ -4023,20 +4022,20 @@ nfsv4_getipaddr(struct nfsrv_descript *nd, struct sock
 			cantparse = 1;
 		if (cantparse == 0) {
 			if (af == AF_INET) {
-				sad = (struct sockaddr_in *)sa;
-				if (inet_pton(af, addr, &sad->sin_addr) == 1) {
-					sad->sin_len = sizeof(*sad);
-					sad->sin_family = AF_INET;
-					sad->sin_port = htons(portv);
+				if (inet_pton(af, addr, &sin->sin_addr) == 1) {
+					sin->sin_len = sizeof(*sin);
+					sin->sin_family = AF_INET;
+					sin->sin_port = htons(portv);
+					*saf = af;
 					return (0);
 				}
 			} else {
-				sad6 = (struct sockaddr_in6 *)sa;
-				if (inet_pton(af, addr, &sad6->sin6_addr)
+				if (inet_pton(af, addr, &sin6->sin6_addr)
 				    == 1) {
-					sad6->sin6_len = sizeof(*sad6);
-					sad6->sin6_family = AF_INET6;
-					sad6->sin6_port = htons(portv);
+					sin6->sin6_len = sizeof(*sin6);
+					sin6->sin6_family = AF_INET6;
+					sin6->sin6_port = htons(portv);
+					*saf = af;
 					return (0);
 				}
 			}

Modified: projects/runtime-coverage/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/runtime-coverage/sys/fs/nfs/nfs_var.h	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/fs/nfs/nfs_var.h	Fri Sep 29 04:24:13 2017	(r324096)
@@ -287,8 +287,8 @@ void nfsrv_cleanusergroup(void);
 int nfsrv_checkutf8(u_int8_t *, int);
 int newnfs_sndlock(int *);
 void newnfs_sndunlock(int *);
-int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_storage *,
-    int *);
+int nfsv4_getipaddr(struct nfsrv_descript *, struct sockaddr_in *,
+    struct sockaddr_in6 *, sa_family_t *, int *);
 int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, struct nfsslot *,
     struct mbuf **, uint16_t);
 void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);

Modified: projects/runtime-coverage/sys/fs/nfs/nfsport.h
==============================================================================
--- projects/runtime-coverage/sys/fs/nfs/nfsport.h	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/fs/nfs/nfsport.h	Fri Sep 29 04:24:13 2017	(r324096)
@@ -896,6 +896,7 @@ int newnfs_realign(struct mbuf **, int);
 #define	NFSSTA_HASWRITEVERF	0x00040000  /* Has write verifier */
 #define	NFSSTA_GOTFSINFO	0x00100000  /* Got the fsinfo */
 #define	NFSSTA_OPENMODE		0x00200000  /* Must use correct open mode */
+#define	NFSSTA_FLEXFILE		0x00800000  /* Use Flex File Layout */
 #define	NFSSTA_NOLAYOUTCOMMIT	0x04000000  /* Don't do LayoutCommit */
 #define	NFSSTA_SESSPERSIST	0x08000000  /* Has a persistent session */
 #define	NFSSTA_TIMEO		0x10000000  /* Experiencing a timeout */
@@ -926,6 +927,7 @@ int newnfs_realign(struct mbuf **, int);
 #define	NFSHASNOLAYOUTCOMMIT(n)	((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT)
 #define	NFSHASSESSPERSIST(n)	((n)->nm_state & NFSSTA_SESSPERSIST)
 #define	NFSHASPNFS(n)		((n)->nm_state & NFSSTA_PNFS)
+#define	NFSHASFLEXFILE(n)	((n)->nm_state & NFSSTA_FLEXFILE)
 #define	NFSHASOPENMODE(n)	((n)->nm_state & NFSSTA_OPENMODE)
 #define	NFSHASONEOPENOWN(n)	(((n)->nm_flag & NFSMNT_ONEOPENOWN) != 0 &&	\
 				    (n)->nm_minorvers > 0)

Modified: projects/runtime-coverage/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/runtime-coverage/sys/fs/nfsclient/nfs_clrpcops.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/fs/nfsclient/nfs_clrpcops.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -109,8 +109,8 @@ static int nfsrpc_setaclrpc(vnode_t, struct ucred *, N
 static int nfsrpc_getlayout(struct nfsmount *, vnode_t, struct nfsfh *, int,
     uint32_t *, nfsv4stateid_t *, uint64_t, struct nfscllayout **,
     struct ucred *, NFSPROC_T *);
-static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_storage *,
-    struct nfsclds **, NFSPROC_T *);
+static int nfsrpc_fillsa(struct nfsmount *, struct sockaddr_in *,
+    struct sockaddr_in6 *, sa_family_t, int, struct nfsclds **, NFSPROC_T *);
 static void nfscl_initsessionslots(struct nfsclsession *);
 static int nfscl_doflayoutio(vnode_t, struct uio *, int *, int *, int *,
     nfsv4stateid_t *, int, struct nfscldevinfo *, struct nfscllayout *,
@@ -4885,14 +4885,17 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 	uint32_t cnt, *tl;
 	struct nfsrv_descript nfsd;
 	struct nfsrv_descript *nd = &nfsd;
-	struct sockaddr_storage ss;
-	struct nfsclds *dsp = NULL, **dspp;
+	struct sockaddr_in sin, ssin;
+	struct sockaddr_in6 sin6, ssin6;
+	struct nfsclds *dsp = NULL, **dspp, **gotdspp;
 	struct nfscldevinfo *ndi;
-	int addrcnt, bitcnt, error, i, isudp, j, pos, safilled, stripecnt;
+	int addrcnt = 0, bitcnt, error, gotvers, i, isudp, j, stripecnt;
 	uint8_t stripeindex;
+	sa_family_t af, safilled;
 
 	*ndip = NULL;
 	ndi = NULL;
+	gotdspp = NULL;
 	nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0,
 	    0);
 	NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
@@ -4960,7 +4963,7 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 		}
 
 		/* Now, dissect the server address(es). */
-		safilled = 0;
+		safilled = AF_UNSPEC;
 		for (i = 0; i < addrcnt; i++) {
 			NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
 			cnt = fxdr_unsigned(uint32_t, *tl);
@@ -4970,61 +4973,65 @@ nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de
 				goto nfsmout;
 			}
 			dspp = nfsfldi_addr(ndi, i);
-			pos = arc4random() % cnt;	/* Choose one. */
-			safilled = 0;
+			safilled = AF_UNSPEC;
 			for (j = 0; j < cnt; j++) {
-				error = nfsv4_getipaddr(nd, &ss, &isudp);
+				error = nfsv4_getipaddr(nd, &sin, &sin6, &af,
+				    &isudp);
 				if (error != 0 && error != EPERM) {
 					error = NFSERR_BADXDR;
 					goto nfsmout;
 				}
 				if (error == 0 && isudp == 0) {
 					/*
-					 * The algorithm is:
-					 * - use "pos" entry if it is of the
-					 *   same af_family or none of them
-					 *   is of the same af_family
-					 * else
-					 * - use the first one of the same
-					 *   af_family.
+					 * The priority is:
+					 * - Same address family.
+					 * Save the address and dspp, so that
+					 * the connection can be done after
+					 * parsing is complete.
 					 */
-					if ((safilled == 0 && ss.ss_family ==
-					     nmp->nm_nam->sa_family) ||
-					    (j == pos &&
-					     (safilled == 0 || ss.ss_family ==
-					      nmp->nm_nam->sa_family)) ||
-					    (safilled == 1 && ss.ss_family ==
-					     nmp->nm_nam->sa_family)) {
-						error = nfsrpc_fillsa(nmp, &ss,
-						    &dsp, p);
-						if (error == 0) {
-							*dspp = dsp;
-							if (ss.ss_family ==
-							 nmp->nm_nam->sa_family)
-								safilled = 2;
-							else
-								safilled = 1;
-						}
+					if (safilled == AF_UNSPEC ||
+					    (af == nmp->nm_nam->sa_family &&
+					     safilled != nmp->nm_nam->sa_family)
+					   ) {
+						if (af == AF_INET)
+							ssin = sin;
+						else
+							ssin6 = sin6;
+						safilled = af;
+						gotdspp = dspp;
 					}
 				}
 			}
-			if (safilled == 0)
-				break;
 		}
 
+		gotvers = NFS_VER4;	/* Always NFSv4 for File Layout. */
+
 		/* And the notify bits. */
 		NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
-		if (safilled != 0) {
-			bitcnt = fxdr_unsigned(int, *tl);
-			if (bitcnt > 0) {
-				NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
-				if (notifybitsp != NULL)
-					*notifybitsp =
-					    fxdr_unsigned(uint32_t, *tl);
-			}
+		bitcnt = fxdr_unsigned(int, *tl);
+		if (bitcnt > 0) {
+			NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
+			if (notifybitsp != NULL)
+				*notifybitsp =
+				    fxdr_unsigned(uint32_t, *tl);
+		}
+		if (safilled != AF_UNSPEC) {
+			KASSERT(ndi != NULL, ("ndi is NULL"));
 			*ndip = ndi;
 		} else
 			error = EPERM;
+		if (error == 0) {
+			/*
+			 * Now we can do a TCP connection for the correct
+			 * NFS version and IP address.
+			 */
+			error = nfsrpc_fillsa(nmp, &ssin, &ssin6, safilled,
+			    gotvers, &dsp, p);
+		}
+		if (error == 0) {
+			KASSERT(gotdspp != NULL, ("gotdspp is NULL"));
+			*gotdspp = dsp;
+		}
 	}
 	if (nd->nd_repstat != 0)
 		error = nd->nd_repstat;
@@ -5213,11 +5220,12 @@ nfsrpc_getlayout(struct nfsmount *nmp, vnode_t vp, str
  * mount point and a pointer to it is returned.
  */
 static int
-nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_storage *ssp,
-    struct nfsclds **dspp, NFSPROC_T *p)
+nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_in *sin,
+    struct sockaddr_in6 *sin6, sa_family_t af, int vers, struct nfsclds **dspp,
+    NFSPROC_T *p)
 {
-	struct sockaddr_in *msad, *sad, *ssd;
-	struct sockaddr_in6 *msad6, *sad6, *ssd6;
+	struct sockaddr_in *msad, *sad;
+	struct sockaddr_in6 *msad6, *sad6;
 	struct nfsclclient *clp;
 	struct nfssockreq *nrp;
 	struct nfsclds *dsp, *tdsp;
@@ -5232,10 +5240,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 	NFSUNLOCKCLSTATE();
 	if (clp == NULL)
 		return (EPERM);
-	if (ssp->ss_family == AF_INET) {
-		ssd = (struct sockaddr_in *)ssp;
+	if (af == AF_INET) {
 		NFSLOCKMNT(nmp);
-
 		/*
 		 * Check to see if we already have a session for this
 		 * address that is usable for a DS.
@@ -5246,8 +5252,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 		tdsp = TAILQ_FIRST(&nmp->nm_sess);
 		while (tdsp != NULL) {
 			if (msad != NULL && msad->sin_family == AF_INET &&
-			    ssd->sin_addr.s_addr == msad->sin_addr.s_addr &&
-			    ssd->sin_port == msad->sin_port &&
+			    sin->sin_addr.s_addr == msad->sin_addr.s_addr &&
+			    sin->sin_port == msad->sin_port &&
 			    (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 &&
 			    tdsp->nfsclds_sess.nfsess_defunct == 0) {
 				*dspp = tdsp;
@@ -5268,14 +5274,12 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 		sad = malloc(sizeof(*sad), M_SONAME, M_WAITOK | M_ZERO);
 		sad->sin_len = sizeof(*sad);
 		sad->sin_family = AF_INET;
-		sad->sin_port = ssd->sin_port;
-		sad->sin_addr.s_addr = ssd->sin_addr.s_addr;
+		sad->sin_port = sin->sin_port;
+		sad->sin_addr.s_addr = sin->sin_addr.s_addr;
 		nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO);
 		nrp->nr_nam = (struct sockaddr *)sad;
-	} else if (ssp->ss_family == AF_INET6) {
-		ssd6 = (struct sockaddr_in6 *)ssp;
+	} else if (af == AF_INET6) {
 		NFSLOCKMNT(nmp);
-
 		/*
 		 * Check to see if we already have a session for this
 		 * address that is usable for a DS.
@@ -5286,9 +5290,9 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 		tdsp = TAILQ_FIRST(&nmp->nm_sess);
 		while (tdsp != NULL) {
 			if (msad6 != NULL && msad6->sin6_family == AF_INET6 &&
-			    IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr,
+			    IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr,
 			    &msad6->sin6_addr) &&
-			    ssd6->sin6_port == msad6->sin6_port &&
+			    sin6->sin6_port == msad6->sin6_port &&
 			    (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 &&
 			    tdsp->nfsclds_sess.nfsess_defunct == 0) {
 				*dspp = tdsp;
@@ -5308,8 +5312,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 		sad6 = malloc(sizeof(*sad6), M_SONAME, M_WAITOK | M_ZERO);
 		sad6->sin6_len = sizeof(*sad6);
 		sad6->sin6_family = AF_INET6;
-		sad6->sin6_port = ssd6->sin6_port;
-		NFSBCOPY(&ssd6->sin6_addr, &sad6->sin6_addr,
+		sad6->sin6_port = sin6->sin6_port;
+		NFSBCOPY(&sin6->sin6_addr, &sad6->sin6_addr,
 		    sizeof(struct in6_addr));
 		nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO);
 		nrp->nr_nam = (struct sockaddr *)sad6;
@@ -5319,7 +5323,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, struct sockaddr_st
 	nrp->nr_sotype = SOCK_STREAM;
 	mtx_init(&nrp->nr_mtx, "nfssock", NULL, MTX_DEF);
 	nrp->nr_prog = NFS_PROG;
-	nrp->nr_vers = NFS_VER4;
+	nrp->nr_vers = vers;
 
 	/*
 	 * Use the credentials that were used for the mount, which are

Modified: projects/runtime-coverage/sys/i386/i386/db_trace.c
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/db_trace.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/db_trace.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -326,7 +326,8 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st
 		else if (strncmp(name, "Xatpic_intr", 11) == 0 ||
 		    strncmp(name, "Xapic_isr", 9) == 0)
 			frame_type = INTERRUPT;
-		else if (strcmp(name, "Xint0x80_syscall") == 0)
+		else if (strcmp(name, "Xlcall_syscall") == 0 ||
+		    strcmp(name, "Xint0x80_syscall") == 0)
 			frame_type = SYSCALL;
 		else if (strcmp(name, "dblfault_handler") == 0)
 			frame_type = DOUBLE_FAULT;

Modified: projects/runtime-coverage/sys/i386/i386/exception.s
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/exception.s	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/exception.s	Fri Sep 29 04:24:13 2017	(r324096)
@@ -98,16 +98,15 @@ MCOUNT_LABEL(user)
 MCOUNT_LABEL(btrap)
 
 #define	TRAP(a)		pushl $(a) ; jmp alltraps
-#define	TRAP_NOEN(a)	pushl $(a) ; jmp alltraps_noen
 
 IDTVEC(div)
 	pushl $0; TRAP(T_DIVIDE)
 IDTVEC(dbg)
-	pushl $0; TRAP_NOEN(T_TRCTRAP)
+	pushl $0; TRAP(T_TRCTRAP)
 IDTVEC(nmi)
-	pushl $0; TRAP_NOEN(T_NMI)
+	pushl $0; TRAP(T_NMI)
 IDTVEC(bpt)
-	pushl $0; TRAP_NOEN(T_BPTFLT)
+	pushl $0; TRAP(T_BPTFLT)
 IDTVEC(dtrace_ret)
 	pushl $0; TRAP(T_DTRACE_RET)
 IDTVEC(ofl)
@@ -131,7 +130,7 @@ IDTVEC(stk)
 IDTVEC(prot)
 	TRAP(T_PROTFLT)
 IDTVEC(page)
-	TRAP_NOEN(T_PAGEFLT)
+	TRAP(T_PAGEFLT)
 IDTVEC(mchk)
 	pushl $0; TRAP(T_MCHK)
 IDTVEC(rsvd)
@@ -143,21 +142,6 @@ IDTVEC(align)
 IDTVEC(xmm)
 	pushl $0; TRAP(T_XMMFLT)
 
-	SUPERALIGN_TEXT
-	.globl	alltraps_noen
-alltraps_noen:
-	pushal
-	pushl	$0
-	movw	%ds,(%esp)
-	pushl	$0
-	movw	%es,(%esp)
-	pushl	$0
-	movw	%fs,(%esp)
-	SET_KERNEL_SREGS
-	cld
-	FAKE_MCOUNT(TF_EIP(%esp))
-	jmp	calltrap
-	
 	/*
 	 * All traps except ones for syscalls jump to alltraps.  If
 	 * interrupts were enabled when the trap occurred, then interrupts
@@ -180,7 +164,6 @@ alltraps:
 	movw	%fs,(%esp)
 alltraps_with_regs_pushed:
 	SET_KERNEL_SREGS
-	sti
 	cld
 	FAKE_MCOUNT(TF_EIP(%esp))
 calltrap:
@@ -242,6 +225,40 @@ norm_ill:
 #endif
 
 /*
+ * Call gate entry for syscalls (lcall 7,0).
+ * This is used by FreeBSD 1.x a.out executables and "old" NetBSD executables.
+ *
+ * The intersegment call has been set up to specify one dummy parameter.
+ * This leaves a place to put eflags so that the call frame can be
+ * converted to a trap frame. Note that the eflags is (semi-)bogusly
+ * pushed into (what will be) tf_err and then copied later into the
+ * final spot. It has to be done this way because esp can't be just
+ * temporarily altered for the pushfl - an interrupt might come in
+ * and clobber the saved cs/eip.
+ */
+	SUPERALIGN_TEXT
+IDTVEC(lcall_syscall)
+	pushfl				/* save eflags */
+	popl	8(%esp)			/* shuffle into tf_eflags */
+	pushl	$7			/* sizeof "lcall 7,0" */
+	pushl	$0			/* tf_trapno */
+	pushal
+	pushl	$0
+	movw	%ds,(%esp)
+	pushl	$0
+	movw	%es,(%esp)
+	pushl	$0
+	movw	%fs,(%esp)
+	SET_KERNEL_SREGS
+	cld
+	FAKE_MCOUNT(TF_EIP(%esp))
+	pushl	%esp
+	call	syscall
+	add	$4, %esp
+	MEXITCOUNT
+	jmp	doreti
+
+/*
  * Trap gate entry for syscalls (int 0x80).
  * This is used by FreeBSD ELF executables, "new" NetBSD executables, and all
  * Linux executables.
@@ -262,7 +279,6 @@ IDTVEC(int0x80_syscall)
 	pushl	$0
 	movw	%fs,(%esp)
 	SET_KERNEL_SREGS
-	sti
 	cld
 	FAKE_MCOUNT(TF_EIP(%esp))
 	pushl	%esp
@@ -346,7 +362,7 @@ doreti_next:
 #ifdef HWPMC_HOOKS
 	je	doreti_nmi
 #else
-	je	doreti_notvm86
+	je	doreti_exit
 #endif
 	/*
 	 * PSL_VM must be checked first since segment registers only
@@ -362,7 +378,7 @@ doreti_next:
 
 doreti_notvm86:
 	testb	$SEL_RPL_MASK,TF_CS(%esp) /* are we returning to user mode? */
-	jz	doreti_nosegs		/* can't handle ASTs now if not */
+	jz	doreti_exit		/* can't handle ASTs now if not */
 
 doreti_ast:
 	/*
@@ -399,12 +415,6 @@ doreti_popl_es:
 	.globl	doreti_popl_ds
 doreti_popl_ds:
 	popl	%ds
-	jmp	doreti_iret_popal
-
-doreti_nosegs:
-	MEXITCOUNT
-	addl	$12,%esp
-doreti_iret_popal:
 	popal
 	addl	$8,%esp
 	.globl	doreti_iret
@@ -415,8 +425,16 @@ doreti_iret:
 	 * doreti_iret_fault and friends.  Alternative return code for
 	 * the case where we get a fault in the doreti_exit code
 	 * above.  trap() (i386/i386/trap.c) catches this specific
-	 * case, sends the process a signal and continues in the
-	 * corresponding place in the code below.
+	 * case, and continues in the corresponding place in the code
+	 * below.
+	 *
+	 * If the fault occured during return to usermode, we recreate
+	 * the trap frame and call trap() to send a signal.  Otherwise
+	 * the kernel was tricked into fault by attempt to restore invalid
+	 * usermode segment selectors on return from nested fault or
+	 * interrupt, where interrupted kernel entry code not yet loaded
+	 * kernel selectors.  In the latter case, emulate iret and zero
+	 * the invalid selector.
 	 */
 	ALIGN_TEXT
 	.globl	doreti_iret_fault
@@ -427,18 +445,35 @@ doreti_iret_fault:
 	movw	%ds,(%esp)
 	.globl	doreti_popl_ds_fault
 doreti_popl_ds_fault:
+	testb	$SEL_RPL_MASK,TF_CS-TF_DS(%esp)
+	jz	doreti_popl_ds_kfault
 	pushl	$0
 	movw	%es,(%esp)
 	.globl	doreti_popl_es_fault
 doreti_popl_es_fault:
+	testb	$SEL_RPL_MASK,TF_CS-TF_ES(%esp)
+	jz	doreti_popl_es_kfault
 	pushl	$0
 	movw	%fs,(%esp)
 	.globl	doreti_popl_fs_fault
 doreti_popl_fs_fault:
+	testb	$SEL_RPL_MASK,TF_CS-TF_FS(%esp)
+	jz	doreti_popl_fs_kfault
 	sti
 	movl	$0,TF_ERR(%esp)	/* XXX should be the error code */
 	movl	$T_PROTFLT,TF_TRAPNO(%esp)
 	jmp	alltraps_with_regs_pushed
+
+doreti_popl_ds_kfault:
+	movl	$0,(%esp)
+	jmp	doreti_popl_ds
+doreti_popl_es_kfault:
+	movl	$0,(%esp)
+	jmp	doreti_popl_es
+doreti_popl_fs_kfault:
+	movl	$0,(%esp)
+	jmp	doreti_popl_fs
+	
 #ifdef HWPMC_HOOKS
 doreti_nmi:
 	/*
@@ -447,7 +482,7 @@ doreti_nmi:
 	 * needs a user call chain capture.
 	 */
 	testb	$SEL_RPL_MASK,TF_CS(%esp)
-	jz	doreti_nosegs
+	jz	doreti_exit
 	movl	PCPU(CURTHREAD),%eax	/* curthread present? */
 	orl	%eax,%eax
 	jz	doreti_exit

Modified: projects/runtime-coverage/sys/i386/i386/genassym.c
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/genassym.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/genassym.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -156,11 +156,15 @@ ASSYM(PCB_IDT, offsetof(struct pcb, pcb_idt));
 ASSYM(PCB_LDT, offsetof(struct pcb, pcb_ldt));
 ASSYM(PCB_TR, offsetof(struct pcb, pcb_tr));
 
+ASSYM(TF_FS, offsetof(struct trapframe, tf_fs));
+ASSYM(TF_ES, offsetof(struct trapframe, tf_es));
+ASSYM(TF_DS, offsetof(struct trapframe, tf_ds));
 ASSYM(TF_TRAPNO, offsetof(struct trapframe, tf_trapno));
 ASSYM(TF_ERR, offsetof(struct trapframe, tf_err));
 ASSYM(TF_EIP, offsetof(struct trapframe, tf_eip));
 ASSYM(TF_CS, offsetof(struct trapframe, tf_cs));
 ASSYM(TF_EFLAGS, offsetof(struct trapframe, tf_eflags));
+
 ASSYM(SIGF_HANDLER, offsetof(struct sigframe, sf_ahu.sf_handler));
 #ifdef COMPAT_43
 ASSYM(SIGF_SC, offsetof(struct osigframe, sf_siginfo.si_sc));

Modified: projects/runtime-coverage/sys/i386/i386/locore.s
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/locore.s	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/locore.s	Fri Sep 29 04:24:13 2017	(r324096)
@@ -335,44 +335,6 @@ osigcode:
 	pushl	%eax			/* junk to fake return addr. */
 	int	$0x80			/* enter kernel with args */
 0:	jmp	0b
-
-/*
- * The lcall $7,$0 handler cannot use the call gate that does an
- * inter-privilege transition. The reason is that the call gate
- * does not disable interrupts, and, before the kernel segment registers
- * are loaded, we would have a window where the ring 0 code is
- * executed with the wrong segments.
- *
- * Instead, set LDT descriptor 0 as code segment, which reflects
- * the lcall $7,$0 back to ring 3 trampoline.  The trampoline sets up
- * the frame for int $0x80.
- */
-	ALIGN_TEXT
-lcall_tramp:
-	cmpl	$SYS_vfork,%eax
-	je	1f
-	pushl	%ebp
-	movl	%esp,%ebp
-	pushl	0x24(%ebp) /* arg 6 */
-	pushl	0x20(%ebp)
-	pushl	0x1c(%ebp)
-	pushl	0x18(%ebp)
-	pushl	0x14(%ebp)
-	pushl	0x10(%ebp) /* arg 1 */
-	subl	$4,%esp   /* gap */
-	int	$0x80
-	leavel
-	lretl
-1:
-	/*
-	 * vfork handling is special and relies on the libc stub saving
-	 * the return ip in %ecx.  Also, we assume that the call was done
-	 * with ucode32 selector in %cs.
-	 */
-	int	$0x80
-	movl	$0x33,4(%esp)	/* GUCODE32_SEL | SEL_UPL */
-	movl	%ecx,(%esp)
-	lretl
 #endif /* COMPAT_43 */
 
 	ALIGN_TEXT
@@ -391,9 +353,6 @@ szfreebsd4_sigcode:
 	.globl	szosigcode
 szosigcode:
 	.long	esigcode-osigcode
-	.globl	szlcallcode
-szlcallcode:
-	.long	esigcode-lcall_tramp
 #endif
 	.text
 

Modified: projects/runtime-coverage/sys/i386/i386/machdep.c
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/machdep.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/machdep.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -1513,7 +1513,7 @@ extern inthand_t
 #ifdef XENHVM
 	IDTVEC(xen_intr_upcall),
 #endif
-	IDTVEC(int0x80_syscall);
+	IDTVEC(lcall_syscall), IDTVEC(int0x80_syscall);
 
 #ifdef DDB
 /*
@@ -2157,9 +2157,7 @@ i386_kdb_init(void)
 register_t
 init386(int first)
 {
-#ifdef COMPAT_43
-	struct segment_descriptor *gdp;
-#endif
+	struct gate_descriptor *gdp;
 	int gsel_tss, metadata_missing, x, pa;
 	struct pcpu *pc;
 	struct xstate_hdr *xhdr;
@@ -2248,9 +2246,9 @@ init386(int first)
 
 	/* exceptions */
 	for (x = 0; x < NIDT; x++)
-		setidt(x, &IDTVEC(rsvd), SDT_SYS386IGT, SEL_KPL,
+		setidt(x, &IDTVEC(rsvd), SDT_SYS386TGT, SEL_KPL,
 		    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_DE, &IDTVEC(div),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_DE, &IDTVEC(div),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 	setidt(IDT_DB, &IDTVEC(dbg),  SDT_SYS386IGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
@@ -2258,39 +2256,39 @@ init386(int first)
 	    GSEL(GCODE_SEL, SEL_KPL));
  	setidt(IDT_BP, &IDTVEC(bpt),  SDT_SYS386IGT, SEL_UPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_OF, &IDTVEC(ofl),  SDT_SYS386IGT, SEL_UPL,
+	setidt(IDT_OF, &IDTVEC(ofl),  SDT_SYS386TGT, SEL_UPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_BR, &IDTVEC(bnd),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_BR, &IDTVEC(bnd),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_UD, &IDTVEC(ill),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_UD, &IDTVEC(ill),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_NM, &IDTVEC(dna),  SDT_SYS386IGT, SEL_KPL
+	setidt(IDT_NM, &IDTVEC(dna),  SDT_SYS386TGT, SEL_KPL
 	    , GSEL(GCODE_SEL, SEL_KPL));
 	setidt(IDT_DF, 0,  SDT_SYSTASKGT, SEL_KPL, GSEL(GPANIC_SEL, SEL_KPL));
-	setidt(IDT_FPUGP, &IDTVEC(fpusegm),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_FPUGP, &IDTVEC(fpusegm),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_TS, &IDTVEC(tss),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_TS, &IDTVEC(tss),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_NP, &IDTVEC(missing),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_NP, &IDTVEC(missing),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_SS, &IDTVEC(stk),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_SS, &IDTVEC(stk),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_GP, &IDTVEC(prot),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_GP, &IDTVEC(prot),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 	setidt(IDT_PF, &IDTVEC(page),  SDT_SYS386IGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_MF, &IDTVEC(fpu),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_MF, &IDTVEC(fpu),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_AC, &IDTVEC(align), SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_AC, &IDTVEC(align), SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_MC, &IDTVEC(mchk),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_MC, &IDTVEC(mchk),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_XF, &IDTVEC(xmm), SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_XF, &IDTVEC(xmm), SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
- 	setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386IGT, SEL_UPL,
+ 	setidt(IDT_SYSCALL, &IDTVEC(int0x80_syscall), SDT_SYS386TGT, SEL_UPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 #ifdef KDTRACE_HOOKS
-	setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386IGT, SEL_UPL,
+	setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYS386TGT, SEL_UPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 #endif
 #ifdef XENHVM
@@ -2331,9 +2329,9 @@ init386(int first)
 	clock_init();
 
 	finishidentcpu();	/* Final stage of CPU initialization */
-	setidt(IDT_UD, &IDTVEC(ill),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_UD, &IDTVEC(ill),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
-	setidt(IDT_GP, &IDTVEC(prot),  SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_GP, &IDTVEC(prot),  SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 	initializecpu();	/* Initialize CPU registers */
 	initializecpucache();
@@ -2438,21 +2436,17 @@ init386(int first)
 	gdt[GPROC0_SEL].sd.sd_type = SDT_SYS386TSS;	/* clear busy bit */
 	ltr(gsel_tss);
 
-#ifdef COMPAT_43
-	/*
-	 * Make a code descriptor to emulate lcall $7,$0 with int
-	 * $0x80.  sd_hibase and sd_lobase are set after the sigtramp
-	 * base in the shared table is known.
-	 */
-	gdp = &ldt[LSYS5CALLS_SEL].sd;
-	gdp->sd_type = SDT_MEMERA;
-	gdp->sd_dpl = SEL_UPL;
-	gdp->sd_p = 1;
-	gdp->sd_def32 = 1;
-	gdp->sd_gran = 1;
-	gdp->sd_lolimit = 0xffff;
-	gdp->sd_hilimit = 0xf;
-#endif
+	/* make a call gate to reenter kernel with */
+	gdp = &ldt[LSYS5CALLS_SEL].gd;
+
+	x = (int) &IDTVEC(lcall_syscall);
+	gdp->gd_looffset = x;
+	gdp->gd_selector = GSEL(GCODE_SEL,SEL_KPL);
+	gdp->gd_stkcpy = 1;
+	gdp->gd_type = SDT_SYS386CGT;
+	gdp->gd_dpl = SEL_UPL;
+	gdp->gd_p = 1;
+	gdp->gd_hioffset = x >> 16;
 
 	/* transfer to user mode */
 

Modified: projects/runtime-coverage/sys/i386/i386/trap.c
==============================================================================
--- projects/runtime-coverage/sys/i386/i386/trap.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/i386/trap.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -114,6 +114,8 @@ static int trap_pfault(struct trapframe *, int, vm_off
 static void trap_fatal(struct trapframe *, vm_offset_t);
 void dblfault_handler(void);
 
+extern inthand_t IDTVEC(lcall_syscall);
+
 #define MAX_TRAP_MSG		32
 static char *trap_msg[] = {
 	"",					/*  0 unused */
@@ -627,6 +629,23 @@ user_trctrap_out:
 
 		case T_TRCTRAP:	 /* trace trap */
 kernel_trctrap:
+			if (frame->tf_eip == (int)IDTVEC(lcall_syscall)) {
+				/*
+				 * We've just entered system mode via the
+				 * syscall lcall.  Continue single stepping
+				 * silently until the syscall handler has
+				 * saved the flags.
+				 */
+				return;
+			}
+			if (frame->tf_eip == (int)IDTVEC(lcall_syscall) + 1) {
+				/*
+				 * The syscall handler has now saved the
+				 * flags.  Stop single stepping it.
+				 */
+				frame->tf_eflags &= ~PSL_T;
+				return;
+			}
 			/*
 			 * Ignore debug register trace traps due to
 			 * accesses in the user's address space, which

Modified: projects/runtime-coverage/sys/i386/include/asmacros.h
==============================================================================
--- projects/runtime-coverage/sys/i386/include/asmacros.h	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/include/asmacros.h	Fri Sep 29 04:24:13 2017	(r324096)
@@ -153,13 +153,6 @@
 	pushl	$0 ;							\
 	movw	%fs,(%esp)
 	
-#define	POP_FRAME							\
-	popl	%fs ;							\
-	popl	%es ;							\
-	popl	%ds ;							\
-	popal ;								\
-	addl	$4+4,%esp
-
 /*
  * Access per-CPU data.
  */

Modified: projects/runtime-coverage/sys/i386/include/md_var.h
==============================================================================
--- projects/runtime-coverage/sys/i386/include/md_var.h	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/include/md_var.h	Fri Sep 29 04:24:13 2017	(r324096)
@@ -43,7 +43,6 @@ extern	int	szfreebsd4_sigcode;
 #endif
 #ifdef COMPAT_43
 extern	int	szosigcode;
-extern	int	szlcallcode;
 #endif
 extern	uint32_t *vm_page_dump;
 

Modified: projects/runtime-coverage/sys/i386/isa/npx.c
==============================================================================
--- projects/runtime-coverage/sys/i386/isa/npx.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/i386/isa/npx.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -237,7 +237,7 @@ npx_probe(void)
 	}
 
 	save_idt_npxtrap = idt[IDT_MF];
-	setidt(IDT_MF, probetrap, SDT_SYS386IGT, SEL_KPL,
+	setidt(IDT_MF, probetrap, SDT_SYS386TGT, SEL_KPL,
 	    GSEL(GCODE_SEL, SEL_KPL));
 
 	/*

Modified: projects/runtime-coverage/sys/kern/imgact_aout.c
==============================================================================
--- projects/runtime-coverage/sys/kern/imgact_aout.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/kern/imgact_aout.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -27,8 +27,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include "opt_compat.h"
-
 #include <sys/param.h>
 #include <sys/exec.h>
 #include <sys/imgact.h>
@@ -339,18 +337,3 @@ exec_aout_imgact(struct image_params *imgp)
  */
 static struct execsw aout_execsw = { exec_aout_imgact, "a.out" };
 EXEC_SET(aout, aout_execsw);
-
-#if defined(__i386__) && defined(COMPAT_43)
-static void
-exec_init_lcall(void *arg __unused)
-{
-	struct segment_descriptor *gdp;
-	u_int lcall_addr;
-
-	gdp = &ldt[LSYS5CALLS_SEL].sd;
-	lcall_addr = aout_sysvec.sv_psstrings - szlcallcode;
-	gdp->sd_hibase = lcall_addr >> 24;
-	gdp->sd_lobase = lcall_addr;
-}
-SYSINIT(aout, SI_SUB_EXEC + 1, SI_ORDER_ANY, exec_init_lcall, NULL);
-#endif

Modified: projects/runtime-coverage/sys/netgraph/ng_iface.c
==============================================================================
--- projects/runtime-coverage/sys/netgraph/ng_iface.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/netgraph/ng_iface.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -59,6 +59,7 @@
 #include <sys/systm.h>
 #include <sys/errno.h>
 #include <sys/kernel.h>
+#include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mbuf.h>
 #include <sys/errno.h>

Modified: projects/runtime-coverage/sys/vm/vm_object.c
==============================================================================
--- projects/runtime-coverage/sys/vm/vm_object.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/sys/vm/vm_object.c	Fri Sep 29 04:24:13 2017	(r324096)
@@ -1990,7 +1990,8 @@ again:
 			goto again;
 		}
 		if (p->wire_count != 0) {
-			if ((options & OBJPR_NOTMAPPED) == 0)
+			if ((options & OBJPR_NOTMAPPED) == 0 &&
+			    object->ref_count != 0)
 				pmap_remove_all(p);
 			if ((options & OBJPR_CLEANONLY) == 0) {
 				p->valid = 0;
@@ -2007,12 +2008,13 @@ again:
 		KASSERT((p->flags & PG_FICTITIOUS) == 0,
 		    ("vm_object_page_remove: page %p is fictitious", p));
 		if ((options & OBJPR_CLEANONLY) != 0 && p->valid != 0) {
-			if ((options & OBJPR_NOTMAPPED) == 0)
+			if ((options & OBJPR_NOTMAPPED) == 0 &&
+			    object->ref_count != 0)
 				pmap_remove_write(p);
-			if (p->dirty)
+			if (p->dirty != 0)
 				continue;
 		}
-		if ((options & OBJPR_NOTMAPPED) == 0)
+		if ((options & OBJPR_NOTMAPPED) == 0 && object->ref_count != 0)
 			pmap_remove_all(p);
 		p->flags &= ~PG_ZERO;
 		if (vm_page_free_prep(p, false))

Modified: projects/runtime-coverage/usr.sbin/config/config.h
==============================================================================
--- projects/runtime-coverage/usr.sbin/config/config.h	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/usr.sbin/config/config.h	Fri Sep 29 04:24:13 2017	(r324096)
@@ -152,7 +152,7 @@ struct includepath {
 SLIST_HEAD(, includepath) includepath;
 
 /*
- * Tag present in the kernelconf.tmlp template file. It's mandatory for those
+ * Tag present in the kernconf.tmpl template file. It's mandatory for those
  * two strings to be the same. Otherwise you'll get into trouble.
  */
 #define	KERNCONFTAG	"%%KERNCONFFILE%%"

Modified: projects/runtime-coverage/usr.sbin/diskinfo/diskinfo.c
==============================================================================
--- projects/runtime-coverage/usr.sbin/diskinfo/diskinfo.c	Fri Sep 29 01:19:22 2017	(r324095)
+++ projects/runtime-coverage/usr.sbin/diskinfo/diskinfo.c	Fri Sep 29 04:24:13 2017	(r324096)

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709290424.v8T4ODef036253>