Date: Mon, 21 Aug 2017 17:05:43 +0000 (UTC) From: Cy Schubert <cy@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r322758 - in projects/krb5: . lib/libc/i386 share/mk sys/amd64/include sys/amd64/sgx sys/conf sys/dev/syscons sys/i386/include sys/kern sys/modules sys/modules/sgx sys/modules/sgx_linux... Message-ID: <201708211705.v7LH5hw1011280@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: cy Date: Mon Aug 21 17:05:43 2017 New Revision: 322758 URL: https://svnweb.freebsd.org/changeset/base/322758 Log: MFH r322589-r322753. Added: projects/krb5/sys/amd64/include/sgx.h - copied unchanged from r322589, head/sys/amd64/include/sgx.h projects/krb5/sys/amd64/include/sgxreg.h - copied unchanged from r322589, head/sys/amd64/include/sgxreg.h projects/krb5/sys/amd64/sgx/ - copied from r322589, head/sys/amd64/sgx/ projects/krb5/sys/modules/sgx/ - copied from r322589, head/sys/modules/sgx/ projects/krb5/sys/modules/sgx_linux/ - copied from r322589, head/sys/modules/sgx_linux/ Modified: projects/krb5/Makefile projects/krb5/lib/libc/i386/Makefile.inc projects/krb5/share/mk/bsd.crunchgen.mk projects/krb5/sys/amd64/include/cpufunc.h projects/krb5/sys/amd64/include/intr_machdep.h projects/krb5/sys/conf/kern.post.mk projects/krb5/sys/dev/syscons/syscons.c projects/krb5/sys/i386/include/intr_machdep.h projects/krb5/sys/kern/subr_intr.c projects/krb5/sys/modules/Makefile projects/krb5/sys/sys/consio.h projects/krb5/sys/vm/vm_object.c projects/krb5/sys/vm/vm_object.h projects/krb5/sys/x86/x86/intr_machdep.c projects/krb5/tools/build/mk/OptionalObsoleteFiles.inc projects/krb5/usr.sbin/vidcontrol/vidcontrol.c Directory Properties: projects/krb5/ (props changed) Modified: projects/krb5/Makefile ============================================================================== --- projects/krb5/Makefile Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/Makefile Mon Aug 21 17:05:43 2017 (r322758) @@ -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/krb5/lib/libc/i386/Makefile.inc ============================================================================== --- projects/krb5/lib/libc/i386/Makefile.inc Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/lib/libc/i386/Makefile.inc Mon Aug 21 17:05:43 2017 (r322758) @@ -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/krb5/share/mk/bsd.crunchgen.mk ============================================================================== --- projects/krb5/share/mk/bsd.crunchgen.mk Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/share/mk/bsd.crunchgen.mk Mon Aug 21 17:05:43 2017 (r322758) @@ -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/krb5/sys/amd64/include/cpufunc.h ============================================================================== --- projects/krb5/sys/amd64/include/cpufunc.h Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/amd64/include/cpufunc.h Mon Aug 21 17:05:43 2017 (r322758) @@ -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/krb5/sys/amd64/include/intr_machdep.h ============================================================================== --- projects/krb5/sys/amd64/include/intr_machdep.h Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/amd64/include/intr_machdep.h Mon Aug 21 17:05:43 2017 (r322758) @@ -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/krb5/sys/amd64/include/sgx.h (from r322589, head/sys/amd64/include/sgx.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/krb5/sys/amd64/include/sgx.h Mon Aug 21 17:05:43 2017 (r322758, copy of r322589, 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/krb5/sys/amd64/include/sgxreg.h (from r322589, head/sys/amd64/include/sgxreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/krb5/sys/amd64/include/sgxreg.h Mon Aug 21 17:05:43 2017 (r322758, copy of r322589, 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/krb5/sys/conf/kern.post.mk ============================================================================== --- projects/krb5/sys/conf/kern.post.mk Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/conf/kern.post.mk Mon Aug 21 17:05:43 2017 (r322758) @@ -372,7 +372,7 @@ config.ln env.ln hints.ln vers.ln vnode_if.ln: REPRO_FLAG="-r" .endif vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} - MAKE=${MAKE} sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} + MAKE="${MAKE}" sh $S/conf/newvers.sh ${REPRO_FLAG} ${KERN_IDENT} vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c Modified: projects/krb5/sys/dev/syscons/syscons.c ============================================================================== --- projects/krb5/sys/dev/syscons/syscons.c Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/dev/syscons/syscons.c Mon Aug 21 17:05:43 2017 (r322758) @@ -935,7 +935,7 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, splx(s); return 0; - case CONS_CURSORTYPE: /* set cursor type (obsolete) */ + case CONS_CURSORTYPE: /* set cursor type (old interface + HIDDEN) */ s = spltty(); *(int *)data &= CONS_CURSOR_ATTRS; sc_change_cursor_shape(scp, *(int *)data, -1, -1); Modified: projects/krb5/sys/i386/include/intr_machdep.h ============================================================================== --- projects/krb5/sys/i386/include/intr_machdep.h Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/i386/include/intr_machdep.h Mon Aug 21 17:05:43 2017 (r322758) @@ -130,6 +130,7 @@ struct intsrc { u_long *is_straycount; u_int is_index; u_int is_handlers; + u_int is_cpu; }; struct trapframe; Modified: projects/krb5/sys/kern/subr_intr.c ============================================================================== --- projects/krb5/sys/kern/subr_intr.c Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/kern/subr_intr.c Mon Aug 21 17:05:43 2017 (r322758) @@ -1031,14 +1031,14 @@ intr_setup_irq(device_t dev, struct resource *res, dri if (flags & INTR_SOLO) { error = iscr_setup_filter(isrc, name, (intr_irq_filter_t *)filt, arg, cookiep); - debugf("irq %u setup filter error %d on %s\n", irq, error, + debugf("irq %u setup filter error %d on %s\n", isrc->isrc_irq, error, name); } else #endif { error = isrc_add_handler(isrc, name, filt, hand, arg, flags, cookiep); - debugf("irq %u add handler error %d on %s\n", irq, error, name); + debugf("irq %u add handler error %d on %s\n", isrc->isrc_irq, error, name); } if (error != 0) return (error); Modified: projects/krb5/sys/modules/Makefile ============================================================================== --- projects/krb5/sys/modules/Makefile Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/modules/Makefile Mon Aug 21 17:05:43 2017 (r322758) @@ -346,6 +346,8 @@ SUBDIR= \ ${_sf} \ ${_sfxge} \ sge \ + ${_sgx} \ + ${_sgx_linux} \ siba_bwn \ siftr \ siis \ @@ -713,6 +715,8 @@ _qlxgbe= qlxgbe .endif _qlnx= qlnx _sfxge= sfxge +_sgx= sgx +_sgx_linux= sgx_linux .if ${MK_BHYVE} != "no" || defined(ALL_MODULES) _vmm= vmm Modified: projects/krb5/sys/sys/consio.h ============================================================================== --- projects/krb5/sys/sys/consio.h Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/sys/consio.h Mon Aug 21 17:05:43 2017 (r322758) @@ -103,11 +103,15 @@ typedef struct ssaver ssaver_t; #define CONS_SSAVER _IOW('c', 5, ssaver_t) #define CONS_GSAVER _IOWR('c', 6, ssaver_t) -/* set the text cursor type (obsolete, see CONS_CURSORSHAPE below) */ /* -#define CONS_BLINK_CURSOR (1 << 0) -#define CONS_CHAR_CURSOR (1 << 1) -*/ + * Set the text cursor type. + * + * This is an old interface extended to support the CONS_HIDDEN_CURSOR bit. + * New code should use CONS_CURSORSHAPE. CONS_CURSOR_ATTRS gives the 3 + * bits supported by the (extended) old interface. The old interface is + * especially unusable for hiding the cursor (even with its extension) + * since it changes the cursor on all vtys. + */ #define CONS_CURSORTYPE _IOW('c', 7, int) /* set the bell type to audible or visual */ Modified: projects/krb5/sys/vm/vm_object.c ============================================================================== --- projects/krb5/sys/vm/vm_object.c Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/vm/vm_object.c Mon Aug 21 17:05:43 2017 (r322758) @@ -694,6 +694,54 @@ vm_object_destroy(vm_object_t object) } /* + * vm_object_terminate_pages removes any remaining pageable pages + * from the object and resets the object to an empty state. + */ +static void +vm_object_terminate_pages(vm_object_t object) +{ + vm_page_t p, p_next; + + VM_OBJECT_ASSERT_WLOCKED(object); + + /* + * Free any remaining pageable pages. This also removes them from the + * paging queues. However, don't free wired pages, just remove them + * from the object. Rather than incrementally removing each page from + * the object, the page and object are reset to any empty state. + */ + TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { + vm_page_assert_unbusied(p); + vm_page_lock(p); + /* + * Optimize the page's removal from the object by resetting + * its "object" field. Specifically, if the page is not + * wired, then the effect of this assignment is that + * vm_page_free()'s call to vm_page_remove() will return + * immediately without modifying the page or the object. + */ + p->object = NULL; + if (p->wire_count == 0) { + vm_page_free(p); + VM_CNT_INC(v_pfree); + } + vm_page_unlock(p); + } + /* + * If the object contained any pages, then reset it to an empty state. + * None of the object's fields, including "resident_page_count", were + * modified by the preceding loop. + */ + if (object->resident_page_count != 0) { + vm_radix_reclaim_allnodes(&object->rtree); + TAILQ_INIT(&object->memq); + object->resident_page_count = 0; + if (object->type == OBJT_VNODE) + vdrop(object->handle); + } +} + +/* * vm_object_terminate actually destroys the specified object, freeing * up all previously used resources. * @@ -703,7 +751,6 @@ vm_object_destroy(vm_object_t object) void vm_object_terminate(vm_object_t object) { - vm_page_t p, p_next; VM_OBJECT_ASSERT_WLOCKED(object); @@ -746,41 +793,8 @@ vm_object_terminate(vm_object_t object) ("vm_object_terminate: object with references, ref_count=%d", object->ref_count)); - /* - * Free any remaining pageable pages. This also removes them from the - * paging queues. However, don't free wired pages, just remove them - * from the object. Rather than incrementally removing each page from - * the object, the page and object are reset to any empty state. - */ - TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { - vm_page_assert_unbusied(p); - vm_page_lock(p); - /* - * Optimize the page's removal from the object by resetting - * its "object" field. Specifically, if the page is not - * wired, then the effect of this assignment is that - * vm_page_free()'s call to vm_page_remove() will return - * immediately without modifying the page or the object. - */ - p->object = NULL; - if (p->wire_count == 0) { - vm_page_free(p); - VM_CNT_INC(v_pfree); - } - vm_page_unlock(p); - } - /* - * If the object contained any pages, then reset it to an empty state. - * None of the object's fields, including "resident_page_count", were - * modified by the preceding loop. - */ - if (object->resident_page_count != 0) { - vm_radix_reclaim_allnodes(&object->rtree); - TAILQ_INIT(&object->memq); - object->resident_page_count = 0; - if (object->type == OBJT_VNODE) - vdrop(object->handle); - } + if ((object->flags & OBJ_PG_DTOR) == 0) + vm_object_terminate_pages(object); #if VM_NRESERVLEVEL > 0 if (__predict_false(!LIST_EMPTY(&object->rvq))) Modified: projects/krb5/sys/vm/vm_object.h ============================================================================== --- projects/krb5/sys/vm/vm_object.h Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/vm/vm_object.h Mon Aug 21 17:05:43 2017 (r322758) @@ -175,6 +175,7 @@ struct vm_object { #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ #define OBJ_PIPWNT 0x0040 /* paging in progress wanted */ +#define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ #define OBJ_TMPFS_DIRTY 0x0400 /* dirty tmpfs obj */ Modified: projects/krb5/sys/x86/x86/intr_machdep.c ============================================================================== --- projects/krb5/sys/x86/x86/intr_machdep.c Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/sys/x86/x86/intr_machdep.c Mon Aug 21 17:05:43 2017 (r322758) @@ -75,14 +75,12 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; -#ifdef SMP static struct intsrc *interrupt_sorted[NUM_IO_INTS]; CTASSERT(sizeof(interrupt_sources) == sizeof(interrupt_sorted)); static int intrbalance; SYSCTL_INT(_hw, OID_AUTO, intrbalance, CTLFLAG_RW, &intrbalance, 0, "Interrupt auto-balance interval (seconds). Zero disables."); static struct timeout_task intrbalance_task; -#endif static struct sx intrsrc_lock; static struct mtx intrpic_lock; static struct mtx intrcnt_lock; Modified: projects/krb5/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- projects/krb5/tools/build/mk/OptionalObsoleteFiles.inc Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/tools/build/mk/OptionalObsoleteFiles.inc Mon Aug 21 17:05:43 2017 (r322758) @@ -1557,6 +1557,22 @@ OLD_FILES+=usr/bin/g++ OLD_FILES+=usr/libexec/cc1plus .endif +.if ${MK_DEBUG_FILES} == no +.if exists(${DESTDIR}/usr/lib/debug) +DEBUG_DIRS!=find ${DESTDIR}/usr/lib/debug -mindepth 1 \ + -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_FILES!=find ${DESTDIR}/usr/lib/debug \ + \! -type d \! -path "${DESTDIR}/usr/lib/debug/boot/*" \! -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +DEBUG_LIBS!=find ${DESTDIR}/usr/lib/debug \! -type d -name "lib*.so*" \ + | sed -e 's,^${DESTDIR}/,,'; echo +OLD_DIRS+=${DEBUG_DIRS} +OLD_FILES+=${DEBUG_FILES} +OLD_LIBS+=${DEBUG_LIBS} +.endif +.endif + .if ${MK_DIALOG} == no OLD_FILES+=usr/bin/dialog OLD_FILES+=usr/bin/dpv Modified: projects/krb5/usr.sbin/vidcontrol/vidcontrol.c ============================================================================== --- projects/krb5/usr.sbin/vidcontrol/vidcontrol.c Mon Aug 21 16:23:44 2017 (r322757) +++ projects/krb5/usr.sbin/vidcontrol/vidcontrol.c Mon Aug 21 17:05:43 2017 (r322758) @@ -154,7 +154,7 @@ revert(void) ioctl(0, VT_ACTIVATE, cur_info.active_vty); - fprintf(stderr, "\033[=%dA", cur_info.console_info.mv_ovscan); + ioctl(0, KDSBORDER, cur_info.console_info.mv_ovscan); fprintf(stderr, "\033[=%dH", cur_info.console_info.mv_rev.fore); fprintf(stderr, "\033[=%dI", cur_info.console_info.mv_rev.back); @@ -957,11 +957,15 @@ set_border_color(char *arg) { int color; - if ((color = get_color_number(arg)) != -1) { - fprintf(stderr, "\033[=%dA", color); + color = get_color_number(arg); + if (color == -1) { + revert(); + errx(1, "invalid color '%s'", arg); } - else - usage(); + if (ioctl(0, KDSBORDER, color) != 0) { + revert(); + err(1, "ioctl(KD_SBORDER)"); + } } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708211705.v7LH5hw1011280>