diff options
author | John Levon <john.levon@joyent.com> | 2018-08-29 11:59:11 +0000 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2018-08-29 11:59:11 +0000 |
commit | 8c96f987edd0f06bbeca95261948cf4d97f0450c (patch) | |
tree | dd8430f17afb96a1b96ca2b8f684152c89b9d781 | |
parent | 52b14f3dd47c563098560bbf6fca5bcf21c307a5 (diff) | |
parent | 57b471aeb372d625bad5f7340300b0d5f2d7d7f7 (diff) | |
download | illumos-joyent-8c96f987edd0f06bbeca95261948cf4d97f0450c.tar.gz |
merge
65 files changed, 895 insertions, 142 deletions
@@ -13223,6 +13223,9 @@ f usr/share/man/man3c/getmntent.3c 0444 root bin f usr/share/man/man3c/getnetgrent.3c 0444 root bin s usr/share/man/man3c/getnetgrent_r.3c=getnetgrent.3c f usr/share/man/man3c/getopt.3c 0444 root bin +f usr/share/man/man3c/getopt_long.3c 0444 root bin +s usr/share/man/man3c/getopt_long_clip.3c=getopt_long.3c +s usr/share/man/man3c/getopt_long_only.3c=getopt_long.3c f usr/share/man/man3c/getpagesize.3c 0444 root bin f usr/share/man/man3c/getpagesizes.3c 0444 root bin f usr/share/man/man3c/getpass.3c 0444 root bin diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index e8d0be7d99..e58b1fb519 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -132,9 +132,9 @@ JAVA_ROOT= /usr/java BLD_JAVA_6= $(POUND_SIGN) BLD_JAVA_8= $(POUND_SIGN) -GCC_ROOT= /opt/gcc/4.4.4 -GCCLIBDIR= $(GCC_ROOT)/lib -GCCLIBDIR64= $(GCC_ROOT)/lib/$(MACH64) +GNUC_ROOT= /opt/gcc/4.4.4 +GCCLIBDIR= $(GNUC_ROOT)/lib +GCCLIBDIR64= $(GNUC_ROOT)/lib/$(MACH64) DOCBOOK_XSL_ROOT= /usr/share/sgml/docbook/xsl-stylesheets @@ -181,7 +181,7 @@ FLEX= /usr/bin/flex YACC= /usr/ccs/bin/yacc BISON= /usr/bin/bison CPP= /usr/lib/cpp -ANSI_CPP= $(GCC_ROOT)/bin/cpp +ANSI_CPP= $(GNUC_ROOT)/bin/cpp JAVAC= $(JAVA_ROOT)/bin/javac JAVAH= $(JAVA_ROOT)/bin/javah JAVADOC= $(JAVA_ROOT)/bin/javadoc diff --git a/usr/src/boot/sys/boot/efi/boot1/Makefile b/usr/src/boot/sys/boot/efi/boot1/Makefile index 9c0f56d75e..29014c6136 100644 --- a/usr/src/boot/sys/boot/efi/boot1/Makefile +++ b/usr/src/boot/sys/boot/efi/boot1/Makefile @@ -17,7 +17,7 @@ include $(SRC)/Makefile.master include $(SRC)/boot/Makefile.version -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LD= $(GNU_ROOT)/bin/gld OBJCOPY= $(GNU_ROOT)/bin/gobjcopy OBJDUMP= $(GNU_ROOT)/bin/gobjdump diff --git a/usr/src/boot/sys/boot/efi/libefi/Makefile b/usr/src/boot/sys/boot/efi/libefi/Makefile index 0886f0f352..768c792817 100644 --- a/usr/src/boot/sys/boot/efi/libefi/Makefile +++ b/usr/src/boot/sys/boot/efi/libefi/Makefile @@ -16,7 +16,7 @@ include $(SRC)/Makefile.master -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LIB= efi diff --git a/usr/src/boot/sys/boot/efi/loader/Makefile b/usr/src/boot/sys/boot/efi/loader/Makefile index 0ae2ebbe3b..40b1198998 100644 --- a/usr/src/boot/sys/boot/efi/loader/Makefile +++ b/usr/src/boot/sys/boot/efi/loader/Makefile @@ -17,7 +17,7 @@ include $(SRC)/Makefile.master include $(SRC)/boot/Makefile.version -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LD= $(GNU_ROOT)/bin/gld OBJCOPY= $(GNU_ROOT)/bin/gobjcopy OBJDUMP= $(GNU_ROOT)/bin/gobjdump diff --git a/usr/src/boot/sys/boot/ficl/Makefile.inc b/usr/src/boot/sys/boot/ficl/Makefile.inc index 98f9671c00..0213ace089 100644 --- a/usr/src/boot/sys/boot/ficl/Makefile.inc +++ b/usr/src/boot/sys/boot/ficl/Makefile.inc @@ -15,7 +15,7 @@ # -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc FICLDIR= $(SRC)/common/ficl all: lib diff --git a/usr/src/boot/sys/boot/i386/btx/btx/Makefile b/usr/src/boot/sys/boot/i386/btx/btx/Makefile index d31f59f0f9..3642e6e962 100644 --- a/usr/src/boot/sys/boot/i386/btx/btx/Makefile +++ b/usr/src/boot/sys/boot/i386/btx/btx/Makefile @@ -21,7 +21,7 @@ OBJS= btx.o AS= $(GNU_ROOT)/bin/gas LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc #.if defined(BOOT_BTX_NOHANG) #BOOT_BTX_FLAGS=0x1 diff --git a/usr/src/boot/sys/boot/i386/btx/btxldr/Makefile b/usr/src/boot/sys/boot/i386/btx/btxldr/Makefile index 338bf63ea0..4792ee0e16 100644 --- a/usr/src/boot/sys/boot/i386/btx/btxldr/Makefile +++ b/usr/src/boot/sys/boot/i386/btx/btxldr/Makefile @@ -21,7 +21,7 @@ OBJS= btxldr.o AS= $(GNU_ROOT)/bin/gas LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LOADER_ADDRESS=0x200000 CPPFLAGS= diff --git a/usr/src/boot/sys/boot/i386/btx/lib/Makefile b/usr/src/boot/sys/boot/i386/btx/lib/Makefile index a627021b66..68dd201f26 100644 --- a/usr/src/boot/sys/boot/i386/btx/lib/Makefile +++ b/usr/src/boot/sys/boot/i386/btx/lib/Makefile @@ -17,7 +17,7 @@ include $(SRC)/Makefile.master AS= $(GNU_ROOT)/bin/gas LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc CPPFLAGS= -I./../../common CFLAGS= -O2 -march=i386 -ffreestanding -mno-mmx -mno-3dnow -mno-sse -mno-sse2 diff --git a/usr/src/boot/sys/boot/i386/cdboot/Makefile b/usr/src/boot/sys/boot/i386/cdboot/Makefile index 37d06f9fab..a292046516 100644 --- a/usr/src/boot/sys/boot/i386/cdboot/Makefile +++ b/usr/src/boot/sys/boot/i386/cdboot/Makefile @@ -18,7 +18,7 @@ include $(SRC)/Makefile.master ROOT_BOOT = $(ROOT)/boot LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc CFLAGS = -O2 -I../common -march=i386 -ffreestanding -mno-mmx -mno-3dnow CFLAGS += -mno-sse -mno-sse2 -mno-sse3 -msoft-float -std=gnu99 -m32 diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile index 0a8793a0d8..97eb446b90 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile @@ -21,7 +21,7 @@ include $(SRC)/boot/Makefile.version AS= $(GNU_ROOT)/bin/gas LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc OBJCOPY= $(GNU_ROOT)/bin/gobjcopy PROG= gptzfsboot diff --git a/usr/src/boot/sys/boot/i386/libi386/Makefile b/usr/src/boot/sys/boot/i386/libi386/Makefile index 439d3c63fa..8b0d0bfc05 100644 --- a/usr/src/boot/sys/boot/i386/libi386/Makefile +++ b/usr/src/boot/sys/boot/i386/libi386/Makefile @@ -26,7 +26,7 @@ clobber: $(RM) machine x86 $(OBJS) libi386.a AS= $(GNU_ROOT)/bin/gas -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc OBJCOPY= $(GNU_ROOT)/bin/gobjcopy AS_FLAGS=--32 ASFLAGS=-m32 diff --git a/usr/src/boot/sys/boot/i386/loader/Makefile b/usr/src/boot/sys/boot/i386/loader/Makefile index 304900d32b..e38284da08 100644 --- a/usr/src/boot/sys/boot/i386/loader/Makefile +++ b/usr/src/boot/sys/boot/i386/loader/Makefile @@ -32,7 +32,7 @@ LIBI386= ../libi386/libi386.a # loader.help build needs better awk AWK= /usr/xpg4/bin/awk LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc OBJCOPY= $(GNU_ROOT)/bin/gobjcopy GSTRIP= $(GNU_ROOT)/bin/gstrip ROOT_BOOT= $(ROOT)/boot diff --git a/usr/src/boot/sys/boot/i386/pxeldr/Makefile b/usr/src/boot/sys/boot/i386/pxeldr/Makefile index fef1bcdb51..29324fc40b 100644 --- a/usr/src/boot/sys/boot/i386/pxeldr/Makefile +++ b/usr/src/boot/sys/boot/i386/pxeldr/Makefile @@ -17,7 +17,7 @@ include $(SRC)/Makefile.master ROOT_BOOT = $(ROOT)/boot -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LD= $(GNU_ROOT)/bin/gld DD= /usr/bin/dd CFLAGS= -O2 -I../../.. diff --git a/usr/src/boot/sys/boot/libstand/Makefile.com b/usr/src/boot/sys/boot/libstand/Makefile.com index 4db8ff77bf..fe4b002e7e 100644 --- a/usr/src/boot/sys/boot/libstand/Makefile.com +++ b/usr/src/boot/sys/boot/libstand/Makefile.com @@ -18,7 +18,7 @@ include $(SRC)/Makefile.master AS= $(GNU_ROOT)/bin/gas LD= $(GNU_ROOT)/bin/gld -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc LIBRARY= libstand.a diff --git a/usr/src/boot/sys/boot/zfs/Makefile.com b/usr/src/boot/sys/boot/zfs/Makefile.com index ee5c8ac1b8..7ece715f1d 100644 --- a/usr/src/boot/sys/boot/zfs/Makefile.com +++ b/usr/src/boot/sys/boot/zfs/Makefile.com @@ -25,7 +25,7 @@ clean: clobber clobber: $(RM) machine x86 $(OBJS) libzfsboot.a -CC= $(GCC_ROOT)/bin/gcc +CC= $(GNUC_ROOT)/bin/gcc CPPFLAGS= SRCS += ../zfs.c ../gzip.c diff --git a/usr/src/cmd/smbsrv/dtrace/smbd-all.d b/usr/src/cmd/smbsrv/dtrace/smbd-all.d index caf2426c6b..d694f63c20 100644 --- a/usr/src/cmd/smbsrv/dtrace/smbd-all.d +++ b/usr/src/cmd/smbsrv/dtrace/smbd-all.d @@ -11,7 +11,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -29,7 +29,7 @@ self int mask; */ pid$target:*smbd::entry, pid$target:libmlsvc.so.1::entry, -pid$target:libmlrpc.so.1::entry, +pid$target:libmlrpc.so.2::entry, pid$target:libsmbns.so.1::entry, pid$target:libsmb.so.1::entry, pid$target:libads.so.1::entry @@ -42,7 +42,7 @@ pid$target:libads.so.1::entry */ pid$target:*smbd::entry, pid$target:libmlsvc.so.1::entry, -pid$target:libmlrpc.so.1::entry, +pid$target:libmlrpc.so.2::entry, pid$target:libsmbns.so.1::entry, pid$target:libsmb.so.1::entry, pid$target:libads.so.1::entry @@ -116,7 +116,7 @@ pid$target::smb_wcequiv_strlen:return pid$target:*smbd::return, pid$target:libmlsvc.so.1::return, -pid$target:libmlrpc.so.1::return, +pid$target:libmlrpc.so.2::return, pid$target:libsmbns.so.1::return, pid$target:libsmb.so.1::return, pid$target:libads.so.1::return @@ -127,7 +127,7 @@ pid$target:libads.so.1::return pid$target:*smbd::return, pid$target:libmlsvc.so.1::return, -pid$target:libmlrpc.so.1::return, +pid$target:libmlrpc.so.2::return, pid$target:libsmbns.so.1::return, pid$target:libsmb.so.1::return, pid$target:libads.so.1::return diff --git a/usr/src/cmd/smbsrv/dtrace/smbd-authsvc.d b/usr/src/cmd/smbsrv/dtrace/smbd-authsvc.d index 0c9cb6a0ed..d0f057da11 100644 --- a/usr/src/cmd/smbsrv/dtrace/smbd-authsvc.d +++ b/usr/src/cmd/smbsrv/dtrace/smbd-authsvc.d @@ -11,7 +11,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -40,7 +40,7 @@ pid$target:*smbd:smbd_authsvc_work:entry */ pid$target:*smbd::entry, pid$target:libmlsvc.so.1::entry, -pid$target:libmlrpc.so.1::entry, +pid$target:libmlrpc.so.2::entry, pid$target:libsmbns.so.1::entry, pid$target:libsmb.so.1::entry, pid$target:libsmbfs.so.1::entry @@ -89,7 +89,7 @@ pid$target::smb_wcequiv_strlen:return pid$target:*smbd::return, pid$target:libmlsvc.so.1::return, -pid$target:libmlrpc.so.1::return, +pid$target:libmlrpc.so.2::return, pid$target:libsmbns.so.1::return, pid$target:libsmb.so.1::return, pid$target:libsmbfs.so.1::return diff --git a/usr/src/cmd/smbsrv/dtrace/smbd-doorsvc.d b/usr/src/cmd/smbsrv/dtrace/smbd-doorsvc.d index 51ffa68ad7..48253bdce2 100644 --- a/usr/src/cmd/smbsrv/dtrace/smbd-doorsvc.d +++ b/usr/src/cmd/smbsrv/dtrace/smbd-doorsvc.d @@ -11,7 +11,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -37,7 +37,7 @@ pid$target:*smbd:smbd_door_dispatch_op:entry */ pid$target:*smbd::entry, pid$target:libmlsvc.so.1::entry, -pid$target:libmlrpc.so.1::entry, +pid$target:libmlrpc.so.2::entry, pid$target:libsmbns.so.1::entry, pid$target:libsmb.so.1::entry, pid$target:libsmbfs.so.1::entry @@ -80,7 +80,7 @@ pid$target::smb_wcequiv_strlen:return pid$target:*smbd::return, pid$target:libmlsvc.so.1::return, -pid$target:libmlrpc.so.1::return, +pid$target:libmlrpc.so.2::return, pid$target:libsmbns.so.1::return, pid$target:libsmb.so.1::return, pid$target:libsmbfs.so.1::return diff --git a/usr/src/cmd/smbsrv/dtrace/smbd-pipesvc.d b/usr/src/cmd/smbsrv/dtrace/smbd-pipesvc.d index 1fe6ca8223..a0a7e688f2 100644 --- a/usr/src/cmd/smbsrv/dtrace/smbd-pipesvc.d +++ b/usr/src/cmd/smbsrv/dtrace/smbd-pipesvc.d @@ -11,7 +11,7 @@ */ /* - * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -25,7 +25,7 @@ self int trace; self int mask; /* - * The smbd_authsvc_work() function is a good place to start tracing + * The pipesvc_worker() function is a good place to start tracing * to watch RPC service actions. This worker handles all activity * for a given named pipe instance, including the payload from all * SMB read/write requests on this endpoint. @@ -40,7 +40,7 @@ pid$target:*smbd:pipesvc_worker:entry */ pid$target:*smbd::entry, pid$target:libmlsvc.so.1::entry, -pid$target:libmlrpc.so.1::entry, +pid$target:libmlrpc.so.2::entry, pid$target:libsmbns.so.1::entry, pid$target:libsmb.so.1::entry /self->trace > 0 && self->mask == 0/ @@ -92,7 +92,7 @@ pid$target::smb_wcequiv_strlen:return pid$target:*smbd::return, pid$target:libmlsvc.so.1::return, -pid$target:libmlrpc.so.1::return, +pid$target:libmlrpc.so.2::return, pid$target:libsmbns.so.1::return, pid$target:libsmb.so.1::return /self->trace > 0 && self->mask == 0/ @@ -104,7 +104,7 @@ pid$target:libsmb.so.1::return * This function in libmlrpc prints out lots of internal state. * Comment it out if you don't want that noise. */ -pid$target:libmlrpc.so.1:ndo_trace:entry +pid$target:libmlrpc.so.2:ndo_trace:entry /self->trace > 0 && self->mask == 0/ { printf("ndo_trace: %s", copyinstr(arg0)); diff --git a/usr/src/common/elfcap/elfcap.c b/usr/src/common/elfcap/elfcap.c index cefb986dfb..54aca25364 100644 --- a/usr/src/common/elfcap/elfcap.c +++ b/usr/src/common/elfcap/elfcap.c @@ -388,6 +388,10 @@ static const elfcap_desc_t hw2_386[ELFCAP_NUM_HW2_386] = { AV_386_2_AVX512_4FMAPS, STRDESC("AV_386_2_AVX512_4FMAPS"), STRDESC("AVX512_4FMAPS"), STRDESC("avx512_4fmaps"), }, + { /* 0x00100000 */ + AV_386_2_SHA, STRDESC("AV_386_2_SHA"), + STRDESC("SHA"), STRDESC("sha"), + } }; /* diff --git a/usr/src/common/elfcap/elfcap.h b/usr/src/common/elfcap/elfcap.h index 8c883bc208..123514b0a6 100644 --- a/usr/src/common/elfcap/elfcap.h +++ b/usr/src/common/elfcap/elfcap.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2017, Joyent, Inc. + * Copyright (c) 2018, Joyent, Inc. */ #ifndef _ELFCAP_DOT_H @@ -115,7 +115,7 @@ typedef enum { #define ELFCAP_NUM_SF1 3 #define ELFCAP_NUM_HW1_SPARC 17 #define ELFCAP_NUM_HW1_386 32 -#define ELFCAP_NUM_HW2_386 20 +#define ELFCAP_NUM_HW2_386 21 /* diff --git a/usr/src/grub/grub-0.97/Makefile.solaris.defs b/usr/src/grub/grub-0.97/Makefile.solaris.defs index a7e68a5239..faf41925c6 100644 --- a/usr/src/grub/grub-0.97/Makefile.solaris.defs +++ b/usr/src/grub/grub-0.97/Makefile.solaris.defs @@ -43,11 +43,11 @@ OPTION_DOCS = $(POUND_SIGN) OPTION_FS = $(POUND_SIGN) -BASE_CFLAGS = -B$(GCC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) -std=gnu89 -BASE_CCASFLAGS = -B$(GCC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) +BASE_CFLAGS = -B$(GNUC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) -std=gnu89 +BASE_CCASFLAGS = -B$(GNUC_ROOT)/bin/ -g $(CPPFLAGS) $(OPTFLAGS) BASE_LDFLAGS = -CC = $(GCC_ROOT)/bin/gcc +CC = $(GNUC_ROOT)/bin/gcc CFLAGS = $(BASE_CFLAGS) CCDEPMODE = depmode=none diff --git a/usr/src/head/errno.h b/usr/src/head/errno.h index 17e6b38942..f52fdeae21 100644 --- a/usr/src/head/errno.h +++ b/usr/src/head/errno.h @@ -60,6 +60,14 @@ extern int errno; #endif #endif /* defined(_REENTRANT) || defined(_TS_ERRNO) */ +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.2.2 */ +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +#endif /* __EXT1_VISIBLE */ + #ifdef __cplusplus } #endif diff --git a/usr/src/head/iso/stddef_iso.h b/usr/src/head/iso/stddef_iso.h index f42c1041d8..6e0ac631d6 100644 --- a/usr/src/head/iso/stddef_iso.h +++ b/usr/src/head/iso/stddef_iso.h @@ -95,11 +95,6 @@ typedef _MAX_ALIGNMENT_TYPE max_align_t; #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif -/* ISO/IEC 9899:2011 K.3.2.2 */ -#ifndef _ERRNO_T_DEFINED -#define _ERRNO_T_DEFINED -typedef int errno_t; -#endif #endif /* __EXT1_VISIBLE */ #ifdef __cplusplus diff --git a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c index 5a7a5b5467..9110e3bc62 100644 --- a/usr/src/lib/fm/topo/modules/common/disk/disk_common.c +++ b/usr/src/lib/fm/topo/modules/common/disk/disk_common.c @@ -550,7 +550,7 @@ disk_tnode_create(topo_mod_t *mod, tnode_t *parent, return (-1); } - if (dnode->ddn_devid != NULL && + if (dnode != NULL && dnode->ddn_devid != NULL && disk_add_temp_sensor(mod, dtn, dnode->ddn_devid) != 0) { topo_mod_dprintf(mod, "disk_tnode_create: failed to create " "temperature sensor node on bay=%d/disk=0", diff --git a/usr/src/lib/fm/topo/modules/common/ses/ses.c b/usr/src/lib/fm/topo/modules/common/ses/ses.c index 2f85476cb8..7fd6d03cd1 100644 --- a/usr/src/lib/fm/topo/modules/common/ses/ses.c +++ b/usr/src/lib/fm/topo/modules/common/ses/ses.c @@ -1207,6 +1207,9 @@ ses_create_disk(ses_enum_data_t *sdp, tnode_t *pnode, nvlist_t *props) /* * Skip devices that are not in a present (and possibly damaged) state. + * Also, skip devices that this expander is either not fully wired to, + * or are hidden due to SAS zoning, as indicated by the + * SES_ESC_NO_ACCESS state. */ if (nvlist_lookup_uint64(props, SES_PROP_STATUS_CODE, &status) != 0) return (0); @@ -1216,7 +1219,6 @@ ses_create_disk(ses_enum_data_t *sdp, tnode_t *pnode, nvlist_t *props) status != SES_ESC_CRITICAL && status != SES_ESC_NONCRITICAL && status != SES_ESC_UNRECOVERABLE && - status != SES_ESC_NO_ACCESS && status != SES_ESC_UNKNOWN) return (0); diff --git a/usr/src/lib/json_nvlist/json_nvlist.c b/usr/src/lib/json_nvlist/json_nvlist.c index f365c981f3..efe4feed77 100644 --- a/usr/src/lib/json_nvlist/json_nvlist.c +++ b/usr/src/lib/json_nvlist/json_nvlist.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2015 Joyent, Inc. + * Copyright 2018 Joyent, Inc. */ #include <stdio.h> @@ -331,7 +331,7 @@ hdlr_bareword(state_t *s) /* ARGSUSED */ static int collect_number(state_t *s, boolean_t *isint, int32_t *result, - double *fresult __unused) + double *fresult) { boolean_t neg = B_FALSE; int t; diff --git a/usr/src/lib/json_nvlist/json_nvlist.h b/usr/src/lib/json_nvlist/json_nvlist.h index ca01ef44f9..75a70f445b 100644 --- a/usr/src/lib/json_nvlist/json_nvlist.h +++ b/usr/src/lib/json_nvlist/json_nvlist.h @@ -17,7 +17,7 @@ #define _JSON_NVLIST_H #include <libnvpair.h> -#include <libcmdutils.h> +#include <libcustr.h> #ifdef __cplusplus extern "C" { diff --git a/usr/src/lib/libc/port/gen/memset_s.c b/usr/src/lib/libc/port/gen/memset_s.c index 9f3fcf8ec0..c77b02de20 100644 --- a/usr/src/lib/libc/port/gen/memset_s.c +++ b/usr/src/lib/libc/port/gen/memset_s.c @@ -27,6 +27,8 @@ * Copyright 2018 Nexenta Systems, Inc. */ +#define __STDC_WANT_LIB_EXT1__ 1 + #include "lint.h" #include <errno.h> diff --git a/usr/src/lib/libc/port/gen/set_constraint_handler_s.c b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c index 3466b8a1d0..2261a8df0a 100644 --- a/usr/src/lib/libc/port/gen/set_constraint_handler_s.c +++ b/usr/src/lib/libc/port/gen/set_constraint_handler_s.c @@ -27,6 +27,8 @@ * Copyright 2018 Nexenta Systems, Inc. */ +#define __STDC_WANT_LIB_EXT1__ 1 + #include "lint.h" #include <sys/types.h> diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers index 8c9d143a60..16b9f3d7fc 100644 --- a/usr/src/lib/libc/port/mapfile-vers +++ b/usr/src/lib/libc/port/mapfile-vers @@ -608,6 +608,11 @@ $if lf64 posix_fadvise64; posix_fallocate64; $endif +} SUNW_1.22.7; + +SYMBOL_VERSION SUNW_1.22.7 { # s10u10 - SunOS 5.10 (Solaris 10) patch additions + protected: + SUNW_1.22.7; } SUNW_1.22.6; SYMBOL_VERSION SUNW_1.22.6 { # s10u9 - SunOS 5.10 (Solaris 10) patch additions diff --git a/usr/src/lib/libmlrpc/common/ndr_process.c b/usr/src/lib/libmlrpc/common/ndr_process.c index 3188500a8b..19619a2448 100644 --- a/usr/src/lib/libmlrpc/common/ndr_process.c +++ b/usr/src/lib/libmlrpc/common/ndr_process.c @@ -22,7 +22,7 @@ * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * Copyright 2012 Milan Jurik. All rights reserved. - * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2018 Nexenta Systems, Inc. All rights reserved. */ /* @@ -1984,7 +1984,8 @@ ndr_s_wchar(ndr_ref_t *encl_ref) */ if (nds->m_op == NDR_M_OP_UNMARSHALL) { wcs[wlen] = 0; - slen = ndr__wcstombs(valp, wcs, wlen); + slen = encl_ref->size_is * NDR_MB_CHAR_MAX; + slen = ndr__wcstombs(valp, wcs, slen); if (slen == (size_t)-1) return (0); valp[slen] = '\0'; diff --git a/usr/src/man/man1m/zfs.1m b/usr/src/man/man1m/zfs.1m index 9703b0d54a..22d6c98310 100644 --- a/usr/src/man/man1m/zfs.1m +++ b/usr/src/man/man1m/zfs.1m @@ -26,7 +26,7 @@ .\" Copyright (c) 2015, Joyent, Inc. All rights reserved. .\" Copyright (c) 2014 by Adam Stevko. All rights reserved. .\" Copyright (c) 2014 Integros [integros.com] -.\" Copyright 2017 Nexenta Systems, Inc. +.\" Copyright 2018 Nexenta Systems, Inc. .\" Copyright 2018 Joyent, Inc. .\" .Dd Feb 10, 2018 @@ -3142,7 +3142,8 @@ for more information. .Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns .Ar setname Oc Ns ... .Ar filesystem Ns | Ns Ar volume -.br +.Xc +.It Xo .Nm .Cm allow .Op Fl dl @@ -3316,7 +3317,8 @@ and can be no more than 64 characters long. .Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns .Ar setname Oc Ns ... Oc .Ar filesystem Ns | Ns Ar volume -.br +.Xc +.It Xo .Nm .Cm unallow .Op Fl dlr @@ -3324,7 +3326,8 @@ and can be no more than 64 characters long. .Oo Ar perm Ns | Ns @ Ns Ar setname Ns Oo , Ns Ar perm Ns | Ns @ Ns .Ar setname Oc Ns ... Oc .Ar filesystem Ns | Ns Ar volume -.br +.Xc +.It Xo .Nm .Cm unallow .Op Fl r diff --git a/usr/src/man/man3c/Makefile b/usr/src/man/man3c/Makefile index 0012fc6992..540a58948e 100644 --- a/usr/src/man/man3c/Makefile +++ b/usr/src/man/man3c/Makefile @@ -15,6 +15,7 @@ # Copyright 2013, OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2014 Garrett D'Amore <garrett@damore.org> # Copyright 2018 Joyent, Inc. +# Copyright 2018 Jason King # include $(SRC)/Makefile.master @@ -177,6 +178,7 @@ MANFILES= __fbufsize.3c \ getmntent.3c \ getnetgrent.3c \ getopt.3c \ + getopt_long.3c \ getpagesize.3c \ getpagesizes.3c \ getpass.3c \ @@ -859,6 +861,8 @@ MANLINKS= FD_CLR.3c \ getlogin_r.3c \ getmntany.3c \ getnetgrent_r.3c \ + getopt_long_only.3c \ + getopt_long_clip.3c \ getpassphrase.3c \ getpwent.3c \ getpwent_r.3c \ @@ -1838,6 +1842,9 @@ setnetgrent.3c := LINKSRC = getnetgrent.3c get_nprocs_conf.3c := LINKSRC = get_nprocs.3c +getopt_long_clip.3c := LINKSRC = getopt_long.3c +getopt_long_only.3c := LINKSRC = getopt_long.3c + getpassphrase.3c := LINKSRC = getpass.3c setpriority.3c := LINKSRC = getpriority.3c diff --git a/usr/src/man/man3c/getopt.3c b/usr/src/man/man3c/getopt.3c index bcbdbcbeba..a14760446a 100644 --- a/usr/src/man/man3c/getopt.3c +++ b/usr/src/man/man3c/getopt.3c @@ -43,8 +43,9 @@ .\" Copyright 1989 AT&T .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved. .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved. +.\" Copyright 2018 Jason King .\" -.TH GETOPT 3C "Oct 16, 2007" +.TH GETOPT 3C "July 17, 2018" .SH NAME getopt \- command option parsing .SH SYNOPSIS @@ -454,6 +455,6 @@ Standard See below. For the Basic Utility Command syntax is Standard, see \fBstandards\fR(5). .SH SEE ALSO .LP -\fBIntro\fR(1), \fBgetopt\fR(1), \fBgetopts\fR(1), \fBgetsubopt\fR(3C), -\fBgettext\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5), -\fBstandards\fR(5) +\fBIntro\fR(1), \fBgetopt\fR(1), \fBgetopts\fR(1), \fBgetopt_long\fR(3C), +\fBgetsubopt\fR(3C), \fBgettext\fR(3C), \fBsetlocale\fR(3C), \fBattributes\fR(5), +\fBenviron\fR(5), \fBstandards\fR(5) diff --git a/usr/src/man/man3c/getopt_long.3c b/usr/src/man/man3c/getopt_long.3c new file mode 100644 index 0000000000..adf48e6750 --- /dev/null +++ b/usr/src/man/man3c/getopt_long.3c @@ -0,0 +1,591 @@ +.\" +.\" Copyright (c) 1988, 1991, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" 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. +.\" 3. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" +.\" Copyright 2018 Jason King +.\" Copyright 2018, Joyent, Inc. +.\" +.Dd July 17, 2018 +.Dt GETOPT_LONG 3C +.Os +.Sh NAME +.Nm getopt_long , +.Nm getopt_long_only +.Nd get long options from command line argument list +.Sh SYNOPSIS +.In getopt.h +.Vt extern char *optarg ; +.Vt extern int optind ; +.Vt extern int optopt ; +.Vt extern int opterr ; +.Ft int +.Fo getopt_long +.Fa "int argc" +.Fa "char * const *argv" +.Fa "const char *optstring" +.Fa "const struct option *longopts" +.Fa "int *longindex" +.Fc +.Ft int +.Fo getopt_long_only +.Fa "int argc" +.Fa "char * const *argv" +.Fa "const char *optstring" +.Fa "const struct option *longopts" +.Fa "int *longindex" +.Fc +.Ft int +.Fo getopt_long_clip +.Fa "int argc" +.Fa "char * const *argv" +.Fa "const char *optstring" +.Fa "const struct option *longopts" +.Fa "int *longindex" +.Fc +.Sh DESCRIPTION +The +.Fn getopt_long +function is similar to +.Xr getopt 3C +but it accepts options in two forms: words and characters. +The +.Fn getopt_long +function provides a superset of the functionality of +.Xr getopt 3C . +The +.Fn getopt_long +function +can be used in two ways. +.Pp +In the first way, every long option understood +by the program has a corresponding short option, and the option +structure is only used to translate from long options to short +options. +When used in this fashion, +.Fn getopt_long +behaves identically to +.Xr getopt 3C . +This is a good way to add long option processing to an existing program +with the minimum of rewriting. +.Pp +In the second mechanism, a long option sets a flag in the +.Vt option +structure passed, or will store a pointer to the command line argument +in the +.Vt option +structure passed to it for options that take arguments. +Additionally, +the long option's argument may be specified as a single argument with +an equal sign, e.g., +.Pp +.Dl "myprogram --myoption=somevalue" +.Pp +When a long option is processed, the call to +.Fn getopt_long +will return 0. +For this reason, long option processing without +shortcuts is not backwards compatible with +.Xr getopt 3C . +.Pp +It is possible to combine these methods, providing for long options +processing with short option equivalents for some options. +Less +frequently used options would be processed as long options only. +.Pp +In +.Fn getopt_long +and +.Fn getopt_long_only , +.Fa optstring +acts similar to +.Fa optstring +in +.Xr getopt 3C . +In addition, +.Fa optstring +can begin with +.Ql + +or +.Ql - . +If +.Fa optstring +begins with +.Ql + , +the first non-option terminates option processing. +This is equivalent to setting the environment variable +.Ev POSIXLY_CORRECT . +If +.Fa optstring +begins with +.Ql - , +non-options are treated as options to the argument +.Ql \e1 . +.Pp +If +.Fa optstring +does not begin with +.Ql + +and +.Ev POSIXLY_CORRECT +is not set, if +.Ql W\&; +appears in +.Fa optstring , +.Ql "-W myoption" +is treated the same as +.Ql "--myoption" +and +.Va optarg +is set to +.Ql myoption . +.Pp +In +.Fn getopt_long_clip , +.Ql + +and +.Ql - +are ignored at the beginning of a string. +.Pp +The +.Fn getopt_long , +.Fn getopt_long_only , +and +.Fn getopt_long_clip +functions require a structure to be initialized describing the long +options. +The structure is: +.Bd -literal -offset indent +struct option { + char *name; + int has_arg; + int *flag; + int val; +}; +.Ed +.Pp +The +.Fa name +field should contain the option name without the leading double dash. +.Pp +The +.Fa has_arg +field should be one of: +.Pp +.Bl -tag -width ".Dv optional_argument" -offset indent -compact +.It Dv no_argument +no argument to the option is expected +.It Dv required_argument +an argument to the option is required +.It Dv optional_argument +an argument to the option may be presented +.El +.Pp +If +.Fa flag +is not +.Dv NULL , +then the integer pointed to by it will be set to the +value in the +.Fa val +field and +.Va optopt +will be set to +.Sy 0 . +If the +.Fa flag +field is +.Dv NULL , +then the +.Fa val +field will be returned and +.Va optopt +is set to the value in the +.Fa val +field. +Setting +.Fa flag +to +.Dv NULL +and setting +.Fa val +to the corresponding short option will make this function act just +like +.Xr getopt 3C . +.Pp +If the +.Fa longindex +field is not +.Dv NULL , +then the integer pointed to by it will be set to the index of the long +option relative to +.Fa longopts . +.Pp +The last element of the +.Fa longopts +array has to be filled with zeroes. +.Pp +The +.Fn getopt_long_only +function behaves identically to +.Fn getopt_long +with the exception that long options may start with +.Ql - +in addition to +.Ql -- . +If an option starting with +.Ql - +does not match a long option but does match a single-character option, +the single-character option is returned. +.Pp +The +.Fn getopt_long_clip +function is a variation of +.Fn getopt_long +except that options must also adhere to the Sun CLIP specification. +Specifically, the major differences from +.Fn getopt_long +are: +.Bl -bullet -offset indent +.It +All option arguments are required +.Po +.Dv optional_argument +is treated the same as +.Dv required_argument +.Pc . +.It +Long options cannot be abbreviated on the command line. +.It +Long options must use a double dash +.Pq Ql -- . +.It +Option processing stops at the first non-option. +.It +All long options must have an eqivalent short option (single character) and +vice-versa. +.It +A leading +.Ql + +or +.Ql - +in +.Fa optstring +is ignored. +.Fa optstring +is treated as if it began after the leading +.Ql + +or +.Ql - . +.El +.Pp +On each call to +.Fn getopt_long , +.Fn getopt_long_only , +or +.Fn getopt_long , +.Va optind +is set to the +.Va argv +index of the +.Em next +argument to be processed. +.Va optind +is initialized to +.Sy 1 +prior to the first invocation of +.Fn getopt_long , +.Fn getopt_long_only , +or +.Fn getopt_long_clip . +.Pp +If +.Va opterr +is set to a non-zero value and +.Fa optstring +does not start with +.Ql \&: , +.Fn getopt_long , +.Fn getopt_long_only , +and +.Fn getopt_long_clip +will print an error message to +.Sy stderr +when an error or invalid option is encountered. +.Sh RETURN VALUES +If the +.Fa flag +field in +.Vt "struct option" +is +.Dv NULL , +.Fn getopt_long +and +.Fn getopt_long_only +return the value specified in the +.Fa val +field, which is usually just the corresponding short option. +If +.Fa flag +is not +.Dv NULL , +these functions return 0 and store +.Fa val +in the location pointed to by +.Fa flag . +These functions return +.Ql \&: +if there was a missing option argument, +.Ql \&? +if the user specified an unknown or ambiguous option, and +\-1 when the argument list has been exhausted. +.Pp +If a long option to +.Fn getopt_long_clip +is missing its equivalent short option (or vice-versa),\-1 is returned on the +first call to +.Fn getopt_long_clip , +and +.Dv errno +is set to +.Er EINVAL . +If +.Va opterr +is set to a non-zero value and +.Fa optstring +does not start with +.Ql \&: , +an error message will be written to +.Sy stderr . +.Pp +If +.Fa optstring +does not start with +.Ql \&: +and +.Fn getopt_long , +.Fn getopt_long_only , +or +.Fn getopt_long_clip +return +.Ql \&: +or +.Ql \&? , +if +.Va opterr +is set to a non-zero value, an error message is written to +.Dv stderr . +.Sh ENVIRONMENT +The following environment variables can effect the execution of +.Nm getopt_long , +.Nm getopt_long_only , +and +.Nm getopt_long_clip : +.Ev LANG , +.Ev LC_ALL , +.Ev LC_MESSAGES . +See +.Xr environ 5 . +.Bl -tag -width ".Ev POSIXLY_CORRECT" +.It Ev POSIXLY_CORRECT +If set, option processing stops when the first non-option is found and +a leading +.Ql - +or +.Ql + +in the +.Fa optstring +is ignored. +.El +.Sh USAGE +Similar to +.Xr getopt 3C , +since there is no unambiguous way to detect a missing option-argument except when the +option is the last option on the command line, the +.Fn getopt_long , +.Fn getopt_long_only , +and +.Fn getopt_long_clip +functions cannot fully check for mandatory arguments. +For example, the option string +.Ql ho\&: +with an input of +.Ql Fl o Fl h +will assume that +.Ql Fl h +is the required argument to +.Fl o +instead of assuming that +.Fl o +is missing its option-argument. +.Pp +Like +.Xr getopt 3C , +grouping options taking or requiring arguments with other options is a violation of the +Basic Utility Command syntax standard (see +.Xr Intro 1 ) . +For example, given the option string +.Ql cde\&: , +running: +.Pp +.Dl cmd Fl cde Ar ieio +.Pp +is incorrect. +Current versions of +.Nm getopt_long , +.Nm getopt_long_only , +and +.Nm getopt_long_clip +accept this, however future versions may not support this. +The correct invocation would be: +.Pp +.Dl cmd Fl cd Fl e Ar ieio +.Sh EXAMPLES +.Bd -literal -compact +int bflag, ch, fd; +int daggerset; + +/* options descriptor */ +static struct option longopts[] = { + { "buffy", no_argument, NULL, 'b' }, + { "fluoride", required_argument, NULL, 'f' }, + { "daggerset", no_argument, \*[Am]daggerset, 1 }, + { NULL, 0, NULL, 0 } +}; + +bflag = 0; +while ((ch = getopt_long(argc, argv, "bf:", longopts, NULL)) != -1) { + switch (ch) { + case 'b': + bflag = 1; + break; + case 'f': + if ((fd = open(optarg, O_RDONLY, 0)) == -1) + err(1, "unable to open %s", optarg); + break; + case 0: + if (daggerset) { + fprintf(stderr,"Buffy will use her dagger to " + "apply fluoride to dracula's teeth\en"); + } + break; + default: + usage(); + } +} +argc -= optind; +argv += optind; +.Ed +.Sh ERRORS +The +.Fn getopt_long_clip +function will fail if: +.Bl -tag -width EINVAL +.It Er EINVAL +A short option is missing a corresponding long option, or vice-versa. +.El +.Pp +There are no errors defined for +.Fn getopt_long +and +.Fn getopt_long_only . +.Sh IMPLEMENTATION DIFFERENCES +While the illumos implementations of +.Nm getopt_long +and +.Nm getopt_long_only +are broadly compatible with other implementations, the following edge cases +have historically been known to vary among implementations: +.Bl -bullet +.It +The setting of +.Va optopt +for long options with +.Fa flag +!= +.Dv NULL +in +.Vt struct option . +In illumos, +.Va optopt +is set to 0 (since +.Fa val +would never be returned). +.It +The setting of +.Va optarg +for long options without an argument that are +invoked via +.Ql -W +.Ql ( W\&; +in +.Fa optstring ) . +illumos sets +.Va optarg +to the option name (the argument of +.Ql -W ) . +.It +The handling of +.Ql -W +with an argument that is not (a prefix to) a known +long option +.Ql ( W\&; +in +.Fa optstring ) . +illumos treats this as an error (unknown option) and returns +.Ql \&? +with +.Va optopt +set to 0 and +.Va optarg +set to +.Dv NULL . +.It +illumos +may not permute the argument vector at the same points in +the calling sequence as other implementations. +The aspects normally used by +the caller (ordering after \-1 is returned, the value of +.Va optind +relative +to current positions) are the same, though. +(We often do fewer variable swaps.) +.El +.Sh INTERFACE STABILITY +Committed +.Sh MT-LEVEL +Unsafe +.Sh SEE ALSO +.Xr getopt 3C +.Sh BUGS +The +.Fa argv +argument is not really +.Vt const +as its elements may be permuted (unless +.Ev POSIXLY_CORRECT +is set). diff --git a/usr/src/pkg/manifests/system-header.mf b/usr/src/pkg/manifests/system-header.mf index f3721b3ce8..3f62bda986 100644 --- a/usr/src/pkg/manifests/system-header.mf +++ b/usr/src/pkg/manifests/system-header.mf @@ -1675,6 +1675,7 @@ $(i386_ONLY)file path=usr/platform/i86pc/include/sys/cram.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/ddi_subrdefs.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/debug_info.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/fastboot.h +$(i386_ONLY)file path=usr/platform/i86pc/include/sys/ht.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/mach_mmu.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/machclock.h $(i386_ONLY)file path=usr/platform/i86pc/include/sys/machcpuvar.h @@ -1730,6 +1731,7 @@ $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/errclassify.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/fhc.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/gpio_87317.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/hpc3130_events.h +$(sparc_ONLY)file path=usr/platform/sun4u/include/sys/ht.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/i2c/clients/hpc3130.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/i2c/clients/i2c_client.h $(sparc_ONLY)file path=usr/platform/sun4u/include/sys/i2c/clients/lm75.h @@ -1793,6 +1795,7 @@ $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/dvma.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/eeprom.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/fcode.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/hsvc.h +$(sparc_ONLY)file path=usr/platform/sun4v/include/sys/ht.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/hypervisor_api.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/idprom.h $(sparc_ONLY)file path=usr/platform/sun4v/include/sys/intr.h diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc index 0cf7b241e0..846ed5bf99 100644 --- a/usr/src/pkg/manifests/system-library.man3c.inc +++ b/usr/src/pkg/manifests/system-library.man3c.inc @@ -14,7 +14,8 @@ # Copyright 2018 Nexenta Systems, Inc. # Copyright 2013 OmniTI Computer Consulting, Inc. All rights reserved. # Copyright 2014 Garrett D'Amore <garrett@damore.org> -# Copyright 2018 Joyent, Inc. +# Copyright 2018 Jason King +# Copyright 2018, Joyent, Inc. # file path=usr/share/man/man3c/__fbufsize.3c @@ -173,6 +174,7 @@ file path=usr/share/man/man3c/getlogin.3c file path=usr/share/man/man3c/getmntent.3c file path=usr/share/man/man3c/getnetgrent.3c file path=usr/share/man/man3c/getopt.3c +file path=usr/share/man/man3c/getopt_long.3c file path=usr/share/man/man3c/getpagesize.3c file path=usr/share/man/man3c/getpagesizes.3c file path=usr/share/man/man3c/getpass.3c @@ -858,6 +860,8 @@ link path=usr/share/man/man3c/gethrvtime.3c target=gethrtime.3c link path=usr/share/man/man3c/getlogin_r.3c target=getlogin.3c link path=usr/share/man/man3c/getmntany.3c target=getmntent.3c link path=usr/share/man/man3c/getnetgrent_r.3c target=getnetgrent.3c +link path=usr/share/man/man3c/getopt_long_clip.3c target=getopt_long.3c +link path=usr/share/man/man3c/getopt_long_only.3c target=getopt_long.3c link path=usr/share/man/man3c/getpassphrase.3c target=getpass.3c link path=usr/share/man/man3c/getpwent.3c target=getpwnam.3c link path=usr/share/man/man3c/getpwent_r.3c target=getpwnam.3c diff --git a/usr/src/psm/stand/bootblks/ufs/i386/Makefile b/usr/src/psm/stand/bootblks/ufs/i386/Makefile index 25e39431c7..0d5b74fda8 100644 --- a/usr/src/psm/stand/bootblks/ufs/i386/Makefile +++ b/usr/src/psm/stand/bootblks/ufs/i386/Makefile @@ -32,8 +32,8 @@ BASEDIR = ../.. include $(BASEDIR)/ufs/Makefile.ufs -CC = $(GCC_ROOT)/bin/gcc -ASFLAGS = -B$(GCC_ROOT)/bin/ -fno-builtin -nostdinc +CC = $(GNUC_ROOT)/bin/gcc +ASFLAGS = -B$(GNUC_ROOT)/bin/ -fno-builtin -nostdinc CPPFLAGS = LD = $(GNU_ROOT)/bin/gld diff --git a/usr/src/test/libc-tests/tests/memset_s.c b/usr/src/test/libc-tests/tests/memset_s.c index 4a73459bc5..eb44230d60 100644 --- a/usr/src/test/libc-tests/tests/memset_s.c +++ b/usr/src/test/libc-tests/tests/memset_s.c @@ -24,6 +24,7 @@ */ #include <assert.h> +#include <errno.h> #include <stdint.h> #include <stdlib.h> #include <string.h> diff --git a/usr/src/tools/cpcgen/Makefile b/usr/src/tools/cpcgen/Makefile index 23f412439a..ec38f80e3d 100644 --- a/usr/src/tools/cpcgen/Makefile +++ b/usr/src/tools/cpcgen/Makefile @@ -19,7 +19,7 @@ OBJS = cpcgen.o json_nvlist.o custr.o include ../Makefile.tools LDLIBS += -lnvpair -CPPFLAGS += -I$(SRC)/lib/json_nvlist/ +CPPFLAGS += -I$(SRC)/lib/json_nvlist/ -I$(SRC)/lib/libcustr/common all: $(PROG) diff --git a/usr/src/tools/cpcgen/cpcgen.c b/usr/src/tools/cpcgen/cpcgen.c index daa9c255f9..d876b913fc 100644 --- a/usr/src/tools/cpcgen/cpcgen.c +++ b/usr/src/tools/cpcgen/cpcgen.c @@ -30,6 +30,9 @@ #include <sys/param.h> #include <assert.h> #include <ctype.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> #include <json_nvlist.h> diff --git a/usr/src/tools/cw/Makefile b/usr/src/tools/cw/Makefile index 6c9057a6ff..8764d1cd18 100644 --- a/usr/src/tools/cw/Makefile +++ b/usr/src/tools/cw/Makefile @@ -32,8 +32,8 @@ include ../Makefile.tools # Bootstrap problem -- we have to build cw before we can use it i386_CC= $(SPRO_VROOT)/bin/cc sparc_CC= $(SPRO_VROOT)/bin/cc -$(__GNUC)i386_CC= $(GCC_ROOT)/bin/gcc -$(__GNUC)sparc_CC= $(GCC_ROOT)/bin/gcc +$(__GNUC)i386_CC= $(GNUC_ROOT)/bin/gcc +$(__GNUC)sparc_CC= $(GNUC_ROOT)/bin/gcc CFLAGS += $(CCVERBOSE) @@ -48,9 +48,9 @@ $(__GNUC)LDLIBS += -lc $(__GNUC)LDFLAGS= $(MAPFILE.NES:%=-Wl,-M%) CPPFLAGS += -DDEFAULT_CC_DIR='"$(SPRO_VROOT)/bin"' -CPPFLAGS += -DDEFAULT_GCC_DIR='"$(GCC_ROOT)/bin"' +CPPFLAGS += -DDEFAULT_GCC_DIR='"$(GNUC_ROOT)/bin"' CPPFLAGS += -DDEFAULT_CPLUSPLUS_DIR='"$(SPRO_VROOT)/bin"' -CPPFLAGS += -DDEFAULT_GPLUSPLUS_DIR='"$(GCC_ROOT)/bin"' +CPPFLAGS += -DDEFAULT_GPLUSPLUS_DIR='"$(GNUC_ROOT)/bin"' $(ROOTONBLDMAN1ONBLDFILES) := FILEMODE= 644 diff --git a/usr/src/tools/cw/cw.1onbld b/usr/src/tools/cw/cw.1onbld index e6651bd853..86923029d2 100644 --- a/usr/src/tools/cw/cw.1onbld +++ b/usr/src/tools/cw/cw.1onbld @@ -21,7 +21,7 @@ .\" Copyright 2010 Sun Microsystems, Inc. All rights reserved. .\" Use is subject to license terms. .\" -.TH CW 1ONBLD "Mar 22, 2010" +.TH CW 1ONBLD "August 16, 2018" .SH NAME .I cw \- invoke one or more compilers with argument translation @@ -197,18 +197,22 @@ will be used. If these variables are set in the environment, they specify the full pathname for the GNU C and C++ compilers, respectively. .TP 4 -.B CW_GCC_DIR, CW_GPLUSPLUS_DIR, GNU_ROOT +.B CW_GCC_DIR, CW_GPLUSPLUS_DIR, GNUC_ROOT If CW_GCC or CW_GPLUSPLUS are not set, these variables alter the search path for GNU compilers in a manner similar to that described above for the Studio compilers. Specifically: -.B +.LP If CW_GCC_DIR is set, the GNU C compiler in \fI$CW_GCC_DIR\fP will be used. Likewise, if CW_GPLUSPLUS_DIR is set, the GNU C++ compiler in \fI$CW_GPLUSPLUS_DIR\fP will be used. -Otherwise, if GNU_ROOT is set, the GNU C and C++ compilers -in \fI$GCC_ROOT/bin\fP will be used. -Otherwise, the GNU compilers in a predefined default location -will be used. +Otherwise, if GNUC_ROOT is set, the GNU C and C++ compilers +in \fI$GNUC_ROOT/bin\fP will be used. Previously \fI$GCC_ROOT\fP was +used to in place of \fI$GNUC_ROOT\fP; however, because that environment +variable has special meaning to gcc, if it is encountered in bldenv or +nightly(1ONBLD), it will be translated to \fI$GNUC_ROOT\fP. +.LP +If none of the aforementioned environment variables are set, the GNU +compilers in a predefined default location will be used. .SH EXIT STATUS .LP The following exit status values are returned: diff --git a/usr/src/tools/cw/cw.c b/usr/src/tools/cw/cw.c index 40613c11b5..33a23ddee8 100644 --- a/usr/src/tools/cw/cw.c +++ b/usr/src/tools/cw/cw.c @@ -1836,7 +1836,7 @@ main(int argc, char **argv) "%s/SUNWspro/SS12/bin", dir); } - if ((dir = getenv("GCC_ROOT")) != NULL) { + if ((dir = getenv("GNUC_ROOT")) != NULL) { (void) snprintf(default_dir[CW_C_GCC], MAXPATHLEN, "%s/bin", dir); } diff --git a/usr/src/tools/quick/make-smbsrv b/usr/src/tools/quick/make-smbsrv index 18c1baddcf..1cc55a999b 100755 --- a/usr/src/tools/quick/make-smbsrv +++ b/usr/src/tools/quick/make-smbsrv @@ -262,6 +262,8 @@ do_tags() { find head -name '*.h' -print |sort find lib/smbsrv -name '*.[ch]' -print |sort find lib/libsmbfs -name '*.[ch]' -print |sort + find lib/libmlrpc -name '*.ndl' -print |sort + find lib/libmlrpc -name '*.[ch]' -print |sort find lib/libads -name '*.[ch]' -print |sort find lib/libgss -name '*.[ch]' -print |sort find cmd/smbsrv -name '*.[ch]' -print |sort diff --git a/usr/src/tools/scripts/bldenv.sh b/usr/src/tools/scripts/bldenv.sh index c60f072cc1..76e5d81e58 100644 --- a/usr/src/tools/scripts/bldenv.sh +++ b/usr/src/tools/scripts/bldenv.sh @@ -299,6 +299,16 @@ fi export DMAKE_MODE=${DMAKE_MODE:-parallel} +# +# Work around folks who have historically used GCC_ROOT and convert it to +# GNUC_ROOT. We leave GCC_ROOT in the environment for now (though this could +# mess up the case where multiple different gcc versions are being used to +# shadow). +# +if [[ -n "${GCC_ROOT}" ]]; then + export GNUC_ROOT=${GCC_ROOT} +fi + DEF_STRIPFLAG="-s" TMPDIR="/tmp" diff --git a/usr/src/tools/scripts/nightly.sh b/usr/src/tools/scripts/nightly.sh index 34b0790701..b2186e701b 100644 --- a/usr/src/tools/scripts/nightly.sh +++ b/usr/src/tools/scripts/nightly.sh @@ -958,6 +958,16 @@ mkdir -p $TMPDIR || exit 1 chmod 777 $TMPDIR # +# Work around folks who have historically used GCC_ROOT and convert it to +# GNUC_ROOT. We leave GCC_ROOT in the environment for now (though this could +# mess up the case where multiple different gcc versions are being used to +# shadow). +# +if [[ -n "${GCC_ROOT}" ]]; then + export GNUC_ROOT=${GCC_ROOT} +fi + +# # Tools should only be built non-DEBUG. Keep track of the tools proto # area path relative to $TOOLS, because the latter changes in an # export build. diff --git a/usr/src/tools/scripts/ws.sh b/usr/src/tools/scripts/ws.sh index 3d9084c428..d887d20df5 100644 --- a/usr/src/tools/scripts/ws.sh +++ b/usr/src/tools/scripts/ws.sh @@ -328,6 +328,16 @@ ENVLDLIBS1= ENVLDLIBS2= ENVLDLIBS3= +# +# Work around folks who have historically used GCC_ROOT and convert it to +# GNUC_ROOT. We leave GCC_ROOT in the environment for now (though this could +# mess up the case where multiple different gcc versions are being used to +# shadow). +# +if [[ -n "${GCC_ROOT}" ]]; then + export GNUC_ROOT=${GCC_ROOT} +fi + PROTO1=`check_proto $PROTO1` if [[ -n "$PROTO1" ]]; then # first proto area specifed ROOT=$PROTO1 diff --git a/usr/src/uts/common/fs/smbsrv/smb_cmn_rename.c b/usr/src/uts/common/fs/smbsrv/smb_cmn_rename.c index 0cc35b30ac..9997538c03 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_cmn_rename.c +++ b/usr/src/uts/common/fs/smbsrv/smb_cmn_rename.c @@ -227,7 +227,7 @@ smb_common_rename(smb_request_t *sr, smb_fqi_t *src_fqi, smb_fqi_t *dst_fqi) */ dst_fnode = dst_fqi->fq_fnode; - if (!(sr->arg.dirop.flags && SMB_RENAME_FLAG_OVERWRITE)) { + if ((sr->arg.dirop.flags & SMB_RENAME_FLAG_OVERWRITE) == 0) { smb_rename_release_src(sr); smb_node_release(dst_fnode); smb_node_release(dst_dnode); diff --git a/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c b/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c index 3900fbd6d6..7e0e658601 100644 --- a/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c +++ b/usr/src/uts/common/io/usb/hcd/ehci/ehci_util.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, Joyent, Inc. */ /* @@ -834,8 +835,7 @@ skip_intr: * Register FIXED or MSI interrupts. */ static int -ehci_add_intrs(ehci_state_t *ehcip, - int intr_type) +ehci_add_intrs(ehci_state_t *ehcip, int intr_type) { int actual, avail, intr_size, count = 0; int i, flag, ret; @@ -1232,8 +1232,7 @@ ehci_init_check_status(ehci_state_t *ehcip) * Initialize the Host Controller (HC). */ int -ehci_init_ctlr(ehci_state_t *ehcip, - int init_type) +ehci_init_ctlr(ehci_state_t *ehcip, int init_type) { USB_DPRINTF_L4(PRINT_MASK_ATTA, ehcip->ehci_log_hdl, "ehci_init_ctlr:"); @@ -1406,6 +1405,19 @@ ehci_take_control(ehci_state_t *ehcip) extended_cap = pci_config_get32(ehcip->ehci_config_handle, extended_cap_offset); + /* + * It's possible that we'll receive an invalid PCI read here due + * to something going wrong due to platform firmware. This has + * been observed in the wild depending on the version of ACPI in + * use. If this happens, we'll assume that the capability does + * not exist and that we do not need to take control from the + * BIOS. + */ + if (extended_cap == PCI_EINVAL32) { + extended_cap_id = EHCI_EX_CAP_ID_RESERVED; + break; + } + /* Get the capability ID */ extended_cap_id = (extended_cap & EHCI_EX_CAP_ID) >> EHCI_EX_CAP_ID_SHIFT; @@ -1418,6 +1430,7 @@ ehci_take_control(ehci_state_t *ehcip) /* Get the offset of the next capability */ extended_cap_offset = (extended_cap & EHCI_EX_CAP_NEXT_PTR) >> EHCI_EX_CAP_NEXT_PTR_SHIFT; + } /* @@ -2976,7 +2989,8 @@ ehci_lattice_parent(uint_t node) * Based on the "real" array leaf node and interval, get the periodic node. */ static uint_t -ehci_find_periodic_node(uint_t leaf, int interval) { +ehci_find_periodic_node(uint_t leaf, int interval) +{ uint_t lattice_leaf; uint_t height = ehci_lattice_height(interval); uint_t pnode; diff --git a/usr/src/uts/common/sys/auxv_386.h b/usr/src/uts/common/sys/auxv_386.h index dbc6116c25..0f367a4b19 100644 --- a/usr/src/uts/common/sys/auxv_386.h +++ b/usr/src/uts/common/sys/auxv_386.h @@ -106,9 +106,10 @@ extern "C" { #define AV_386_2_AVX512VPOPCDQ 0x20000 /* AVX512VPOPCNTDQ insns */ #define AV_386_2_AVX512_4NNIW 0x40000 /* AVX512 4NNIW insns */ #define AV_386_2_AVX512_4FMAPS 0x80000 /* AVX512 4FMAPS insns */ +#define AV_386_2_SHA 0x100000 /* SHA insns */ #define FMT_AV_386_2 \ - "\024avx512_4fmaps\023avx512_4nniw\022avx512vpopcntdq" \ + "\025sha\024avx512_4fmaps\023avx512_4nniw\022avx512vpopcntdq" \ "\021avx512vbmi\020avx512vl\017avx512bw\016avx512cd" \ "\015avx512er\014avx512pf\013avx512ifma\012avx512dq\011avx512f" \ "\010rdseed\07adx\06avx2\05fma\04bmi2\03bmi1\02rdrand\01f16c" diff --git a/usr/src/uts/common/sys/feature_tests.h b/usr/src/uts/common/sys/feature_tests.h index 7e4b4fc67f..41c0fb2a4c 100644 --- a/usr/src/uts/common/sys/feature_tests.h +++ b/usr/src/uts/common/sys/feature_tests.h @@ -437,19 +437,14 @@ extern "C" { #endif /* ISO/IEC 9899:2011 Annex K */ -#if !defined(_STRICT_SYMBOLS) -#define __EXT1_VISIBLE 1 -#else -#define __EXT1_VISIBLE 0 -#endif - #if defined(__STDC_WANT_LIB_EXT1__) -#undef __EXT1_VISIBLE #if __STDC_WANT_LIB_EXT1__ #define __EXT1_VISIBLE 1 #else #define __EXT1_VISIBLE 0 #endif +#else +#define __EXT1_VISIBLE 0 #endif /* __STDC_WANT_LIB_EXT1__ */ /* diff --git a/usr/src/uts/common/sys/usb/hcd/ehci/ehci.h b/usr/src/uts/common/sys/usb/hcd/ehci/ehci.h index 76766ce68e..ce8d735ac8 100644 --- a/usr/src/uts/common/sys/usb/hcd/ehci/ehci.h +++ b/usr/src/uts/common/sys/usb/hcd/ehci/ehci.h @@ -280,6 +280,7 @@ typedef volatile struct ehci_regs { #define EHCI_EX_CAP_NEXT_PTR_SHIFT 8 #define EHCI_EX_CAP_ID 0x000000FF #define EHCI_EX_CAP_ID_SHIFT 0 +#define EHCI_EX_CAP_ID_RESERVED 0 #define EHCI_EX_CAP_ID_BIOS_HANDOFF 1 #define EHCI_LEGSUP_OS_OWNED_SEM 0x01000000 diff --git a/usr/src/uts/i86pc/io/apix/apix_utils.c b/usr/src/uts/i86pc/io/apix/apix_utils.c index 0bdc7c6cc9..268aa5a391 100644 --- a/usr/src/uts/i86pc/io/apix/apix_utils.c +++ b/usr/src/uts/i86pc/io/apix/apix_utils.c @@ -29,6 +29,7 @@ /* * Copyright 2013 Nexenta Systems, Inc. All rights reserved. * Copyright 2013 Pluribus Networks, Inc. + * Copyright 2018 Joyent, Inc. */ #include <sys/processor.h> @@ -66,6 +67,7 @@ #include <sys/x_call.h> #include <sys/reboot.h> #include <sys/apix.h> +#include <sys/ht.h> static int apix_get_avail_vector_oncpu(uint32_t, int, int); static apix_vector_t *apix_init_vector(processorid_t, uchar_t); @@ -803,6 +805,9 @@ apix_insert_av(apix_vector_t *vecp, void *intr_id, avfunc f, caddr_t arg1, vecp->v_share++; vecp->v_pri = (ipl > vecp->v_pri) ? ipl : vecp->v_pri; + + ht_intr_alloc_pil(vecp->v_pri); + if (vecp->v_autovect == NULL) { /* Nothing on list - put it at head */ vecp->v_autovect = mem; return; @@ -1468,7 +1473,7 @@ apix_rebind(apix_vector_t *vecp, processorid_t newcpu, int count) if (!apix_is_cpu_enabled(newcpu)) return (NULL); - if (vecp->v_cpuid == newcpu) /* rebind to the same cpu */ + if (vecp->v_cpuid == newcpu) /* rebind to the same cpu */ return (vecp); APIX_ENTER_CPU_LOCK(oldcpu); diff --git a/usr/src/uts/i86pc/io/pcplusmp/apic.c b/usr/src/uts/i86pc/io/pcplusmp/apic.c index 0649afa3f3..9d1f0962fc 100644 --- a/usr/src/uts/i86pc/io/pcplusmp/apic.c +++ b/usr/src/uts/i86pc/io/pcplusmp/apic.c @@ -82,6 +82,7 @@ #include <sys/hpet.h> #include <sys/apic_common.h> #include <sys/apic_timer.h> +#include <sys/ht.h> /* * Local Function Prototypes @@ -300,6 +301,11 @@ apic_init(void) apic_ipltopri[j] = (i << APIC_IPL_SHIFT) + APIC_BASE_VECT; apic_init_common(); + /* + * For pcplusmp, we'll keep things simple and always disable this. + */ + ht_intr_alloc_pil(XC_CPUPOKE_PIL); + apic_pir_vect = apic_get_ipivect(XC_CPUPOKE_PIL, -1); #if !defined(__amd64) diff --git a/usr/src/uts/i86pc/io/vmm/amd/svm.c b/usr/src/uts/i86pc/io/vmm/amd/svm.c index f3ce78148b..cb6251a791 100644 --- a/usr/src/uts/i86pc/io/vmm/amd/svm.c +++ b/usr/src/uts/i86pc/io/vmm/amd/svm.c @@ -1377,6 +1377,7 @@ svm_vmexit(struct svm_softc *svm_sc, int vcpu, struct vm_exit *vmexit) */ reflect = 0; VCPU_CTR0(svm_sc->vm, vcpu, "Vectoring to MCE handler"); + /* XXXJOY: we will need equivalent of vmx_call_trap */ __asm __volatile("int $18"); break; case IDT_PF: diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx.c b/usr/src/uts/i86pc/io/vmm/intel/vmx.c index b119cde3c6..3e0cac30c2 100644 --- a/usr/src/uts/i86pc/io/vmm/intel/vmx.c +++ b/usr/src/uts/i86pc/io/vmm/intel/vmx.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include <sys/smp_impldefs.h> #include <sys/ht.h> #include <sys/hma.h> +#include <sys/trap.h> #endif #include <vm/vm.h> @@ -2391,7 +2392,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) #ifdef __FreeBSD__ __asm __volatile("int $18"); #else - panic("XXX vector to MCE handler"); + vmx_call_trap(T_MCE); #endif return (1); } @@ -2680,7 +2681,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_exit *vmexit) #ifdef __FreeBSD__ __asm __volatile("int $18"); #else - panic("XXX vector to MCE handler"); + vmx_call_trap(T_MCE); #endif return (1); } @@ -2885,7 +2886,7 @@ vmx_exit_handle_nmi(struct vmx *vmx, int vcpuid, struct vm_exit *vmexit) #ifdef __FreeBSD__ __asm __volatile("int $2"); #else - panic("XXX vector to NMI handler"); + vmx_call_trap(T_NMIFLT); #endif } } diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx.h b/usr/src/uts/i86pc/io/vmm/intel/vmx.h index 0ee83fcc81..2755661eb4 100644 --- a/usr/src/uts/i86pc/io/vmm/intel/vmx.h +++ b/usr/src/uts/i86pc/io/vmm/intel/vmx.h @@ -156,6 +156,9 @@ CTASSERT((offsetof(struct vmx, pir_desc[0]) & 63) == 0); #define VMX_VMWRITE_ERROR 4 int vmx_enter_guest(struct vmxctx *ctx, struct vmx *vmx, int launched); void vmx_call_isr(uintptr_t entry); +#ifndef __FreeBSD__ +void vmx_call_trap(uint64_t); +#endif u_long vmx_fix_cr0(u_long cr0); u_long vmx_fix_cr4(u_long cr4); diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx_support.s b/usr/src/uts/i86pc/io/vmm/intel/vmx_support.s index 48e8847f2f..a2375e3a6c 100644 --- a/usr/src/uts/i86pc/io/vmm/intel/vmx_support.s +++ b/usr/src/uts/i86pc/io/vmm/intel/vmx_support.s @@ -37,7 +37,7 @@ * http://www.illumos.org/license/CDDL. * * Copyright 2013 Pluribus Networks Inc. - * Copyright 2017 Joyent, Inc. + * Copyright 2018 Joyent, Inc. */ #include <sys/asm_linkage.h> @@ -381,4 +381,44 @@ ENTRY_NP(vmx_call_isr) ret SET_SIZE(vmx_call_isr) +/* + * %rdi = trapno + * + * This variant is for any explicit exception injection that we need: in this + * case, we can't just, for example, do a direct "int $2", as that will then + * trash our %cr3 via tr_nmiint due to KPTI. So we have to fake a trap frame in + * a similar fashion to vmx_call_isr(). Both NMIs and MCEs don't push an 'err' + * into the frame. + */ +ENTRY_NP(vmx_call_trap) + pushq %rbp + movq %rsp, %rbp + movq %rsp, %r11 + andq $~0xf, %rsp /* align stack */ + pushq $KDS_SEL /* %ss */ + pushq %r11 /* %rsp */ + pushfq /* %rflags */ + pushq $KCS_SEL /* %cs */ + leaq .trap_iret_dest(%rip), %rcx + pushq %rcx /* %rip */ + cli + cmpq $T_NMIFLT, %rdi + je nmiint + cmpq $T_MCE, %rdi + je mcetrap + + pushq %rdi /* save our bad trapno... */ + leaq __vmx_call_bad_trap(%rip), %rdi + xorl %eax, %eax + call panic + /*NOTREACHED*/ + +.trap_iret_dest: + popq %rbp + ret +SET_SIZE(vmx_call_trap) + +__vmx_call_bad_trap: + .string "bad trapno for vmx_call_trap()" + #endif /* lint */ diff --git a/usr/src/uts/i86pc/os/cpuid.c b/usr/src/uts/i86pc/os/cpuid.c index 3f9132ba4e..5324034fcf 100644 --- a/usr/src/uts/i86pc/os/cpuid.c +++ b/usr/src/uts/i86pc/os/cpuid.c @@ -1437,10 +1437,10 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) platform_cpuid_mangle(cpi->cpi_vendor, 1, cp); /* - * In addition to ecx and edx, Intel is storing a bunch of instruction - * set extensions in leaf 7's ebx, ecx, and edx. + * In addition to ecx and edx, Intel and AMD are storing a bunch of + * instruction set extensions in leaf 7's ebx, ecx, and edx. */ - if (cpi->cpi_vendor == X86_VENDOR_Intel && cpi->cpi_maxeax >= 7) { + if (cpi->cpi_maxeax >= 7) { struct cpuid_regs *ecp; ecp = &cpi->cpi_std[7]; ecp->cp_eax = 7; @@ -1464,30 +1464,29 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_SMEP) add_x86_feature(featureset, X86FSET_SMEP); - if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_INVPCID) { - add_x86_feature(featureset, X86FSET_INVPCID); - } - /* * We check disable_smap here in addition to in startup_smap() * to ensure CPUs that aren't the boot CPU don't accidentally * include it in the feature set and thus generate a mismatched - * x86 feature set across CPUs. Note that at this time we only - * enable SMAP for the 64-bit kernel. + * x86 feature set across CPUs. */ -#if defined(__amd64) if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_SMAP && disable_smap == 0) add_x86_feature(featureset, X86FSET_SMAP); -#endif - if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_MPX) - add_x86_feature(featureset, X86FSET_MPX); if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_RDSEED) add_x86_feature(featureset, X86FSET_RDSEED); if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_ADX) add_x86_feature(featureset, X86FSET_ADX); + + if (cpi->cpi_vendor == X86_VENDOR_Intel) { + if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_INVPCID) + add_x86_feature(featureset, X86FSET_INVPCID); + + if (ecp->cp_ebx & CPUID_INTC_EBX_7_0_MPX) + add_x86_feature(featureset, X86FSET_MPX); + } } /* @@ -1617,8 +1616,9 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) X86FSET_AVX2); } - if (cpi->cpi_std[7].cp_ebx & - CPUID_INTC_EBX_7_0_AVX512F) { + if (cpi->cpi_vendor == X86_VENDOR_Intel && + (cpi->cpi_std[7].cp_ebx & + CPUID_INTC_EBX_7_0_AVX512F) != 0) { add_x86_feature(featureset, X86FSET_AVX512F); if (cpi->cpi_std[7].cp_ebx & @@ -1743,8 +1743,7 @@ cpuid_pass1(cpu_t *cpu, uchar_t *featureset) cpi->cpi_ncpu_per_chip = 1; } - if (cpi->cpi_vendor == X86_VENDOR_Intel && cpi->cpi_maxeax >= 0xD && - !xsave_force_disable) { + if (cpi->cpi_maxeax >= 0xD && !xsave_force_disable) { struct cpuid_regs r, *ecp; ecp = &r; @@ -3285,6 +3284,8 @@ cpuid_pass4(cpu_t *cpu, uint_t *hwcap_out) hwcap_flags_2 |= AV_386_2_ADX; if (*ebx & CPUID_INTC_EBX_7_0_RDSEED) hwcap_flags_2 |= AV_386_2_RDSEED; + if (*ebx & CPUID_INTC_EBX_7_0_SHA) + hwcap_flags_2 |= AV_386_2_SHA; } @@ -3773,15 +3774,13 @@ cpuid_get_xsave_size() * floating point error pointer exception handling. In the past, this has been * true for all AMD K7 & K8 CPUs, although newer AMD CPUs have been changed to * behave the same as Intel. This is checked via the CPUID_AMD_EBX_ERR_PTR_ZERO - * feature bit and is reflected in the cpi_fp_amd_save member. Once this has - * been confirmed on hardware which supports that feature, this test should be - * narrowed. In the meantime, we always follow the existing behavior on any AMD - * CPU. + * feature bit and is reflected in the cpi_fp_amd_save member. */ boolean_t cpuid_need_fp_excp_handling() { - return (cpuid_info0.cpi_vendor == X86_VENDOR_AMD); + return (cpuid_info0.cpi_vendor == X86_VENDOR_AMD && + cpuid_info0.cpi_fp_amd_save != 0); } /* diff --git a/usr/src/uts/i86pc/os/ht.c b/usr/src/uts/i86pc/os/ht.c index f82c51ac08..6e13eaedae 100644 --- a/usr/src/uts/i86pc/os/ht.c +++ b/usr/src/uts/i86pc/os/ht.c @@ -138,6 +138,8 @@ CTASSERT(CM_POISONED < (1 << CS_SHIFT)); CTASSERT(CM_POISONED > CM_VCPU); CTASSERT(CM_VCPU > CM_UNSAFE); +static uint_t empty_pil = XC_CPUPOKE_PIL; + /* * If disabled, no HT exclusion is performed, and system is potentially * vulnerable to L1TF if hyper-threading is enabled, and we don't have the "not @@ -212,6 +214,23 @@ ht_init(void) } /* + * We're adding an interrupt handler of some kind at the given PIL. If this + * happens to be the same PIL as XC_CPUPOKE_PIL, then we need to disable our + * pil_needs_kick() optimization, as there is now potentially an unsafe + * interrupt handler at that PIL. This typically won't occur, so we're not that + * careful about what's actually getting added, which CPU it's on, or if it gets + * removed. This also presumes that softints can't cover our empty_pil. + */ +void +ht_intr_alloc_pil(uint_t pil) +{ + ASSERT(pil <= PIL_MAX); + + if (empty_pil == pil) + empty_pil = PIL_MAX + 1; +} + +/* * If our sibling is also a VCPU thread from a different zone, we need one of * them to give up, otherwise they will just battle each other for exclusion * until they exhaust their quantum. @@ -370,41 +389,36 @@ ht_kick(cpu_ht_t *ht, zoneid_t zoneid) poke_cpu(ht->ch_sib->cpu_id); + membar_consumer(); + sibstate = ht->ch_sibstate; + + if (CS_MARK(sibstate) != CM_POISONED || CS_ZONE(sibstate) == zoneid) + return; + + lock_clear(&ht->ch_lock); + + /* + * Spin until we can see the sibling has been kicked out or is otherwise + * OK. + */ for (;;) { membar_consumer(); sibstate = ht->ch_sibstate; if (CS_MARK(sibstate) != CM_POISONED || CS_ZONE(sibstate) == zoneid) - return; - - lock_clear(&ht->ch_lock); - - for (;;) { - membar_consumer(); - sibstate = ht->ch_sibstate; - - if (CS_MARK(sibstate) != CM_POISONED || - CS_ZONE(sibstate) == zoneid) { - lock_set(&ht->ch_lock); - return; - } - - SMT_PAUSE(); - } + break; - lock_set(&ht->ch_lock); + SMT_PAUSE(); } + + lock_set(&ht->ch_lock); } -/* - * FIXME: do we need a callback in case somebody installs a handler at this PIL - * ever? - */ static boolean_t pil_needs_kick(uint_t pil) { - return (pil != XC_CPUPOKE_PIL); + return (pil != empty_pil); } void @@ -413,6 +427,8 @@ ht_begin_intr(uint_t pil) ulong_t flags; cpu_ht_t *ht; + ASSERT(pil <= PIL_MAX); + flags = intr_clear(); ht = &CPU->cpu_m.mcpu_ht; @@ -581,8 +597,6 @@ ht_should_run(kthread_t *t, cpu_t *cp) pri_t ht_adjust_cpu_score(kthread_t *t, struct cpu *cp, pri_t score) { - cpu_t *sib; - if (ht_should_run(t, cp)) return (score); diff --git a/usr/src/uts/i86pc/sys/ht.h b/usr/src/uts/i86pc/sys/ht.h index 6b1bfcdd2b..8bb5a0d6d2 100644 --- a/usr/src/uts/i86pc/sys/ht.h +++ b/usr/src/uts/i86pc/sys/ht.h @@ -26,6 +26,7 @@ extern "C" { struct cpu; extern void ht_init(void); +extern void ht_intr_alloc_pil(uint_t); extern int ht_acquire(void); extern void ht_release(void); diff --git a/usr/src/uts/sun4/sys/ht.h b/usr/src/uts/sun4/sys/ht.h index 831891979f..6d7b3e37cc 100644 --- a/usr/src/uts/sun4/sys/ht.h +++ b/usr/src/uts/sun4/sys/ht.h @@ -27,8 +27,9 @@ extern "C" { #define ht_should_run(t, c) (B_TRUE) #define ht_adjust_cpu_score(t, c, p) (p) -#define ht_mark_safe(void) {} -#define ht_mark_unsafe(void) {} +#define ht_begin_unsafe(void) {} +#define ht_end_unsafe(void) {} +#define ht_end_intr(void) {} #ifdef __cplusplus } |