Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Aug 2017 21:37:26 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r322676 - in projects/runtime-coverage: . bin/pkill contrib/binutils/bfd contrib/binutils/gas/config contrib/mdocml contrib/zstd/examples etc/periodic/daily etc/rc.d gnu/usr.bin/binutil...
Message-ID:  <201708182137.v7ILbQ5a045305@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Fri Aug 18 21:37:26 2017
New Revision: 322676
URL: https://svnweb.freebsd.org/changeset/base/322676

Log:
  MFhead@r322675

Added:
  projects/runtime-coverage/sys/amd64/include/sgx.h
     - copied unchanged from r322675, head/sys/amd64/include/sgx.h
  projects/runtime-coverage/sys/amd64/include/sgxreg.h
     - copied unchanged from r322675, head/sys/amd64/include/sgxreg.h
  projects/runtime-coverage/sys/amd64/sgx/
     - copied from r322675, head/sys/amd64/sgx/
  projects/runtime-coverage/sys/modules/sgx/
     - copied from r322675, head/sys/modules/sgx/
  projects/runtime-coverage/sys/modules/sgx_linux/
     - copied from r322675, head/sys/modules/sgx_linux/
Deleted:
  projects/runtime-coverage/contrib/zstd/examples/
Modified:
  projects/runtime-coverage/Makefile
  projects/runtime-coverage/Makefile.inc1
  projects/runtime-coverage/Makefile.libcompat
  projects/runtime-coverage/bin/pkill/pkill.c
  projects/runtime-coverage/contrib/binutils/bfd/ecoff.c
  projects/runtime-coverage/contrib/binutils/gas/config/tc-mips.c
  projects/runtime-coverage/contrib/mdocml/lib.in
  projects/runtime-coverage/etc/periodic/daily/Makefile
  projects/runtime-coverage/etc/rc.d/Makefile
  projects/runtime-coverage/gnu/usr.bin/binutils/Makefile.inc0
  projects/runtime-coverage/gnu/usr.bin/binutils/ld/Makefile.arm
  projects/runtime-coverage/gnu/usr.bin/binutils/libbfd/Makefile.arm
  projects/runtime-coverage/gnu/usr.bin/cc/Makefile.inc
  projects/runtime-coverage/gnu/usr.bin/cc/Makefile.tgt
  projects/runtime-coverage/lib/libc/i386/Makefile.inc
  projects/runtime-coverage/lib/libcompiler_rt/Makefile.inc
  projects/runtime-coverage/lib/libfetch/common.c
  projects/runtime-coverage/lib/libutil/kinfo_getvmmap.3
  projects/runtime-coverage/release/packages/kernel.ucl
  projects/runtime-coverage/release/packages/runtime.ucl
  projects/runtime-coverage/release/release.sh
  projects/runtime-coverage/sbin/route/route.8
  projects/runtime-coverage/share/man/man4/bge.4
  projects/runtime-coverage/share/man/man4/pfsync.4
  projects/runtime-coverage/share/man/man9/sbuf.9
  projects/runtime-coverage/share/misc/bsd-family-tree
  projects/runtime-coverage/share/mk/bsd.crunchgen.mk
  projects/runtime-coverage/share/mk/bsd.lib.mk
  projects/runtime-coverage/sys/amd64/amd64/minidump_machdep.c
  projects/runtime-coverage/sys/amd64/include/cpufunc.h
  projects/runtime-coverage/sys/amd64/include/intr_machdep.h
  projects/runtime-coverage/sys/arm/arm/minidump_machdep.c
  projects/runtime-coverage/sys/arm64/arm64/machdep.c
  projects/runtime-coverage/sys/arm64/arm64/minidump_machdep.c
  projects/runtime-coverage/sys/boot/common/part.c
  projects/runtime-coverage/sys/boot/efi/include/efi.h
  projects/runtime-coverage/sys/boot/efi/loader/arch/amd64/trap.c
  projects/runtime-coverage/sys/cam/cam_iosched.c
  projects/runtime-coverage/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/abd.h
  projects/runtime-coverage/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  projects/runtime-coverage/sys/compat/linuxkpi/common/include/linux/device.h
  projects/runtime-coverage/sys/compat/linuxkpi/common/src/linux_tasklet.c
  projects/runtime-coverage/sys/compat/linuxkpi/common/src/linux_work.c
  projects/runtime-coverage/sys/conf/files
  projects/runtime-coverage/sys/conf/kern.post.mk
  projects/runtime-coverage/sys/crypto/aesni/aesni_ghash.c
  projects/runtime-coverage/sys/crypto/aesni/aesni_wrap.c
  projects/runtime-coverage/sys/ddb/db_textdump.c
  projects/runtime-coverage/sys/dev/cxgbe/tom/t4_listen.c
  projects/runtime-coverage/sys/dev/safe/safe.c
  projects/runtime-coverage/sys/dev/syscons/scterm-teken.c
  projects/runtime-coverage/sys/dev/syscons/syscons.c
  projects/runtime-coverage/sys/dev/usb/quirk/usb_quirk.c
  projects/runtime-coverage/sys/dev/vt/vt_core.c
  projects/runtime-coverage/sys/i386/i386/exception.s
  projects/runtime-coverage/sys/i386/i386/minidump_machdep.c
  projects/runtime-coverage/sys/i386/include/intr_machdep.h
  projects/runtime-coverage/sys/kern/kern_dump.c
  projects/runtime-coverage/sys/kern/kern_ktr.c
  projects/runtime-coverage/sys/kern/kern_shutdown.c
  projects/runtime-coverage/sys/kern/subr_intr.c
  projects/runtime-coverage/sys/kern/subr_sbuf.c
  projects/runtime-coverage/sys/kern/subr_smp.c
  projects/runtime-coverage/sys/mips/atheros/if_arge.c
  projects/runtime-coverage/sys/mips/mips/minidump_machdep.c
  projects/runtime-coverage/sys/modules/Makefile
  projects/runtime-coverage/sys/net/bpf.c
  projects/runtime-coverage/sys/net/if_vlan.c
  projects/runtime-coverage/sys/netinet/tcp_usrreq.c
  projects/runtime-coverage/sys/sparc64/sparc64/dump_machdep.c
  projects/runtime-coverage/sys/sys/conf.h
  projects/runtime-coverage/sys/sys/consio.h
  projects/runtime-coverage/sys/sys/gtaskqueue.h
  projects/runtime-coverage/sys/sys/kernel.h
  projects/runtime-coverage/sys/sys/kerneldump.h
  projects/runtime-coverage/sys/sys/sbuf.h
  projects/runtime-coverage/sys/sys/taskqueue.h
  projects/runtime-coverage/sys/teken/sequences
  projects/runtime-coverage/sys/teken/teken.h
  projects/runtime-coverage/sys/teken/teken_subr_compat.h
  projects/runtime-coverage/sys/vm/vm_kern.c
  projects/runtime-coverage/sys/vm/vm_object.c
  projects/runtime-coverage/sys/vm/vm_object.h
  projects/runtime-coverage/sys/vm/vm_page.c
  projects/runtime-coverage/sys/vm/vm_page.h
  projects/runtime-coverage/sys/x86/x86/intr_machdep.c
  projects/runtime-coverage/sys/x86/x86/mp_x86.c
  projects/runtime-coverage/tools/build/mk/OptionalObsoleteFiles.inc
  projects/runtime-coverage/usr.bin/calendar/calendars/calendar.freebsd
  projects/runtime-coverage/usr.bin/grep/util.c
  projects/runtime-coverage/usr.sbin/bootparamd/bootparamd/bootparamd.c
  projects/runtime-coverage/usr.sbin/bootparamd/callbootd/callbootd.c
  projects/runtime-coverage/usr.sbin/vidcontrol/vidcontrol.1
  projects/runtime-coverage/usr.sbin/vidcontrol/vidcontrol.c
Directory Properties:
  projects/runtime-coverage/   (props changed)
  projects/runtime-coverage/contrib/binutils/   (props changed)
  projects/runtime-coverage/contrib/zstd/   (props changed)

Modified: projects/runtime-coverage/Makefile
==============================================================================
--- projects/runtime-coverage/Makefile	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/Makefile	Fri Aug 18 21:37:26 2017	(r322676)
@@ -221,7 +221,7 @@ SUB_MAKE= `test -x ${MYMAKE} && echo ${MYMAKE} || echo
 SUB_MAKE= ${MAKE} -m ${.CURDIR}/share/mk
 .endif
 
-_MAKE=	PATH=${PATH} MAKE_CMD=${MAKE} ${SUB_MAKE} -f Makefile.inc1 \
+_MAKE=	PATH=${PATH} MAKE_CMD="${MAKE}" ${SUB_MAKE} -f Makefile.inc1 \
 	TARGET=${_TARGET} TARGET_ARCH=${_TARGET_ARCH}
 
 # Only allow meta mode for the whitelisted targets.  See META_TGT_WHITELIST

Modified: projects/runtime-coverage/Makefile.inc1
==============================================================================
--- projects/runtime-coverage/Makefile.inc1	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/Makefile.inc1	Fri Aug 18 21:37:26 2017	(r322676)
@@ -1635,7 +1635,6 @@ create-world-package-${pkgname}: .PHONY
 		/^version/ { print $$2; next } \
 		' ${WSTAGEDIR}/${pkgname}.ucl
 	@if [ "${pkgname}" == "runtime" ]; then \
-		sed -i '' -e "s/%KERNCONF%/${INSTALLKERNEL:tl}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
 		sed -i '' -e "s/%VCS_REVISION%/${VCS_REVISION}/" ${WSTAGEDIR}/${pkgname}.ucl ; \
 	fi
 	${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/bin/sh -o ALLOW_BASE_SHLIBS=yes \

Modified: projects/runtime-coverage/Makefile.libcompat
==============================================================================
--- projects/runtime-coverage/Makefile.libcompat	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/Makefile.libcompat	Fri Aug 18 21:37:26 2017	(r322676)
@@ -180,7 +180,7 @@ build${libcompat}: .PHONY
 .endfor
 	${_+_}cd ${.CURDIR}; \
 	    ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
-.if ${libcompat} == "32"
+.if ${libcompat} == "32" && !defined(NO_RTLD)
 .for _t in ${_obj} all
 	${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 ${LIBCOMPATWMAKE} \
 	    -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
@@ -193,7 +193,7 @@ distribute${libcompat} install${libcompat}: .PHONY
 .for _dir in ${_LC_LIBDIRS.yes}
 	${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
 .endfor
-.if ${libcompat} == "32"
+.if ${libcompat} == "32" && !defined(NO_RTLD)
 	${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
 	    PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
 	${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \

Modified: projects/runtime-coverage/bin/pkill/pkill.c
==============================================================================
--- projects/runtime-coverage/bin/pkill/pkill.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/bin/pkill/pkill.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -568,6 +568,8 @@ main(int argc, char **argv)
 			continue;
 		rv |= (*action)(kp);
 	}
+	if (rv && pgrep)
+		putchar('\n');
 	if (!did_action && !pgrep && longfmt)
 		fprintf(stderr,
 		    "No matching processes belonging to you were found\n");

Modified: projects/runtime-coverage/contrib/binutils/bfd/ecoff.c
==============================================================================
--- projects/runtime-coverage/contrib/binutils/bfd/ecoff.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/contrib/binutils/bfd/ecoff.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -1878,7 +1878,7 @@ _bfd_ecoff_sizeof_headers (bfd *abfd,
   ret = (bfd_coff_filhsz (abfd)
 	 + bfd_coff_aoutsz (abfd)
 	 + c * bfd_coff_scnhsz (abfd));
-  return BFD_ALIGN (ret, 16);
+  return (int) BFD_ALIGN (ret, 16);
 }
 
 /* Get the contents of a section.  */

Modified: projects/runtime-coverage/contrib/binutils/gas/config/tc-mips.c
==============================================================================
--- projects/runtime-coverage/contrib/binutils/gas/config/tc-mips.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/contrib/binutils/gas/config/tc-mips.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -2920,7 +2920,7 @@ append_insn (struct mips_cl_insn *ip, expressionS *add
 	     instruction.  May want to add this support in the future.  */
 	}
       /* Never set the bit for $0, which is always zero.  */
-      mips_gprmask &= ~1 << 0;
+      mips_gprmask &= ~(1 << 0);
     }
   else
     {
@@ -3310,7 +3310,7 @@ macro_end (void)
 	     warning now.  */
 	  const char *msg = macro_warning (subtype);
 	  if (msg != 0)
-	    as_warn (msg);
+	    as_warn ("%s", msg);
 	}
       else
 	{
@@ -14463,7 +14463,7 @@ md_convert_frag (bfd *abfd ATTRIBUTE_UNUSED, segT asec
 	{
 	  const char *msg = macro_warning (fragp->fr_subtype);
 	  if (msg != 0)
-	    as_warn_where (fragp->fr_file, fragp->fr_line, msg);
+	    as_warn_where (fragp->fr_file, fragp->fr_line, "%s", msg);
 	}
 
       /* Go through all the fixups for the first sequence.  Disable them

Modified: projects/runtime-coverage/contrib/mdocml/lib.in
==============================================================================
--- projects/runtime-coverage/contrib/mdocml/lib.in	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/contrib/mdocml/lib.in	Fri Aug 18 21:37:26 2017	(r322676)
@@ -34,7 +34,7 @@ LINE("libc",		"Standard C\\~Library (libc, \\-lc)")
 LINE("libc_r",		"Reentrant C\\~Library (libc_r, \\-lc_r)")
 LINE("libcalendar",	"Calendar Arithmetic Library (libcalendar, \\-lcalendar)")
 LINE("libcam",		"Common Access Method User Library (libcam, \\-lcam)")
-LINE("libcasper",	"Casper Library (libcasper, \\-lcapser)")
+LINE("libcasper",	"Casper Library (libcasper, \\-lcasper)")
 LINE("libcdk",		"Curses Development Kit Library (libcdk, \\-lcdk)")
 LINE("libcipher",	"FreeSec Crypt Library (libcipher, \\-lcipher)")
 LINE("libcompat",	"Compatibility Library (libcompat, \\-lcompat)")

Modified: projects/runtime-coverage/etc/periodic/daily/Makefile
==============================================================================
--- projects/runtime-coverage/etc/periodic/daily/Makefile	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/etc/periodic/daily/Makefile	Fri Aug 18 21:37:26 2017	(r322676)
@@ -7,6 +7,7 @@ FILESGROUPS=FILES
 FILES=	100.clean-disks \
 	110.clean-tmps \
 	120.clean-preserve \
+	140.clean-rwho \
 	200.backup-passwd \
 	210.backup-aliases \
 	330.news \
@@ -45,14 +46,6 @@ FILES+=	130.clean-msgs
 FILES+=	480.status-ntpd \
 	480.leapfile-ntpd
 .endif
-
-.if ${MK_RCMDS} != "no"
-FILESGROUPS+=	RCMDS
-RCMDS+=	140.clean-rwho
-.endif
-RCMDSDIR=	/etc/periodic/daily
-RCMDSMODE=	${BINMODE}
-RCMDSPACKAGE=	rcmds
 
 .if ${MK_SENDMAIL} != "no"
 FILES+=	150.clean-hoststat \

Modified: projects/runtime-coverage/etc/rc.d/Makefile
==============================================================================
--- projects/runtime-coverage/etc/rc.d/Makefile	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/etc/rc.d/Makefile	Fri Aug 18 21:37:26 2017	(r322676)
@@ -100,6 +100,7 @@ FILES=	DAEMON \
 	rpcbind \
 	rtadvd \
 	rtsold \
+	rwho \
 	savecore \
 	securelevel \
 	serial \
@@ -269,12 +270,6 @@ SSHPACKAGE=	ssh
 
 .if ${MK_PF} != "no"
 FILES+=		ftp-proxy
-.endif
-
-.if ${MK_RCMDS} != "no"
-FILESGROUPS+=	RCMDS
-RCMDS+=		rwho
-RCMDSPACKAGE=	rcmds
 .endif
 
 .if ${MK_ROUTED} != "no"

Modified: projects/runtime-coverage/gnu/usr.bin/binutils/Makefile.inc0
==============================================================================
--- projects/runtime-coverage/gnu/usr.bin/binutils/Makefile.inc0	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/gnu/usr.bin/binutils/Makefile.inc0	Fri Aug 18 21:37:26 2017	(r322676)
@@ -16,7 +16,7 @@ TARGET_VENDOR?=	unknown
 TARGET_OS?=	freebsd
 BINUTILS_ARCH=${TARGET_ARCH:C/amd64/x86_64/}
 TARGET_TUPLE?=	${BINUTILS_ARCH}-${TARGET_VENDOR}-${TARGET_OS}
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" || \
+.if ${TARGET_ARCH:Marm*eb} != "" || \
 	(${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el*} == "")
 TARGET_BIG_ENDIAN=t
 .endif

Modified: projects/runtime-coverage/gnu/usr.bin/binutils/ld/Makefile.arm
==============================================================================
--- projects/runtime-coverage/gnu/usr.bin/binutils/ld/Makefile.arm	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/gnu/usr.bin/binutils/ld/Makefile.arm	Fri Aug 18 21:37:26 2017	(r322676)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
+.if ${TARGET_ARCH:Marm*eb} != ""
 NATIVE_EMULATION= armelfb_fbsd
 .else
 NATIVE_EMULATION= armelf_fbsd

Modified: projects/runtime-coverage/gnu/usr.bin/binutils/libbfd/Makefile.arm
==============================================================================
--- projects/runtime-coverage/gnu/usr.bin/binutils/libbfd/Makefile.arm	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/gnu/usr.bin/binutils/libbfd/Makefile.arm	Fri Aug 18 21:37:26 2017	(r322676)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
+.if ${TARGET_ARCH:Marm*eb} != ""
 DEFAULT_VECTOR=	bfd_elf32_bigarm_vec
 .else
 DEFAULT_VECTOR=	bfd_elf32_littlearm_vec
@@ -14,7 +14,7 @@ SRCS+=	cpu-arm.c \
 	elflink.c
 
 VECS+=	${DEFAULT_VECTOR}
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
+.if ${TARGET_ARCH:Marm*eb} != ""
 VECS+=	bfd_elf32_littlearm_vec
 .else
 VECS+=	bfd_elf32_bigarm_vec

Modified: projects/runtime-coverage/gnu/usr.bin/cc/Makefile.inc
==============================================================================
--- projects/runtime-coverage/gnu/usr.bin/cc/Makefile.inc	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/gnu/usr.bin/cc/Makefile.inc	Fri Aug 18 21:37:26 2017	(r322676)
@@ -31,7 +31,7 @@ CFLAGS+=	-DCROSS_DIRECTORY_STRUCTURE
 CFLAGS+=	-DTARGET_ARM_EABI
 .endif
 
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb"
+.if ${TARGET_ARCH:Marm*eb} != ""
 CFLAGS += -DTARGET_ENDIAN_DEFAULT=MASK_BIG_END
 .endif
 .if ${TARGET_ARCH} == "armv6" || ${TARGET_ARCH} == "armv6eb"

Modified: projects/runtime-coverage/gnu/usr.bin/cc/Makefile.tgt
==============================================================================
--- projects/runtime-coverage/gnu/usr.bin/cc/Makefile.tgt	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/gnu/usr.bin/cc/Makefile.tgt	Fri Aug 18 21:37:26 2017	(r322676)
@@ -14,7 +14,7 @@ GCC_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc/rs600
 .if ${TARGET_ARCH} == "sparc64"
 TARGET_CPU_DEFAULT= TARGET_CPU_ultrasparc
 .endif
-.if ${TARGET_ARCH} == "armeb" || ${TARGET_ARCH} == "armv6eb" || \
+.if ${TARGET_ARCH:Marm*eb} != "" || \
 	(${TARGET_CPUARCH} == "mips" && ${TARGET_ARCH:Mmips*el*} == "")
 TARGET_BIG_ENDIAN=t
 .endif

Modified: projects/runtime-coverage/lib/libc/i386/Makefile.inc
==============================================================================
--- projects/runtime-coverage/lib/libc/i386/Makefile.inc	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/lib/libc/i386/Makefile.inc	Fri Aug 18 21:37:26 2017	(r322676)
@@ -4,3 +4,13 @@
 GDTOASRCS+=strtorx.c
 SRCS+=machdep_ldisx.c
 SYM_MAPS+=${LIBC_SRCTOP}/i386/Symbol.map
+
+# XXX force use of ld.bfd for linking i386 libc
+#
+# lld can successfully link most of a working i386 userland and kernel,
+# but produces a broken libc. For now if we're otherwise using lld, and
+# ld.bfd is available, explicitly use it for libc.
+.include <bsd.linker.mk>
+.if ${LINKER_TYPE} == "lld" && ${MK_BINUTILS_BOOTSTRAP} != "no"
+LDFLAGS+=-fuse-ld=bfd
+.endif

Modified: projects/runtime-coverage/lib/libcompiler_rt/Makefile.inc
==============================================================================
--- projects/runtime-coverage/lib/libcompiler_rt/Makefile.inc	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/lib/libcompiler_rt/Makefile.inc	Fri Aug 18 21:37:26 2017	(r322676)
@@ -184,7 +184,7 @@ SRCF+=		umodsi3
 .endif
 
 # FreeBSD-specific atomic intrinsics.
-.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "armv6"
+.if ${MACHINE_CPUARCH} == "arm"
 .PATH:		${SRCTOP}/sys/arm/arm
 
 SRCF+=		stdatomic

Modified: projects/runtime-coverage/lib/libfetch/common.c
==============================================================================
--- projects/runtime-coverage/lib/libfetch/common.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/lib/libfetch/common.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -291,7 +291,7 @@ fetch_resolve(const char *addr, int port, int af)
 			goto syserr;
 		service = sbuf;
 	} else if (*sep != '\0') {
-		service = sep;
+		service = sep + 1;
 	} else {
 		service = NULL;
 	}

Modified: projects/runtime-coverage/lib/libutil/kinfo_getvmmap.3
==============================================================================
--- projects/runtime-coverage/lib/libutil/kinfo_getvmmap.3	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/lib/libutil/kinfo_getvmmap.3	Fri Aug 18 21:37:26 2017	(r322676)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 27, 2015
+.Dd August 18, 2017
 .Dt KINFO_GETVMMAP 3
 .Os
 .Sh NAME
@@ -58,6 +58,13 @@ with the
 mib.
 While the kernel returns a packed structure, this function expands the
 data into a fixed record format.
+.Sh CAVEAT
+.Fn kinfo_getvmmap
+calls can cause significant CPU consumption because calculating the residency
+counts requires iterating over all memory pages of the process.
+Setting the sysctl variable
+.Va kern.proc_vmmap_skip_resident_count
+to 1 prevents this calculation.
 .Sh RETURN VALUES
 On success the
 .Fn kinfo_getvmmap

Modified: projects/runtime-coverage/release/packages/kernel.ucl
==============================================================================
--- projects/runtime-coverage/release/packages/kernel.ucl	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/release/packages/kernel.ucl	Fri Aug 18 21:37:26 2017	(r322676)
@@ -16,43 +16,6 @@ desc = <<EOD
 %DESC%
 EOD
 scripts: {
-	pre-install = <<EOD
-	case ${ASSUME_ALWAYS_YES} in
-		[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee])
-			exit 0
-			;;
-		*)
-			continue
-			;;
-	esac
-	if [ -z "${TERM}" ]; then
-		exit 0
-	fi
-	echo "****************************************************************"
-	echo "It is recommended to install the FreeBSD-%PKGNAME% package"
-	echo "with:"
-	echo
-	echo "	pkg install FreeBSD-%PKGNAME%"
-	echo
-	echo "and rebooting the system into the new kernel before upgrading"
-	echo "with:"
-	echo
-	echo "	pkg upgrade"
-	echo
-	echo "****************************************************************"
-	echo
-	echo "Do you want to continue anyway? (N/y)"
-	read ANSWER
-	case ${ANSWER} in
-		[Yy])
-			exit 0
-			;;
-		*)
-			kill ${PPID} ${PID}
-			;;
-	esac
-EOD
-
 	post-install = <<EOD
 	/usr/sbin/kldxref ${PKG_ROOTDIR}/boot/kernel
 EOD

Modified: projects/runtime-coverage/release/packages/runtime.ucl
==============================================================================
--- projects/runtime-coverage/release/packages/runtime.ucl	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/release/packages/runtime.ucl	Fri Aug 18 21:37:26 2017	(r322676)
@@ -27,10 +27,6 @@ deps: {
     "FreeBSD-clibs": {
         origin: "base"
         version: "%VERSION%"
-    },
-    "FreeBSD-kernel-%KERNCONF%": {
-        origin: "base"
-        version: "%VERSION%"
     }
 }
 directories {

Modified: projects/runtime-coverage/release/release.sh
==============================================================================
--- projects/runtime-coverage/release/release.sh	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/release/release.sh	Fri Aug 18 21:37:26 2017	(r322676)
@@ -397,7 +397,7 @@ main() {
 	while getopts c: opt; do
 		case ${opt} in
 			c)
-				RELEASECONF="${OPTARG}"
+				RELEASECONF="$(realpath ${OPTARG})"
 				;;
 			\?)
 				usage

Modified: projects/runtime-coverage/sbin/route/route.8
==============================================================================
--- projects/runtime-coverage/sbin/route/route.8	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/sbin/route/route.8	Fri Aug 18 21:37:26 2017	(r322676)
@@ -68,7 +68,7 @@ Specify
 address family as family hint for subcommands.
 .It Fl 6
 Specify
-.Cm inet
+.Cm inet6
 address family as family hint for subcommands.
 .It Fl d
 Run in debug-only mode, i.e., do not actually modify the routing table.

Modified: projects/runtime-coverage/share/man/man4/bge.4
==============================================================================
--- projects/runtime-coverage/share/man/man4/bge.4	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/man/man4/bge.4	Fri Aug 18 21:37:26 2017	(r322676)
@@ -31,7 +31,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 19, 2012
+.Dd August 18, 2017
 .Dt BGE 4
 .Os
 .Sh NAME
@@ -159,6 +159,10 @@ following:
 .It
 3Com 3c996-T (10/100/1000baseTX)
 .It
+Apple Thunderbolt Display (10/100/1000baseTX)
+.It
+Apple Thunderbolt to Gigabit Ethernet Adapter (10/100/1000baseTX)
+.It
 Dell PowerEdge 1750 integrated BCM5704C NIC (10/100/1000baseTX)
 .It
 Dell PowerEdge 2550 integrated BCM5700 NIC (10/100/1000baseTX)
@@ -236,6 +240,9 @@ during initialization.
 The driver failed to initialize PCI shared memory mapping.
 This might
 happen if the card is not in a bus-master slot.
+.It "bge%d: firmware handshake timed out, found 0xffffffff"
+The device was physically disconnected from the system, or there is a problem with
+the device causing it to stop responding to the host it is attached to.
 .It "bge%d: no memory for jumbo buffers!"
 The driver failed to allocate memory for jumbo frames during
 initialization.
@@ -262,3 +269,12 @@ The
 .Nm
 driver was written by
 .An Bill Paul Aq Mt wpaul@windriver.com .
+.Sh BUGS
+Hotplug is not currently supported in
+.Fx ,
+hence, Thunderbolt interfaces need to be connected prior to system power up on
+Apple systems in order for the interface to be detected.
+Also, due to the lack of hotplug support, Thunderbolt-based interfaces must not be removed
+while the system is up as the kernel is currently unable to cope with a
+.Nm
+interface disappearing.

Modified: projects/runtime-coverage/share/man/man4/pfsync.4
==============================================================================
--- projects/runtime-coverage/share/man/man4/pfsync.4	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/man/man4/pfsync.4	Fri Aug 18 21:37:26 2017	(r322676)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2011
+.Dd August 18, 2017
 .Dt PFSYNC 4
 .Os
 .Sh NAME
@@ -90,7 +90,7 @@ interface:
 .Ed
 .Pp
 By default, state change messages are sent out on the synchronisation
-interface using IP multicast packets to the 244.0.0.240 group address.
+interface using IP multicast packets to the 224.0.0.240 group address.
 An alternative destination address for
 .Nm
 packets can be specified using the

Modified: projects/runtime-coverage/share/man/man9/sbuf.9
==============================================================================
--- projects/runtime-coverage/share/man/man9/sbuf.9	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/man/man9/sbuf.9	Fri Aug 18 21:37:26 2017	(r322676)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 5, 2017
+.Dd August 17, 2017
 .Dt SBUF 9
 .Os
 .Sh NAME
@@ -271,6 +271,14 @@ This indicates that the storage buffer may be extended
 as resources allow, to hold additional data.
 .It Dv SBUF_INCLUDENUL
 This causes the final nulterm byte to be counted in the length of the data.
+.It Dv SBUF_DRAINTOEOR
+Treat top-level sections started with
+.Fn sbuf_start_section
+as a record boundary marker that will be used during drain operations to avoid
+records being split.
+If a record grows sufficiently large such that it fills the
+.Fa sbuf
+and therefore cannot be drained without being split, an error of EDEADLK is set.
 .El
 .Pp
 Note that if

Modified: projects/runtime-coverage/share/misc/bsd-family-tree
==============================================================================
--- projects/runtime-coverage/share/misc/bsd-family-tree	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/misc/bsd-family-tree	Fri Aug 18 21:37:26 2017	(r322676)
@@ -350,9 +350,11 @@ FreeBSD 5.2           |      |                 |      
  |                    |      |                 |                       |
  *--FreeBSD         macOS    |            OpenBSD 6.0                  |
  |   11.0           10.12    |                 |                       |
- |                    |   NetBSD 7.1           |                       |
- |                    |      |                 |               DragonFly 4.8.0
- |                    |      |            OpenBSD 6.1                  |
+ |     |              |   NetBSD 7.1           |                       |
+ |     |              |      |                 |               DragonFly 4.8.0
+ |     |              |      |            OpenBSD 6.1                  |
+ |  FreeBSD           |      |                 |                       |
+ |   11.1             |      |                 |                       |
  |                    |      |                 |                       |
 FreeBSD 12 -current   |  NetBSD -current  OpenBSD -current    DragonFly -current
  |                    |      |                 |                       |
@@ -712,6 +714,7 @@ FreeBSD 11.0		2016-10-10 [FBD]
 NetBSD 7.1		2017-03-11 [NBD]
 DragonFly 4.8.0		2017-03-27 [DFB]
 OpenBSD 6.1		2017-04-11 [OBD]
+FreeBSD 11.1		2017-07-26 [FBD]
 
 Bibliography
 ------------------------

Modified: projects/runtime-coverage/share/mk/bsd.crunchgen.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.crunchgen.mk	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/mk/bsd.crunchgen.mk	Fri Aug 18 21:37:26 2017	(r322676)
@@ -114,7 +114,7 @@ CRUNCHENV+= MK_TESTS=no \
 ${OUTPUTS:[1]}: .META
 ${OUTPUTS:[2..-1]}: .NOMETA
 ${OUTPUTS}: ${CONF}
-	MAKE=${MAKE} ${CRUNCHENV:NMK_AUTO_OBJ=*} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
+	MAKE="${MAKE}" ${CRUNCHENV:NMK_AUTO_OBJ=*} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \
 	    MK_AUTO_OBJ=${MK_AUTO_OBJ} \
 	    ${CRUNCHGEN} -fq -m ${OUTMK} -c ${OUTC} ${CONF}
 	# Avoid redundantly calling 'make objs' which we've done by our

Modified: projects/runtime-coverage/share/mk/bsd.lib.mk
==============================================================================
--- projects/runtime-coverage/share/mk/bsd.lib.mk	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/share/mk/bsd.lib.mk	Fri Aug 18 21:37:26 2017	(r322676)
@@ -359,6 +359,11 @@ _EXTRADEPEND:
 .if !defined(NO_FSCHG)
 SHLINSTALLFLAGS+= -fschg
 .endif
+.endif
+# Install libraries with -S to avoid linker races with WORLDTMP and risk
+# of modifying in-use libraries when installing to a running system.
+# It is safe to avoid this for NO_ROOT builds that are only creating an image.
+.if !defined(NO_SAFE_LIBINSTALL) && !defined(NO_ROOT)
 SHLINSTALLFLAGS+= -S
 .endif
 

Modified: projects/runtime-coverage/sys/amd64/amd64/minidump_machdep.c
==============================================================================
--- projects/runtime-coverage/sys/amd64/amd64/minidump_machdep.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/sys/amd64/amd64/minidump_machdep.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -52,12 +52,6 @@ __FBSDID("$FreeBSD$");
 
 CTASSERT(sizeof(struct kerneldumpheader) == 512);
 
-/*
- * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
- * is to protect us from metadata and to protect metadata from us.
- */
-#define	SIZEOF_METADATA		(64*1024)
-
 uint64_t *vm_page_dump;
 int vm_page_dump_size;
 
@@ -320,22 +314,8 @@ minidumpsys(struct dumperinfo *di)
 	}
 	dumpsize += PAGE_SIZE;
 
-	/* Determine dump offset on device. */
-	if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 +
-	    kerneldumpcrypto_dumpkeysize(di->kdc)) {
-		error = E2BIG;
-		goto fail;
-	}
-	dumplo = di->mediaoffset + di->mediasize - dumpsize;
-	dumplo -= di->blocksize * 2;
-	dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc);
 	progress = dumpsize;
 
-	/* Initialize kernel dump crypto. */
-	error = kerneldumpcrypto_init(di->kdc);
-	if (error)
-		goto fail;
-
 	/* Initialize mdhdr */
 	bzero(&mdhdr, sizeof(mdhdr));
 	strcpy(mdhdr.magic, MINIDUMP_MAGIC);
@@ -347,24 +327,16 @@ minidumpsys(struct dumperinfo *di)
 	mdhdr.dmapbase = DMAP_MIN_ADDRESS;
 	mdhdr.dmapend = DMAP_MAX_ADDRESS;
 
-	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION, dumpsize,
-	    kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize);
+	dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_AMD64_VERSION,
+	    dumpsize);
 
 	printf("Dumping %llu out of %ju MB:", (long long)dumpsize >> 20,
 	    ptoa((uintmax_t)physmem) / 1048576);
 
-	/* Dump leader */
-	error = dump_write_header(di, &kdh, 0, dumplo);
-	if (error)
+	error = dump_start(di, &kdh, &dumplo);
+	if (error != 0)
 		goto fail;
-	dumplo += di->blocksize;
 
-	/* Dump key */
-	error = dump_write_key(di, 0, dumplo);
-	if (error)
-		goto fail;
-	dumplo += kerneldumpcrypto_dumpkeysize(di->kdc);
-
 	/* Dump my header */
 	bzero(&fakepd, sizeof(fakepd));
 	bcopy(&mdhdr, &fakepd, sizeof(mdhdr));
@@ -447,14 +419,10 @@ minidumpsys(struct dumperinfo *di)
 	if (error)
 		goto fail;
 
-	/* Dump trailer */
-	error = dump_write_header(di, &kdh, 0, dumplo);
-	if (error)
+	error = dump_finish(di, &kdh, dumplo);
+	if (error != 0)
 		goto fail;
-	dumplo += di->blocksize;
 
-	/* Signal completion, signoff and exit stage left. */
-	dump_write(di, NULL, 0, 0, 0);
 	printf("\nDump complete\n");
 	return (0);
 

Modified: projects/runtime-coverage/sys/amd64/include/cpufunc.h
==============================================================================
--- projects/runtime-coverage/sys/amd64/include/cpufunc.h	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/sys/amd64/include/cpufunc.h	Fri Aug 18 21:37:26 2017	(r322676)
@@ -834,6 +834,85 @@ intr_restore(register_t rflags)
 	write_rflags(rflags);
 }
 
+enum {
+	SGX_ECREATE	= 0x0,
+	SGX_EADD	= 0x1,
+	SGX_EINIT	= 0x2,
+	SGX_EREMOVE	= 0x3,
+	SGX_EDGBRD	= 0x4,
+	SGX_EDGBWR	= 0x5,
+	SGX_EEXTEND	= 0x6,
+	SGX_ELDU	= 0x8,
+	SGX_EBLOCK	= 0x9,
+	SGX_EPA		= 0xA,
+	SGX_EWB		= 0xB,
+	SGX_ETRACK	= 0xC,
+};
+
+enum {
+	SGX_PT_SECS = 0x00,
+	SGX_PT_TCS  = 0x01,
+	SGX_PT_REG  = 0x02,
+	SGX_PT_VA   = 0x03,
+	SGX_PT_TRIM = 0x04,
+};
+
+int sgx_encls(uint32_t eax, uint64_t rbx, uint64_t rcx, uint64_t rdx);
+
+static __inline int
+sgx_ecreate(void *pginfo, void *secs)
+{
+
+	return (sgx_encls(SGX_ECREATE, (uint64_t)pginfo,
+	    (uint64_t)secs, 0));
+}
+
+static __inline int
+sgx_eadd(void *pginfo, void *epc)
+{
+
+	return (sgx_encls(SGX_EADD, (uint64_t)pginfo,
+	    (uint64_t)epc, 0));
+}
+
+static __inline int
+sgx_einit(void *sigstruct, void *secs, void *einittoken)
+{
+
+	return (sgx_encls(SGX_EINIT, (uint64_t)sigstruct,
+	    (uint64_t)secs, (uint64_t)einittoken));
+}
+
+static __inline int
+sgx_eextend(void *secs, void *epc)
+{
+
+	return (sgx_encls(SGX_EEXTEND, (uint64_t)secs,
+	    (uint64_t)epc, 0));
+}
+
+static __inline int
+sgx_epa(void *epc)
+{
+
+	return (sgx_encls(SGX_EPA, SGX_PT_VA, (uint64_t)epc, 0));
+}
+
+static __inline int
+sgx_eldu(uint64_t rbx, uint64_t rcx,
+    uint64_t rdx)
+{
+
+	return (sgx_encls(SGX_ELDU, rbx, rcx, rdx));
+}
+
+static __inline int
+sgx_eremove(void *epc)
+{
+
+	return (sgx_encls(SGX_EREMOVE, 0, (uint64_t)epc, 0));
+}
+
 #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */
 
 int	breakpoint(void);

Modified: projects/runtime-coverage/sys/amd64/include/intr_machdep.h
==============================================================================
--- projects/runtime-coverage/sys/amd64/include/intr_machdep.h	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/sys/amd64/include/intr_machdep.h	Fri Aug 18 21:37:26 2017	(r322676)
@@ -130,6 +130,7 @@ struct intsrc {
 	u_long *is_straycount;
 	u_int is_index;
 	u_int is_handlers;
+	u_int is_cpu;
 };
 
 struct trapframe;

Copied: projects/runtime-coverage/sys/amd64/include/sgx.h (from r322675, head/sys/amd64/include/sgx.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/runtime-coverage/sys/amd64/include/sgx.h	Fri Aug 18 21:37:26 2017	(r322676, copy of r322675, head/sys/amd64/include/sgx.h)
@@ -0,0 +1,64 @@
+/*-
+ * Copyright (c) 2017 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/* User-visible header. */
+
+#ifndef _MACHINE_SGX_H_
+#define _MACHINE_SGX_H_
+
+#define	SGX_MAGIC	0xA4
+#define	SGX_IOC_ENCLAVE_CREATE \
+	_IOW(SGX_MAGIC, 0x00, struct sgx_enclave_create)
+#define	SGX_IOC_ENCLAVE_ADD_PAGE \
+	_IOW(SGX_MAGIC, 0x01, struct sgx_enclave_add_page)
+#define	SGX_IOC_ENCLAVE_INIT \
+	_IOW(SGX_MAGIC, 0x02, struct sgx_enclave_init)
+
+struct sgx_enclave_create {
+	uint64_t	src;
+} __packed;
+
+struct sgx_enclave_add_page {
+	uint64_t	addr;
+	uint64_t	src;
+	uint64_t	secinfo;
+	uint16_t	mrmask;
+} __packed;
+
+struct sgx_enclave_init {
+	uint64_t	addr;
+	uint64_t	sigstruct;
+	uint64_t	einittoken;
+} __packed;
+
+#endif /* !_MACHINE_SGX_H_ */

Copied: projects/runtime-coverage/sys/amd64/include/sgxreg.h (from r322675, head/sys/amd64/include/sgxreg.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/runtime-coverage/sys/amd64/include/sgxreg.h	Fri Aug 18 21:37:26 2017	(r322676, copy of r322675, head/sys/amd64/include/sgxreg.h)
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 2017 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * This software was developed by BAE Systems, the University of Cambridge
+ * Computer Laboratory, and Memorial University under DARPA/AFRL contract
+ * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing
+ * (TC) research program.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/* Machine-defined variables. */
+
+#ifndef _MACHINE_SGXREG_H_
+#define _MACHINE_SGXREG_H_
+
+/* Error codes. */
+#define	SGX_SUCCESS			0
+#define	SGX_INVALID_SIG_STRUCT		1	/* EINIT */
+#define	SGX_INVALID_ATTRIBUTE		2	/* EINIT, EGETKEY */
+#define	SGX_BLSTATE			3	/* EBLOCK */
+#define	SGX_INVALID_MEASUREMENT		4	/* EINIT */
+#define	SGX_NOTBLOCKABLE		5	/* EBLOCK */
+#define	SGX_PG_INVLD			6	/* EBLOCK */
+#define	SGX_LOCKFAIL			7	/* EBLOCK, EMODPR, EMODT */
+#define	SGX_INVALID_SIGNATURE		8	/* EINIT */
+#define	SGX_MAC_COMPARE_FAIL		9	/* ELDB, ELDU */
+#define	SGX_PAGE_NOT_BLOCKED		10	/* EWB */
+#define	SGX_NOT_TRACKED			11	/* EWB, EACCEPT */
+#define	SGX_VA_SLOT_OCCUPIED		12	/* EWB */
+#define	SGX_CHILD_PRESENT		13	/* EWB, EREMOVE */
+#define	SGX_ENCLAVE_ACT			14	/* EREMOVE */
+#define	SGX_ENTRYEPOCH_LOCKED		15	/* EBLOCK */
+#define	SGX_INVALID_EINIT_TOKEN		16	/* EINIT */
+#define	SGX_PREV_TRK_INCMPL		17	/* ETRACK */
+#define	SGX_PG_IS_SECS			18	/* EBLOCK */
+#define	SGX_PAGE_ATTRIBUTES_MISMATCH	19	/* EACCEPT, EACCEPTCOPY */
+#define	SGX_PAGE_NOT_MODIFIABLE		20	/* EMODPR, EMODT */
+#define	SGX_INVALID_CPUSVN		32	/* EINIT, EGETKEY */
+#define	SGX_INVALID_ISVSVN		64	/* EGETKEY */
+#define	SGX_UNMASKED_EVENT		128	/* EINIT */
+#define	SGX_INVALID_KEYNAME		256	/* EGETKEY */
+
+/*
+ * 2.10 Page Information (PAGEINFO)
+ * PAGEINFO is an architectural data structure that is used as a parameter
+ * to the EPC-management instructions. It requires 32-Byte alignment.
+ */
+struct page_info {
+	uint64_t linaddr;
+	uint64_t srcpge;
+	union {
+		struct secinfo *secinfo;
+		uint64_t pcmd;
+	};
+	uint64_t secs;
+} __aligned(32);
+
+/*
+ * 2.11 Security Information (SECINFO)
+ * The SECINFO data structure holds meta-data about an enclave page.
+ */
+struct secinfo {
+	uint64_t flags;
+#define	SECINFO_FLAGS_PT_S	8	/* Page type shift */
+#define	SECINFO_FLAGS_PT_M	(0xff << SECINFO_FLAGS_PT_S)
+	uint64_t reserved[7];
+} __aligned(64);
+
+/*
+ * 2.7.1 ATTRIBUTES
+ * The ATTRIBUTES data structure is comprised of bit-granular fields that
+ * are used in the SECS, CPUID enumeration, the REPORT and the KEYREQUEST
+ * structures.
+ */
+struct secs_attr {
+	uint8_t		reserved1: 1;
+	uint8_t		debug: 1;
+	uint8_t		mode64bit: 1;
+	uint8_t		reserved2: 1;
+	uint8_t		provisionkey: 1;
+	uint8_t		einittokenkey: 1;
+	uint8_t		reserved3: 2;
+#define	SECS_ATTR_RSV4_SIZE	7
+	uint8_t		reserved4[SECS_ATTR_RSV4_SIZE];
+	uint64_t	xfrm;			/* X-Feature Request Mask */
+};
+
+/*
+ * 2.7 SGX Enclave Control Structure (SECS)
+ * The SECS data structure requires 4K-Bytes alignment.
+ */
+struct secs {
+	uint64_t	size;
+	uint64_t	base;
+	uint32_t	ssa_frame_size;
+	uint32_t	misc_select;
+#define	SECS_RSV1_SIZE	24
+	uint8_t		reserved1[SECS_RSV1_SIZE];
+	struct secs_attr attributes;
+	uint8_t		mr_enclave[32];
+#define	SECS_RSV2_SIZE	32
+	uint8_t		reserved2[SECS_RSV2_SIZE];
+	uint8_t		mr_signer[32];
+#define	SECS_RSV3_SIZE	96
+	uint8_t		reserved3[SECS_RSV3_SIZE];
+	uint16_t	isv_prod_id;
+	uint16_t	isv_svn;
+#define	SECS_RSV4_SIZE	3836
+	uint8_t		reserved4[SECS_RSV4_SIZE];
+};
+
+/*
+ * 2.8 Thread Control Structure (TCS)
+ * Each executing thread in the enclave is associated with a
+ * Thread Control Structure. It requires 4K-Bytes alignment.
+ */
+struct tcs {
+	uint64_t	reserved1;
+	uint64_t	flags;
+	uint64_t	ossa;
+	uint32_t	cssa;
+	uint32_t	nssa;
+	uint64_t	oentry;
+	uint64_t	reserved2;
+	uint64_t	ofsbasgx;
+	uint64_t	ogsbasgx;
+	uint32_t	fslimit;
+	uint32_t	gslimit;
+	uint64_t	reserved3[503];
+};
+
+#endif /* !_MACHINE_SGXREG_H_ */

Modified: projects/runtime-coverage/sys/arm/arm/minidump_machdep.c
==============================================================================
--- projects/runtime-coverage/sys/arm/arm/minidump_machdep.c	Fri Aug 18 21:20:38 2017	(r322675)
+++ projects/runtime-coverage/sys/arm/arm/minidump_machdep.c	Fri Aug 18 21:37:26 2017	(r322676)
@@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$");
 
 CTASSERT(sizeof(struct kerneldumpheader) == 512);
 
-/*
- * Don't touch the first SIZEOF_METADATA bytes on the dump device. This
- * is to protect us from metadata and to protect metadata from us.
- */
-#define	SIZEOF_METADATA		(64*1024)
-
 uint32_t *vm_page_dump;
 int vm_page_dump_size;
 
@@ -219,7 +213,6 @@ minidumpsys(struct dumperinfo *di)
 	dumpsize = ptesize;
 	dumpsize += round_page(msgbufp->msg_size);
 	dumpsize += round_page(vm_page_dump_size);
-
 	for (i = 0; i < vm_page_dump_size / sizeof(*vm_page_dump); i++) {
 		bits = vm_page_dump[i];
 		while (bits) {
@@ -234,26 +227,10 @@ minidumpsys(struct dumperinfo *di)
 			bits &= ~(1ul << bit);
 		}
 	}
-
 	dumpsize += PAGE_SIZE;
 
-	/* Determine dump offset on device. */
-	if (di->mediasize < SIZEOF_METADATA + dumpsize + di->blocksize * 2 +
-	    kerneldumpcrypto_dumpkeysize(di->kdc)) {
-		error = ENOSPC;
-		goto fail;
-	}
-
-	dumplo = di->mediaoffset + di->mediasize - dumpsize;
-	dumplo -= di->blocksize * 2;
-	dumplo -= kerneldumpcrypto_dumpkeysize(di->kdc);
 	progress = dumpsize;
 
-	/* Initialize kernel dump crypto. */
-	error = kerneldumpcrypto_init(di->kdc);
-	if (error)
-		goto fail;
-
 	/* Initialize mdhdr */
 	bzero(&mdhdr, sizeof(mdhdr));
 	strcpy(mdhdr.magic, MINIDUMP_MAGIC);
@@ -268,24 +245,16 @@ minidumpsys(struct dumperinfo *di)
 #else
 	mdhdr.mmuformat = MINIDUMP_MMU_FORMAT_V4;
 #endif
-	mkdumpheader(&kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize,
-	    kerneldumpcrypto_dumpkeysize(di->kdc), di->blocksize);
+	dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION,
+	    dumpsize);
 
 	printf("Physical memory: %u MB\n", ptoa((uintmax_t)physmem) / 1048576);
 	printf("Dumping %llu MB:", (long long)dumpsize >> 20);
 
-	/* Dump leader */
-	error = dump_write_header(di, &kdh, 0, dumplo);
-	if (error)
+	error = dump_start(di, &kdh, &dumplo);
+	if (error != 0)
 		goto fail;
-	dumplo += di->blocksize;
 
-	/* Dump key */
-	error = dump_write_key(di, 0, dumplo);
-	if (error)
-		goto fail;
-	dumplo += kerneldumpcrypto_dumpkeysize(di->kdc);
-
 	/* Dump my header */
 	bzero(dumpbuf, sizeof(dumpbuf));
 	bcopy(&mdhdr, dumpbuf, sizeof(mdhdr));
@@ -360,14 +329,10 @@ minidumpsys(struct dumperinfo *di)
 	if (error)
 		goto fail;
 
-	/* Dump trailer */
-	error = dump_write_header(di, &kdh, 0, dumplo);
-	if (error)
+	error = dump_finish(di, &kdh, dumplo);
+	if (error != 0)
 		goto fail;
-	dumplo += di->blocksize;
 
-	/* Signal completion, signoff and exit stage left. */
-	dump_write(di, NULL, 0, 0, 0);
 	printf("\nDump complete\n");
 	return (0);

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



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