svn commit: r346058 - in projects/runtime-coverage-v2: . lib/libc/string lib/libc/sys share/man/man7 sys/dev/usb/net sys/kern tests/sys/geom/class/eli tools/tools/ioat

Enji Cooper ngie at FreeBSD.org
Tue Apr 9 16:31:33 UTC 2019


Author: ngie
Date: Tue Apr  9 16:31:30 2019
New Revision: 346058
URL: https://svnweb.freebsd.org/changeset/base/346058

Log:
  MFhead at r346057

Modified:
  projects/runtime-coverage-v2/Makefile
  projects/runtime-coverage-v2/lib/libc/string/strstr.c
  projects/runtime-coverage-v2/lib/libc/sys/procctl.2
  projects/runtime-coverage-v2/share/man/man7/hostname.7
  projects/runtime-coverage-v2/sys/dev/usb/net/if_ure.c
  projects/runtime-coverage-v2/sys/kern/imgact_elf.c
  projects/runtime-coverage-v2/tests/sys/geom/class/eli/online_resize_test.sh
  projects/runtime-coverage-v2/tools/tools/ioat/ioatcontrol.c
Directory Properties:
  projects/runtime-coverage-v2/   (props changed)

Modified: projects/runtime-coverage-v2/Makefile
==============================================================================
--- projects/runtime-coverage-v2/Makefile	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/Makefile	Tue Apr  9 16:31:30 2019	(r346058)
@@ -570,7 +570,7 @@ universe-toolchain: .PHONY universe_prologue
 	    false; \
 	fi
 	@if [ ! -e "${HOST_OBJTOP}/tmp/usr/bin/ld" ]; then \
-	    echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/cc?" >&2; \
+	    echo "Missing host linker at ${HOST_OBJTOP}/tmp/usr/bin/ld?" >&2; \
 	    false; \
 	fi
 	@echo "--------------------------------------------------------------"

Modified: projects/runtime-coverage-v2/lib/libc/string/strstr.c
==============================================================================
--- projects/runtime-coverage-v2/lib/libc/string/strstr.c	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/lib/libc/string/strstr.c	Tue Apr  9 16:31:30 2019	(r346058)
@@ -143,9 +143,8 @@ static char *twoway_strstr(const unsigned char *h, con
 		/* Check last byte first; advance by shift on mismatch */
 		if (BITOP(byteset, h[l-1], &)) {
 			k = l-shift[h[l-1]];
-			//printf("adv by %zu (on %c) at [%s] (%zu;l=%zu)\n", k, h[l-1], h, shift[h[l-1]], l);
 			if (k) {
-				if (mem0 && mem && k < p) k = l-p;
+				if (k < mem) k = mem;
 				h += k;
 				mem = 0;
 				continue;

Modified: projects/runtime-coverage-v2/lib/libc/sys/procctl.2
==============================================================================
--- projects/runtime-coverage-v2/lib/libc/sys/procctl.2	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/lib/libc/sys/procctl.2	Tue Apr  9 16:31:30 2019	(r346058)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 23, 2019
+.Dd April 9, 2019
 .Dt PROCCTL 2
 .Os
 .Sh NAME
@@ -570,6 +570,8 @@ or invalid signal number.
 .El
 .Sh SEE ALSO
 .Xr dtrace 1 ,
+.Xr proccontrol 1 ,
+.Xr protect 1 ,
 .Xr cap_enter 2,
 .Xr kill 2 ,
 .Xr ktrace 2 ,

Modified: projects/runtime-coverage-v2/share/man/man7/hostname.7
==============================================================================
--- projects/runtime-coverage-v2/share/man/man7/hostname.7	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/share/man/man7/hostname.7	Tue Apr  9 16:31:30 2019	(r346058)
@@ -81,7 +81,7 @@ by a system-wide configuration file (see
 .Xr resolver 5 ) .
 .Sh SEE ALSO
 .Xr gethostbyname 3 ,
-.Xr resolver 5 ,
+.Xr resolver 5
 .Sh HISTORY
 .Nm Hostname
 appeared in

Modified: projects/runtime-coverage-v2/sys/dev/usb/net/if_ure.c
==============================================================================
--- projects/runtime-coverage-v2/sys/dev/usb/net/if_ure.c	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/sys/dev/usb/net/if_ure.c	Tue Apr  9 16:31:30 2019	(r346058)
@@ -62,6 +62,9 @@ SYSCTL_INT(_hw_usb_ure, OID_AUTO, debug, CTLFLAG_RWTUN
     "Debug level");
 #endif
 
+#define	ETHER_IS_ZERO(addr) \
+	(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
+
 /*
  * Various supported device vendors/products.
  */
@@ -673,12 +676,20 @@ ure_attach_post(struct usb_ether *ue)
 	else
 		ure_rtl8153_init(sc);
 
-	if (sc->sc_chip & URE_CHIP_VER_4C00)
+	if ((sc->sc_chip & URE_CHIP_VER_4C00) ||
+	    (sc->sc_chip & URE_CHIP_VER_4C10))
 		ure_read_mem(sc, URE_PLA_IDR, URE_MCU_TYPE_PLA,
 		    ue->ue_eaddr, 8);
 	else
 		ure_read_mem(sc, URE_PLA_BACKUP, URE_MCU_TYPE_PLA,
 		    ue->ue_eaddr, 8);
+
+	if (ETHER_IS_ZERO(sc->sc_ue.ue_eaddr)) {
+		device_printf(sc->sc_ue.ue_dev, "MAC assigned randomly\n");
+		arc4rand(sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN, 0);
+		sc->sc_ue.ue_eaddr[0] &= ~0x01; /* unicast */
+		sc->sc_ue.ue_eaddr[0] |= 0x02;  /* locally administered */
+	}
 }
 
 static int
@@ -724,8 +735,10 @@ ure_init(struct usb_ether *ue)
 	ure_reset(sc);
 
 	/* Set MAC address. */
+	ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_CONFIG);
 	ure_write_mem(sc, URE_PLA_IDR, URE_MCU_TYPE_PLA | URE_BYTE_EN_SIX_BYTES,
 	    IF_LLADDR(ifp), 8);
+	ure_write_1(sc, URE_PLA_CRWECR, URE_MCU_TYPE_PLA, URE_CRWECR_NORAML);
 
 	/* Reset the packet filter. */
 	ure_write_2(sc, URE_PLA_FMC, URE_MCU_TYPE_PLA,

Modified: projects/runtime-coverage-v2/sys/kern/imgact_elf.c
==============================================================================
--- projects/runtime-coverage-v2/sys/kern/imgact_elf.c	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/sys/kern/imgact_elf.c	Tue Apr  9 16:31:30 2019	(r346058)
@@ -649,6 +649,45 @@ __elfN(load_section)(struct image_params *imgp, vm_oof
 	return (0);
 }
 
+static int
+__elfN(load_sections)(struct image_params *imgp, const Elf_Ehdr *hdr,
+    const Elf_Phdr *phdr, u_long rbase, u_long *base_addrp)
+{
+	vm_prot_t prot;
+	u_long base_addr;
+	bool first;
+	int error, i;
+
+	base_addr = 0;
+	first = true;
+
+	for (i = 0; i < hdr->e_phnum; i++) {
+		if (phdr[i].p_type != PT_LOAD || phdr[i].p_memsz == 0)
+			continue;
+
+		/* Loadable segment */
+		prot = __elfN(trans_prot)(phdr[i].p_flags);
+		error = __elfN(load_section)(imgp, phdr[i].p_offset,
+		    (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase,
+		    phdr[i].p_memsz, phdr[i].p_filesz, prot);
+		if (error != 0)
+			return (error);
+
+		/*
+		 * Establish the base address if this is the first segment.
+		 */
+		if (first) {
+  			base_addr = trunc_page(phdr[i].p_vaddr + rbase);
+			first = false;
+		}
+	}
+
+	if (base_addrp != NULL)
+		*base_addrp = base_addr;
+
+	return (0);
+}
+
 /*
  * Load the file "file" into memory.  It may be either a shared object
  * or an executable.
@@ -675,10 +714,9 @@ __elfN(load_file)(struct proc *p, const char *file, u_
 	struct nameidata *nd;
 	struct vattr *attr;
 	struct image_params *imgp;
-	vm_prot_t prot;
 	u_long rbase;
 	u_long base_addr = 0;
-	int error, i, numsegs;
+	int error;
 
 #ifdef CAPABILITY_MODE
 	/*
@@ -756,25 +794,10 @@ __elfN(load_file)(struct proc *p, const char *file, u_
 		goto fail;
 	}
 
-	for (i = 0, numsegs = 0; i < hdr->e_phnum; i++) {
-		if (phdr[i].p_type == PT_LOAD && phdr[i].p_memsz != 0) {
-			/* Loadable segment */
-			prot = __elfN(trans_prot)(phdr[i].p_flags);
-			error = __elfN(load_section)(imgp, phdr[i].p_offset,
-			    (caddr_t)(uintptr_t)phdr[i].p_vaddr + rbase,
-			    phdr[i].p_memsz, phdr[i].p_filesz, prot);
-			if (error != 0)
-				goto fail;
-			/*
-			 * Establish the base address if this is the
-			 * first segment.
-			 */
-			if (numsegs == 0)
-  				base_addr = trunc_page(phdr[i].p_vaddr +
-				    rbase);
-			numsegs++;
-		}
-	}
+	error = __elfN(load_sections)(imgp, hdr, phdr, rbase, &base_addr);
+	if (error != 0)
+		goto fail;
+
 	*addr = base_addr;
 	*entry = (unsigned long)hdr->e_entry + rbase;
 
@@ -998,7 +1021,6 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
 	char *interp;
 	Elf_Brandinfo *brand_info;
 	struct sysentvec *sv;
-	vm_prot_t prot;
 	u_long addr, baddr, et_dyn_addr, entry, proghdr;
 	u_long maxalign, mapsz, maxv, maxv1;
 	uint32_t fctl0;
@@ -1055,6 +1077,17 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
 				maxalign = phdr[i].p_align;
 			mapsz += phdr[i].p_memsz;
 			n++;
+
+			/*
+			 * If this segment contains the program headers,
+			 * remember their virtual address for the AT_PHDR
+			 * aux entry. Static binaries don't usually include
+			 * a PT_PHDR entry.
+			 */
+			if (phdr[i].p_offset == 0 &&
+			    hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize
+				<= phdr[i].p_filesz)
+				proghdr = phdr[i].p_vaddr + hdr->e_phoff;
 			break;
 		case PT_INTERP:
 			/* Path to interpreter */
@@ -1074,6 +1107,9 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
 				    __elfN(trans_prot)(phdr[i].p_flags);
 			imgp->stack_sz = phdr[i].p_memsz;
 			break;
+		case PT_PHDR: 	/* Program header table info */
+			proghdr = phdr[i].p_vaddr;
+			break;
 		}
 	}
 
@@ -1174,38 +1210,10 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
 	if (error != 0)
 		goto ret;
 
-	for (i = 0; i < hdr->e_phnum; i++) {
-		switch (phdr[i].p_type) {
-		case PT_LOAD:	/* Loadable segment */
-			if (phdr[i].p_memsz == 0)
-				break;
-			prot = __elfN(trans_prot)(phdr[i].p_flags);
-			error = __elfN(load_section)(imgp, phdr[i].p_offset,
-			    (caddr_t)(uintptr_t)phdr[i].p_vaddr + et_dyn_addr,
-			    phdr[i].p_memsz, phdr[i].p_filesz, prot);
-			if (error != 0)
-				goto ret;
+	error = __elfN(load_sections)(imgp, hdr, phdr, et_dyn_addr, NULL);
+	if (error != 0)
+		goto ret;
 
-			/*
-			 * If this segment contains the program headers,
-			 * remember their virtual address for the AT_PHDR
-			 * aux entry. Static binaries don't usually include
-			 * a PT_PHDR entry.
-			 */
-			if (phdr[i].p_offset == 0 &&
-			    hdr->e_phoff + hdr->e_phnum * hdr->e_phentsize
-				<= phdr[i].p_filesz)
-				proghdr = phdr[i].p_vaddr + hdr->e_phoff +
-				    et_dyn_addr;
-			break;
-		case PT_PHDR: 	/* Program header table info */
-			proghdr = phdr[i].p_vaddr + et_dyn_addr;
-			break;
-		default:
-			break;
-		}
-	}
-
 	error = __elfN(enforce_limits)(imgp, hdr, phdr, et_dyn_addr);
 	if (error != 0)
 		goto ret;
@@ -1253,7 +1261,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i
 	 */
 	elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK);
 	elf_auxargs->execfd = -1;
-	elf_auxargs->phdr = proghdr;
+	elf_auxargs->phdr = proghdr + et_dyn_addr;
 	elf_auxargs->phent = hdr->e_phentsize;
 	elf_auxargs->phnum = hdr->e_phnum;
 	elf_auxargs->pagesz = PAGE_SIZE;

Modified: projects/runtime-coverage-v2/tests/sys/geom/class/eli/online_resize_test.sh
==============================================================================
--- projects/runtime-coverage-v2/tests/sys/geom/class/eli/online_resize_test.sh	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/tests/sys/geom/class/eli/online_resize_test.sh	Tue Apr  9 16:31:30 2019	(r346058)
@@ -172,22 +172,18 @@ online_resize_body()
 		atf_check -s exit:0 -o match:'^Flags: .*AUTORESIZE' geli list ${md}p1.eli
 		atf_check -s exit:0 -o match:resized gpart resize -i 1 -s 30${prefix} ${md}
 		atf_check -s exit:0 -o match:"^[[:space:]]${osize30}[[:space:]]+# mediasize in bytes" diskinfo -v ${md}p1.eli
-		atf_check geli detach ${md}p1.eli
-
-		# Cleanup.
-		atf_check -s exit:0 -o match:deleted gpart delete -i 1 ${md}
-		atf_check -s exit:0 -o match:destroyed gpart destroy ${md}
-		atf_check -s exit:0 -o ignore mdconfig -d -u ${md}
 	done
 }
 online_resize_cleanup()
 {
 	if [ -f "$TEST_MDS_FILE" ]; then
 		while read md; do
-			[ -c /dev/${md}p1.eli ] && geli detach ${md}p1.eli
-			mdconfig -d -u ${md} 2>/dev/null
+			atf_check -s ignore -e ignore -o ignore geli detach ${md}p1.eli
+			atf_check -s ignore -e ignore -o ignore gpart delete -i 1 ${md}
+			atf_check -s ignore -e ignore -o ignore gpart destroy ${md}
 		done < $TEST_MDS_FILE
 	fi
+	geli_test_cleanup
 }
 
 atf_init_test_cases()

Modified: projects/runtime-coverage-v2/tools/tools/ioat/ioatcontrol.c
==============================================================================
--- projects/runtime-coverage-v2/tools/tools/ioat/ioatcontrol.c	Tue Apr  9 16:20:36 2019	(r346057)
+++ projects/runtime-coverage-v2/tools/tools/ioat/ioatcontrol.c	Tue Apr  9 16:31:30 2019	(r346058)
@@ -49,7 +49,7 @@ static void
 usage(void)
 {
 
-	printf("Usage: %s [-c period] [-EfmVz] channel-number num-txns [<bufsize> "
+	printf("Usage: %s [-c period] [-EefmVxXz] channel-number num-txns [<bufsize> "
 	    "[<chain-len> [duration]]]\n", getprogname());
 	printf("       %s -r [-c period] [-vVwz] channel-number address [<bufsize>]\n\n",
 	    getprogname());
@@ -154,9 +154,11 @@ main(int argc, char **argv)
 			break;
 		case 'x':
 			xflag = true;
+			modeflags++;
 			break;
 		case 'X':
 			Xflag = true;
+			modeflags++;
 			break;
 		case 'z':
 			t.zero_stats = true;
@@ -172,7 +174,7 @@ main(int argc, char **argv)
 		usage();
 
 	if (modeflags > 1) {
-		printf("Invalid: Cannot use >1 mode flag (-E, -f, -m, or -r)\n");
+		printf("Invalid: Cannot use >1 mode flag (-E, -e, -f, -m, -r, -x or -X)\n");
 		usage();
 	}
 
@@ -191,7 +193,7 @@ main(int argc, char **argv)
 		t.testkind = IOAT_TEST_MEMCPY;
 	else if (xflag)
 		t.testkind = IOAT_TEST_DMA_CRC;
-	else if (xflag)
+	else if (Xflag)
 		t.testkind = IOAT_TEST_DMA_CRC_COPY;
 
 	t.channel_index = atoi(argv[0]);


More information about the svn-src-projects mailing list