diff options
| author | Dan McDonald <danmcd@joyent.com> | 2022-01-26 00:22:03 -0500 |
|---|---|---|
| committer | Dan McDonald <danmcd@joyent.com> | 2022-01-26 00:22:03 -0500 |
| commit | 8fc6db9038a26b94dd85991125777b95db7e1948 (patch) | |
| tree | 3b96494c915dd31f9635347684b667cb57c9d5ac | |
| parent | e75aa64e237bd5789bba2f283da59dc9b1fb0fec (diff) | |
| parent | 70ae9a334a768113a660b21305bf7d2cff941499 (diff) | |
| download | illumos-joyent-8fc6db9038a26b94dd85991125777b95db7e1948.tar.gz | |
[illumos-gate merge]
commit 70ae9a334a768113a660b21305bf7d2cff941499
14425 want probes for invvpid and invept
14426 expand seg_vmm tests
commit 25cdfc4f8d373444e56178d1053ca53f1c3ea928
14428 formatting issues in memory(3c) man page
commit ab3f6e90e6b1d8edee27c66beb8e53bc6033fb2a
14419 iprb transmit watchdog somewhat overzealous
commit c9b01782224c4b5ea00e251ce64cfbd68ce276d6
14396 Makefile.master: gcc 11 support
commit 5528cade4e43d027d848fdca33cccc9faa97823b
14388 des: with mismatched bound
commit f4203ebbfd2dce9537b7614c6e37240f406907e8
14389 net80211: mismatched bound
commit 2829495d7d810156bdfd454b8a1ef0f54eac9733
14386 libc: build errors with gcc 11
commit 1b863af9bc9a5c76ed773e129889fc19dbf9e41c
14393 stmf_sbd: build errors with gcc 11
commit 050c24f35c93857f1022f99834086ade54e70547
14326 dt_unring_buf: set dtbd_oldest to the start of the first record
commit 817002c416c9301664eafbc288940123aa7d6fc9
14442 NVMe theory statement on spec version is confusing
22 files changed, 365 insertions, 116 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index 2e8b17ccd7..9ddb147e7d 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -599,7 +599,8 @@ CALLSYMS= -_gcc=-fno-eliminate-unused-debug-symbols \ # by the CTF tools. With Sun Studio this is stabs due to bugs in the Studio # compilers. With GCC this is DWARF v2. # -DEBUGFORMAT= -_cc=-xdebugformat=stabs -_gcc=-gdwarf-2 -_gcc10=-gstrict-dwarf +DEBUGFORMAT= -_cc=-xdebugformat=stabs -_gcc=-gdwarf-2 \ + -_gcc10=-gstrict-dwarf -_gcc11=-gstrict-dwarf # # Ask the compiler to include debugging information diff --git a/usr/src/common/crypto/des/des_impl.c b/usr/src/common/crypto/des/des_impl.c index c88d558b6d..171d2365f4 100644 --- a/usr/src/common/crypto/des/des_impl.c +++ b/usr/src/common/crypto/des/des_impl.c @@ -499,9 +499,12 @@ des_crypt_impl(uint64_t *ks, uint64_t block, int one_or_three) } #endif /* !sun4u */ +/* + * block and out_block are assumed to be uint8_t [DES_BLOCK_LEN]. + */ int -des3_crunch_block(const void *cookie, const uint8_t block[DES_BLOCK_LEN], - uint8_t out_block[DES_BLOCK_LEN], boolean_t decrypt) +des3_crunch_block(const void *cookie, const uint8_t *block, + uint8_t *out_block, boolean_t decrypt) { keysched3_t *ksch = (keysched3_t *)cookie; @@ -558,9 +561,12 @@ des3_crunch_block(const void *cookie, const uint8_t block[DES_BLOCK_LEN], return (CRYPTO_SUCCESS); } +/* + * block and out_block are assumed to be uint8_t [DES_BLOCK_LEN]. + */ int -des_crunch_block(const void *cookie, const uint8_t block[DES_BLOCK_LEN], - uint8_t out_block[DES_BLOCK_LEN], boolean_t decrypt) +des_crunch_block(const void *cookie, const uint8_t *block, + uint8_t *out_block, boolean_t decrypt) { keysched_t *ksch = (keysched_t *)cookie; diff --git a/usr/src/lib/libc/port/gen/ndbm.c b/usr/src/lib/libc/port/gen/ndbm.c index f1fb3603be..79ef61e590 100644 --- a/usr/src/lib/libc/port/gen/ndbm.c +++ b/usr/src/lib/libc/port/gen/ndbm.c @@ -26,7 +26,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * University Copyright- Copyright (c) 1982, 1986, 1988 @@ -38,8 +38,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "lint.h" #include <sys/types.h> #include <sys/stat.h> @@ -841,7 +839,7 @@ setbit(DBM *db) } static datum -makdatum(char buf[PBLKSIZ], int n) +makdatum(char *buf, int n) { short *sp; int t; @@ -886,7 +884,7 @@ cmpdatum(datum d1, datum d2) } static int -finddatum(char buf[PBLKSIZ], datum item) +finddatum(char *buf, datum item) { short *sp; int i, n, j; @@ -962,7 +960,7 @@ dcalchash(datum item) * Delete pairs of items (n & n+1). */ static int -delitem(char buf[PBLKSIZ], int n) +delitem(char *buf, int n) { short *sp, *sp1; int i1, i2; @@ -993,7 +991,7 @@ delitem(char buf[PBLKSIZ], int n) * Add pairs of items (item & item1). */ static int -additem(char buf[PBLKSIZ], datum item, datum item1) +additem(char *buf, datum item, datum item1) { short *sp; int i1, i2; diff --git a/usr/src/lib/libc/port/print/doprnt.c b/usr/src/lib/libc/port/print/doprnt.c index 8a6dfd5e90..04f1e4ad0a 100644 --- a/usr/src/lib/libc/port/print/doprnt.c +++ b/usr/src/lib/libc/port/print/doprnt.c @@ -25,7 +25,7 @@ */ /* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * _doprnt: common code for printf, fprintf, sprintf @@ -166,9 +166,9 @@ static const wchar_t widenullstr[] = L"(null)"; } #define PAD(s, n) { ssize_t nn; \ - for (nn = n; nn > PAD_LEN; nn -= PAD_LEN) \ - if (!_dowrite(s, PAD_LEN, iop, &bufptr)) \ - return (EOF); \ + for (nn = n; nn > PAD_LEN; nn -= PAD_LEN) \ + if (!_dowrite(s, PAD_LEN, iop, &bufptr)) \ + return (EOF); \ PUT(s, nn); \ } @@ -522,7 +522,7 @@ _ndoprnt(const char *format, va_list in_args, FILE *iop, int prflag) ssize_t prefixlength, suffixlength; /* Combined length of leading zeroes, trailing zeroes, and suffix */ - ssize_t otherlength; + ssize_t otherlength; /* The value being converted, if integer */ ssize_t val; diff --git a/usr/src/lib/libc/port/sys/utimesys.c b/usr/src/lib/libc/port/sys/utimesys.c index 55e53dbb53..c291202491 100644 --- a/usr/src/lib/libc/port/sys/utimesys.c +++ b/usr/src/lib/libc/port/sys/utimesys.c @@ -94,20 +94,20 @@ utimes_impl(const char *path, const struct timeval times[2], int flag) } int -utimes(const char *path, const struct timeval times[2]) +utimes(const char *path, const struct timeval *times) { return (utimes_impl(path, times, 0)); } int -lutimes(const char *path, const struct timeval times[2]) +lutimes(const char *path, const struct timeval *times) { return (utimes_impl(path, times, AT_SYMLINK_NOFOLLOW)); } #pragma weak _futimesat = futimesat int -futimesat(int fd, const char *path, const struct timeval times[2]) +futimesat(int fd, const char *path, const struct timeval *times) { struct timeval ltimes[2]; timespec_t ts[2]; @@ -133,7 +133,7 @@ futimesat(int fd, const char *path, const struct timeval times[2]) } int -futimes(int fd, const struct timeval times[2]) +futimes(int fd, const struct timeval *times) { return (futimesat(fd, NULL, times)); } diff --git a/usr/src/lib/libdtrace/common/dt_consume.c b/usr/src/lib/libdtrace/common/dt_consume.c index 807d60a79a..6e9187a804 100644 --- a/usr/src/lib/libdtrace/common/dt_consume.c +++ b/usr/src/lib/libdtrace/common/dt_consume.c @@ -2599,7 +2599,7 @@ dt_unring_buf(dtrace_hdl_t *dtp, dtrace_bufdesc_t *buf) bcopy(buf->dtbd_data, ndp, buf->dtbd_oldest); dt_free(dtp, buf->dtbd_data); - buf->dtbd_oldest = 0; + buf->dtbd_oldest = misalign; buf->dtbd_data = newdata; buf->dtbd_size += misalign; diff --git a/usr/src/man/man3c/memory.3c b/usr/src/man/man3c/memory.3c index 5a11990914..5d4628a709 100644 --- a/usr/src/man/man3c/memory.3c +++ b/usr/src/man/man3c/memory.3c @@ -19,7 +19,7 @@ .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" -.Dd August 6, 2021 +.Dd January 25, 2022 .Dt MEMORY 3C .Os .Sh NAME @@ -44,7 +44,7 @@ .Fc .Ft "void *" .Fo memchr -.Fa "void *s", +.Fa "void *s" .Fa "int c" .Fa "size_t n" .Fc @@ -75,14 +75,14 @@ .Fc .Ft "void *" .Fo memrchr -.Fa "void *s", +.Fa "void *s" .Fa "int c" .Fa "size_t n" .Fc .Ft "void *" .Fo memset .Fa "void *s" -.Fa int c +.Fa "int c" .Fa "size_t n" .Fc .Sh DESCRIPTION diff --git a/usr/src/man/man7d/nvme.7d b/usr/src/man/man7d/nvme.7d index 2819a788e5..e7b2dda4c4 100644 --- a/usr/src/man/man7d/nvme.7d +++ b/usr/src/man/man7d/nvme.7d @@ -13,7 +13,7 @@ .\" Copyright (c) 2018, Joyent, Inc. .\" Copyright 2019, Western Digital Corporation .\" -.Dd July 31, 2018 +.Dd January 22, 2022 .Dt NVME 7D .Os .Sh NAME @@ -25,8 +25,8 @@ The driver uses the .Xr blkdev 7D framework to provide access to -Intel NVMe compliant solid-state storage devices. +All NVMe version 1.x devices are supported. .Lp NVMe devices supporting multiple namespaces will present each namespace as its own diff --git a/usr/src/pkg/manifests/system-bhyve-tests.p5m b/usr/src/pkg/manifests/system-bhyve-tests.p5m index 070f9790c9..74881cf19c 100644 --- a/usr/src/pkg/manifests/system-bhyve-tests.p5m +++ b/usr/src/pkg/manifests/system-bhyve-tests.p5m @@ -30,12 +30,14 @@ file path=opt/bhyve-tests/bin/bhyvetest mode=0555 dir path=opt/bhyve-tests/runfiles file path=opt/bhyve-tests/runfiles/default.run mode=0444 dir path=opt/bhyve-tests/tests -file path=opt/bhyve-tests/tests/memmap mode=0555 dir path=opt/bhyve-tests/tests/mevent file path=opt/bhyve-tests/tests/mevent/lists_delete mode=0555 file path=opt/bhyve-tests/tests/mevent/read_disable mode=0555 file path=opt/bhyve-tests/tests/mevent/read_pause mode=0555 file path=opt/bhyve-tests/tests/mevent/read_requeue mode=0555 +dir path=opt/bhyve-tests/tests/vmm +file path=opt/bhyve-tests/tests/vmm/mem_partial mode=0555 +file path=opt/bhyve-tests/tests/vmm/mem_seg_map mode=0555 license lic_CDDL license=lic_CDDL depend type=require fmri=system/bhyve depend type=require fmri=system/test/testrunner diff --git a/usr/src/test/bhyve-tests/runfiles/default.run b/usr/src/test/bhyve-tests/runfiles/default.run index 0e92d9359e..51afd4581a 100644 --- a/usr/src/test/bhyve-tests/runfiles/default.run +++ b/usr/src/test/bhyve-tests/runfiles/default.run @@ -19,8 +19,8 @@ timeout = 60 post = outputdir = /var/tmp/test_results -[/opt/bhyve-tests/tests] -tests = ['memmap'] +[/opt/bhyve-tests/tests/vmm] +tests = ['mem_partial', 'mem_seg_map'] # Tests of userspace mevent system, built from cmd/bhyve [/opt/bhyve-tests/tests/mevent] diff --git a/usr/src/test/bhyve-tests/tests/Makefile b/usr/src/test/bhyve-tests/tests/Makefile index 5edb6d2be4..bf18b300ca 100644 --- a/usr/src/test/bhyve-tests/tests/Makefile +++ b/usr/src/test/bhyve-tests/tests/Makefile @@ -9,40 +9,12 @@ # http://www.illumos.org/license/CDDL. # +# # Copyright 2022 Oxide Computer Company +# -include $(SRC)/cmd/Makefile.cmd -include $(SRC)/cmd/Makefile.cmd.64 -include $(SRC)/test/Makefile.com - -PROG = memmap - -ROOTOPTPKG = $(ROOT)/opt/bhyve-tests -TESTDIR = $(ROOTOPTPKG)/tests - -CMDS = $(PROG:%=$(TESTDIR)/%) -$(CMDS) := FILEMODE = 0555 - -CSTD= $(CSTD_GNU99) -CPPFLAGS = -I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \ - -I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \ - $(CPPFLAGS.master) \ - -I$(SRC)/uts/i86pc/io/vmm \ - -I$(SRC)/uts/i86pc -$(PROG) := LDLIBS += \ - -lvmmapi - -all: $(PROG) - -install: all $(CMDS) - -clobber: clean - -$(RM) $(PROG) - -$(CMDS): $(TESTDIR) $(PROG) +.PARALLEL: $(SUBDIRS) -$(TESTDIR): - $(INS.dir) +SUBDIRS = vmm -$(TESTDIR)/%: % - $(INS.file) +include $(SRC)/test/Makefile.com diff --git a/usr/src/test/bhyve-tests/tests/vmm/Makefile b/usr/src/test/bhyve-tests/tests/vmm/Makefile new file mode 100644 index 0000000000..c91ed9a7e4 --- /dev/null +++ b/usr/src/test/bhyve-tests/tests/vmm/Makefile @@ -0,0 +1,59 @@ +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# Copyright 2022 Oxide Computer Company + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/cmd/Makefile.cmd.64 +include $(SRC)/test/Makefile.com + +PROG = mem_partial \ + mem_seg_map + +COMMON_OBJS = common.o +CLEAN_OBJS = $(PROG:%=%.o) + +ROOTOPTPKG = $(ROOT)/opt/bhyve-tests +TESTDIR = $(ROOTOPTPKG)/tests/vmm + +CMDS = $(PROG:%=$(TESTDIR)/%) +$(CMDS) := FILEMODE = 0555 + +CSTD= $(CSTD_GNU99) +CPPFLAGS = -I$(COMPAT)/bhyve -I$(CONTRIB)/bhyve \ + -I$(COMPAT)/bhyve/amd64 -I$(CONTRIB)/bhyve/amd64 \ + $(CPPFLAGS.master) \ + -I$(SRC)/uts/i86pc/io/vmm \ + -I$(SRC)/uts/i86pc +$(PROG) := LDLIBS += -lvmmapi + +all: $(PROG) + +install: all $(CMDS) + +clean: + -$(RM) $(CLEAN_OBJS) $(COMMON_OBJS) +clobber: clean + -$(RM) $(PROG) + +$(PROG): $(COMMON_OBJS) + +$(CMDS): $(TESTDIR) $(PROG) + +$(TESTDIR): + $(INS.dir) + +$(TESTDIR)/%: % + $(INS.file) + +%: %.o + $(LINK.c) -o $@ $< $(COMMON_OBJS) $(LDLIBS) + $(POST_PROCESS) diff --git a/usr/src/test/bhyve-tests/tests/vmm/common.c b/usr/src/test/bhyve-tests/tests/vmm/common.c new file mode 100644 index 0000000000..b7f0a30ed0 --- /dev/null +++ b/usr/src/test/bhyve-tests/tests/vmm/common.c @@ -0,0 +1,53 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2022 Oxide Computer Company + */ + +#include <stdio.h> +#include <unistd.h> +#include <strings.h> + +#include <sys/types.h> +#include <sys/vmm.h> +#include <sys/vmm_dev.h> +#include <vmmapi.h> + +struct vmctx * +create_test_vm(void) +{ + char name[VM_MAX_NAMELEN]; + int res; + + (void) snprintf(name, sizeof (name), "bhyve-test-memmap-%d", getpid()); + + res = vm_create(name, 0); + if (res != 0) { + return (NULL); + } + + return (vm_open(name)); +} + +int +alloc_memseg(struct vmctx *ctx, int segid, size_t len, const char *name) +{ + struct vm_memseg memseg = { + .segid = segid, + .len = len, + }; + (void) strlcpy(memseg.name, name, sizeof (memseg.name)); + + int fd = vm_get_device_fd(ctx); + + return (ioctl(fd, VM_ALLOC_MEMSEG, &memseg)); +} diff --git a/usr/src/test/bhyve-tests/tests/vmm/common.h b/usr/src/test/bhyve-tests/tests/vmm/common.h new file mode 100644 index 0000000000..7b64574cf2 --- /dev/null +++ b/usr/src/test/bhyve-tests/tests/vmm/common.h @@ -0,0 +1,24 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2022 Oxide Computer Company + */ + +#ifndef _COMMON_H_ +#define _COMMON_H_ + +struct vmctx *create_test_vm(void); +int alloc_memseg(struct vmctx *, int, size_t, const char *); + +#define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC) + +#endif /* _COMMON_H_ */ diff --git a/usr/src/test/bhyve-tests/tests/memmap.c b/usr/src/test/bhyve-tests/tests/vmm/mem_partial.c index c5c2f179da..b410c673ab 100644 --- a/usr/src/test/bhyve-tests/tests/memmap.c +++ b/usr/src/test/bhyve-tests/tests/vmm/mem_partial.c @@ -20,12 +20,15 @@ #include <strings.h> #include <signal.h> #include <setjmp.h> +#include <libgen.h> #include <sys/vmm.h> #include <sys/vmm_dev.h> #include <sys/mman.h> #include <vmmapi.h> +#include "common.h" + /* Half of a leaf page table is 256 pages */ #define LOWER_SZ (256 * 4096) #define UPPER_SZ LOWER_SZ @@ -34,43 +37,11 @@ #define LOWER_OFF 0 #define UPPER_OFF LOWER_SZ -#define PROT_ALL (PROT_READ | PROT_WRITE | PROT_EXEC) - enum test_memsegs { MSEG_LOW = 0, MSEG_HIGH = 1, }; -struct vmctx * -create_test_vm() -{ - char name[VM_MAX_NAMELEN]; - int res; - - (void) snprintf(name, sizeof (name), "bhyve-test-memmap-%d", getpid()); - - res = vm_create(name, 0); - if (res != 0) { - return (NULL); - } - - return (vm_open(name)); -} - -int -alloc_memseg(struct vmctx *ctx, int segid, size_t len, const char *name) -{ - struct vm_memseg memseg = { - .segid = segid, - .len = len, - }; - (void) strlcpy(memseg.name, name, sizeof (memseg.name)); - - int fd = vm_get_device_fd(ctx); - - return (ioctl(fd, VM_ALLOC_MEMSEG, &memseg)); -} - static sigjmp_buf segv_env; void @@ -88,6 +59,10 @@ main(int argc, char *argv[]) void *guest_mem; ctx = create_test_vm(); + if (ctx == NULL) { + perror("could open test VM"); + return (1); + } fd = vm_get_device_fd(ctx); res = alloc_memseg(ctx, MSEG_LOW, LOWER_SZ, "mseg_low"); @@ -217,6 +192,7 @@ main(int argc, char *argv[]) } /* mission accomplished */ + (void) printf("%s\tPASS\n", basename(argv[0])); vm_destroy(ctx); return (0); diff --git a/usr/src/test/bhyve-tests/tests/vmm/mem_seg_map.c b/usr/src/test/bhyve-tests/tests/vmm/mem_seg_map.c new file mode 100644 index 0000000000..e80f18547e --- /dev/null +++ b/usr/src/test/bhyve-tests/tests/vmm/mem_seg_map.c @@ -0,0 +1,138 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright 2022 Oxide Computer Company + */ + + +#include <stdio.h> +#include <unistd.h> +#include <stropts.h> +#include <strings.h> +#include <signal.h> +#include <setjmp.h> +#include <libgen.h> + +#include <sys/vmm.h> +#include <sys/vmm_dev.h> +#include <sys/mman.h> +#include <vmmapi.h> + +#include "common.h" + +#define TEST_SEGID 0 +#define PAGE_CNT 1024 +#define PAGE_SZ 4096 +#define SEG_SZ (PAGE_CNT * PAGE_SZ) + +int +main(int argc, char *argv[]) +{ + struct vmctx *ctx; + int res, fd; + void *seg_obj, *guest_mem; + + ctx = create_test_vm(); + if (ctx == NULL) { + perror("could open test VM"); + return (1); + } + fd = vm_get_device_fd(ctx); + + res = alloc_memseg(ctx, TEST_SEGID, SEG_SZ, "test_seg"); + if (res != 0) { + perror("could not alloc memseg"); + goto bail; + } + off_t seg_obj_off; + res = vm_get_devmem_offset(ctx, TEST_SEGID, &seg_obj_off); + if (res != 0) { + perror("could not find mapping offset for seg object"); + goto bail; + } + + seg_obj = mmap(NULL, SEG_SZ, PROT_READ | PROT_WRITE, MAP_SHARED, + fd, seg_obj_off); + if (seg_obj == MAP_FAILED) { + perror("could not mmap seg object"); + goto bail; + } + + /* populate with initial data */ + for (uint_t i = 0; i < PAGE_CNT; i++) { + uint64_t *p = (uint64_t *)((uintptr_t)seg_obj + i * PAGE_SZ); + + *p = i; + } + + res = vm_mmap_memseg(ctx, 0, TEST_SEGID, 0, SEG_SZ, PROT_ALL); + if (res != 0) { + perror("could not map memseg into vmspace"); + goto bail; + } + guest_mem = mmap(NULL, SEG_SZ, PROT_READ | PROT_WRITE, MAP_SHARED, + fd, 0); + if (seg_obj == MAP_FAILED) { + perror("could not mmap vmspace"); + goto bail; + } + + /* check data and access though vmspace */ + for (uint_t i = 0; i < PAGE_CNT; i++) { + const uint64_t off = i * PAGE_SZ; + uint64_t *p = (uint64_t *)((uintptr_t)guest_mem + off); + + const uint64_t val = *p; + if (val != i) { + (void) printf("%lu != %u at gpa:%lx\n", val, i, off); + goto bail; + } + + /* leave a change behind */ + *p = val * 2; + } + + /* check changes made through vmspace */ + for (uint_t i = 0; i < PAGE_CNT; i++) { + const uint64_t off = i * PAGE_SZ; + uint64_t *p = (uint64_t *)((uintptr_t)seg_obj + off); + + const uint_t expected = i * 2; + const uint64_t val = *p; + if (val != expected) { + (void) printf("%lu != %u at gpa:%lx\n", val, expected, + off); + goto bail; + } + } + + /* unmap access mappings */ + res = munmap(guest_mem, SEG_SZ); + if (res != 0) { + perror("could not munmap vmspace"); + goto bail; + } + res = munmap(seg_obj, SEG_SZ); + if (res != 0) { + perror("could not munmap seg object"); + goto bail; + } + + /* mission accomplished */ + vm_destroy(ctx); + (void) printf("%s\tPASS\n", basename(argv[0])); + return (0); + +bail: + vm_destroy(ctx); + return (1); +} diff --git a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c index 88dee95fb8..8a04f24276 100644 --- a/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c +++ b/usr/src/uts/common/io/comstar/lu/stmf_sbd/sbd.c @@ -2677,9 +2677,9 @@ sbd_modify_lu(sbd_modify_lu_t *mlu, int struct_sz, uint32_t *err_ret) /* if there is data in the buf, null terminate it */ if (struct_sz > sizeof (*mlu)) { - char *mlu_buf; + char *mlu_buf = (char *)mlu; - mlu_buf = &(mlu->mlu_buf[0]); + mlu_buf += sizeof (*mlu) - 8; mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = '\0'; } @@ -2907,9 +2907,9 @@ sbd_set_global_props(sbd_global_props_t *mlu, int struct_sz, /* if there is data in the buf, null terminate it */ if (struct_sz > sizeof (*mlu)) { - char *mlu_buf; + char *mlu_buf = (char *)mlu; - mlu_buf = &(mlu->mlu_buf[0]); + mlu_buf += sizeof (*mlu) - 8; mlu_buf[struct_sz - sizeof (*mlu) + 8 - 1] = '\0'; } diff --git a/usr/src/uts/common/io/iprb/iprb.c b/usr/src/uts/common/io/iprb/iprb.c index 15022a5f45..cfcc1938af 100644 --- a/usr/src/uts/common/io/iprb/iprb.c +++ b/usr/src/uts/common/io/iprb/iprb.c @@ -12,6 +12,7 @@ /* * Copyright 2014 Nexenta Systems, Inc. All rights reserved. * Copyright 2021 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2022 Oxide Computer Company */ /* @@ -1672,6 +1673,13 @@ iprb_periodic(void *arg) /* update the statistics */ mutex_enter(&ip->culock); + /* + * The watchdog timer is updated when we send frames or when we reclaim + * completed commands. When the link is idle for long periods it is + * possible we will have done neither of these things, so reclaim + * explicitly before checking for a transmit stall: + */ + iprb_cmd_reclaim(ip); if (ip->tx_wdog && ((gethrtime() - ip->tx_wdog) > ip->tx_timeout)) { /* transmit/CU hang? */ cmn_err(CE_CONT, "?CU stalled, resetting.\n"); diff --git a/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c b/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c index e689c3ad2b..702b65b2fc 100644 --- a/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c +++ b/usr/src/uts/common/io/net80211/net80211_crypto_tkip.c @@ -651,7 +651,7 @@ michael_mic_hdr(const struct ieee80211_frame *wh0, uint8_t hdr[16]) static void michael_mic(struct tkip_ctx *ctx, const uint8_t *key, mblk_t *mp, uint_t off, size_t data_len, - uint8_t mic[IEEE80211_WEP_MICLEN]) + uint8_t mic[]) { uint8_t hdr[16]; uint32_t l, r; diff --git a/usr/src/uts/common/io/nvme/nvme.c b/usr/src/uts/common/io/nvme/nvme.c index 8de06e056d..ae631771b7 100644 --- a/usr/src/uts/common/io/nvme/nvme.c +++ b/usr/src/uts/common/io/nvme/nvme.c @@ -16,15 +16,18 @@ * Copyright 2020 Joyent, Inc. * Copyright 2019 Western Digital Corporation. * Copyright 2020 Racktop Systems. - * Copyright 2021 Oxide Computer Company. + * Copyright 2022 Oxide Computer Company. */ /* * blkdev driver for NVMe compliant storage devices * - * This driver was written to conform to version 1.2.1 of the NVMe - * specification. It may work with newer versions, but that is completely - * untested and disabled by default. + * This driver targets and is designed to support all NVMe 1.x devices. + * Features are added to the driver as we encounter devices that require them + * and our needs, so some commands or log pages may not take advantage of newer + * features that devices support at this time. When you encounter such a case, + * it is generally fine to add that support to the driver as long as you take + * care to ensure that the requisite device version is met before using it. * * The driver has only been tested on x86 systems and will not work on big- * endian systems without changes to the code accessing registers and data diff --git a/usr/src/uts/common/sys/net80211.h b/usr/src/uts/common/sys/net80211.h index 1946e0b284..be6b65fe90 100644 --- a/usr/src/uts/common/sys/net80211.h +++ b/usr/src/uts/common/sys/net80211.h @@ -700,7 +700,7 @@ ieee80211_node_t *ieee80211_find_node(ieee80211_node_table_t *, ieee80211_node_t *ieee80211_find_node_with_ssid(ieee80211_node_table_t *, const uint8_t *, uint32_t, const uint8_t *); ieee80211_node_t *ieee80211_find_txnode(ieee80211com_t *, - const uint8_t daddr[IEEE80211_ADDR_LEN]); + const uint8_t *daddr); ieee80211_node_t *ieee80211_find_rxnode(ieee80211com_t *, const struct ieee80211_frame *); @@ -713,7 +713,7 @@ extern int ieee80211_crypto_newkey(ieee80211com_t *, int, int, struct ieee80211_key *); extern int ieee80211_crypto_delkey(ieee80211com_t *, struct ieee80211_key *); extern int ieee80211_crypto_setkey(ieee80211com_t *, struct ieee80211_key *, - const uint8_t macaddr[IEEE80211_ADDR_LEN]); + const uint8_t *macaddr); /* Helper Functions */ int ieee80211_stat(ieee80211com_t *ic, uint_t stat, uint64_t *val); diff --git a/usr/src/uts/i86pc/io/vmm/intel/vmx.c b/usr/src/uts/i86pc/io/vmm/intel/vmx.c index 88bc56acfa..d07a8142e3 100644 --- a/usr/src/uts/i86pc/io/vmm/intel/vmx.c +++ b/usr/src/uts/i86pc/io/vmm/intel/vmx.c @@ -931,14 +931,18 @@ invvpid(uint64_t type, struct invvpid_desc desc) { int error; + DTRACE_PROBE3(vmx__invvpid, uint64_t, type, uint16_t, desc.vpid, + uint64_t, desc.linear_addr); + __asm __volatile("invvpid %[desc], %[type];" VMX_SET_ERROR_CODE_ASM : [error] "=r" (error) : [desc] "m" (desc), [type] "r" (type) : "memory"); - if (error) + if (error) { panic("invvpid error %d", error); + } } /* @@ -948,17 +952,16 @@ invvpid(uint64_t type, struct invvpid_desc desc) * mappings" (to use the VMX parlance). Actions which modify the EPT structures * for the instance (such as unmapping GPAs) would require an 'invept' flush. */ -static __inline void +static void vmx_invvpid(struct vmx *vmx, int vcpu, int running) { struct vmxstate *vmxstate; - struct invvpid_desc invvpid_desc; struct vmspace *vms; vmxstate = &vmx->state[vcpu]; - if (vmxstate->vpid == 0) + if (vmxstate->vpid == 0) { return; - vms = vm_get_vmspace(vmx->vm); + } if (!running) { /* @@ -978,11 +981,15 @@ vmx_invvpid(struct vmx *vmx, int vcpu, int running) * stale TLB entries for this VPID on the target, or if emulated actions * in the guest CPU have incurred an explicit TLB flush. */ + vms = vm_get_vmspace(vmx->vm); if (vmspace_table_gen(vms) == vmx->eptgen[curcpu]) { - invvpid_desc._res1 = 0; - invvpid_desc._res2 = 0; - invvpid_desc.vpid = vmxstate->vpid; - invvpid_desc.linear_addr = 0; + struct invvpid_desc invvpid_desc = { + .vpid = vmxstate->vpid, + .linear_addr = 0, + ._res1 = 0, + ._res2 = 0, + }; + invvpid(INVVPID_TYPE_SINGLE_CONTEXT, invvpid_desc); vmm_stat_incr(vmx->vm, vcpu, VCPU_INVVPID_DONE, 1); } else { @@ -1005,6 +1012,8 @@ invept(uint64_t type, uint64_t eptp) uint64_t _resv; } desc = { eptp, 0 }; + DTRACE_PROBE2(vmx__invept, uint64_t, type, uint64_t, eptp); + __asm __volatile("invept %[desc], %[type];" VMX_SET_ERROR_CODE_ASM : [error] "=r" (error) |
