diff options
author | John Levon <john.levon@joyent.com> | 2020-08-13 15:27:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-13 15:27:11 +0100 |
commit | e63d036fd36b5642d5e199f7d9895d8d4eda6072 (patch) | |
tree | 0c177a62e8bd3796a7b530b7520fb0a4e7d0cd56 | |
parent | a8ff5009e5f7ea544c79b60ea65577f19304ff0b (diff) | |
parent | 09f210323354e07890b312da9b4f5e33ae6b6df5 (diff) | |
download | illumos-joyent-e63d036fd36b5642d5e199f7d9895d8d4eda6072.tar.gz |
Merge branch 'master' into sasinfosasinfo
47 files changed, 526 insertions, 1513 deletions
diff --git a/exception_lists/interface_check b/exception_lists/interface_check index 198e89e85a..d3c5d6075f 100644 --- a/exception_lists/interface_check +++ b/exception_lists/interface_check @@ -99,8 +99,3 @@ NONSTD_VERNAME ^usr/MACH(lib)/libtecla\.so\.1$ # These libc variants have an SONAME of libc\.so\.1$ NONSTD_VERNAME ^usr/MACH(lib)/libc/libc_hwcap[1-3]+\.so\.1$ - -# The ABI requires the SONAME for libsys.so.1 to be /usr/lib/ld.so.1 -# That means that the base version will also be /usr/lib/ld.so.1, which -# is non-standard. -NONSTD_VERNAME ^usr/lib/libsys\.so\.1$ @@ -6937,8 +6937,6 @@ f usr/lib/libsun_ima.so.1 0755 root bin s usr/lib/libsun_ima.so=libsun_ima.so.1 f usr/lib/libsun_sas.so.1 0755 root bin s usr/lib/libsun_sas.so=libsun_sas.so.1 -f usr/lib/libsys.so.1 0755 root bin -s usr/lib/libsys.so=libsys.so.1 s usr/lib/libsysevent.so.1=../../lib/libsysevent.so.1 s usr/lib/libsysevent.so=../../lib/libsysevent.so.1 f usr/lib/libtecla.so.1 0755 root bin @@ -16464,7 +16462,6 @@ f usr/share/man/man3lib/libslp.3lib 0444 root bin s usr/share/man/man3lib/libsmhbaapi.3lib=libSMHBAAPI.3lib f usr/share/man/man3lib/libsocket.3lib 0444 root bin f usr/share/man/man3lib/libstmf.3lib 0444 root bin -f usr/share/man/man3lib/libsys.3lib 0444 root bin f usr/share/man/man3lib/libsysevent.3lib 0444 root bin f usr/share/man/man3lib/libtecla.3lib 0444 root bin s usr/share/man/man3lib/libtermcap.3lib=libcurses.3lib diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version index f0fd4aed50..5d93ec0e76 100644 --- a/usr/src/boot/Makefile.version +++ b/usr/src/boot/Makefile.version @@ -33,4 +33,4 @@ LOADER_VERSION = 1.1 # Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes. # The version is processed from left to right, the version number can only # be increased. -BOOT_VERSION = $(LOADER_VERSION)-2020.07.07.1 +BOOT_VERSION = $(LOADER_VERSION)-2020.08.05.1 diff --git a/usr/src/boot/sys/boot/common/gfx_fb.c b/usr/src/boot/sys/boot/common/gfx_fb.c index 12ef4579fa..9389856ba8 100644 --- a/usr/src/boot/sys/boot/common/gfx_fb.c +++ b/usr/src/boot/sys/boot/common/gfx_fb.c @@ -48,6 +48,10 @@ static int gfx_inverse = 0; static int gfx_inverse_screen = 0; static uint8_t gfx_fg = DEFAULT_ANSI_FOREGROUND; static uint8_t gfx_bg = DEFAULT_ANSI_BACKGROUND; +#if defined(EFI) +static EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GlyphBuffer; +static size_t GlyphBufferSize; +#endif static int gfx_fb_cons_clear(struct vis_consclear *); static void gfx_fb_cons_copy(struct vis_conscopy *); @@ -57,10 +61,12 @@ static void gfx_fb_cons_display(struct vis_consdisplay *); static int gfx_gop_cons_clear(uint32_t data, uint32_t width, uint32_t height); static void gfx_gop_cons_copy(struct vis_conscopy *); static void gfx_gop_cons_display(struct vis_consdisplay *); +static void gfx_gop_display_cursor(struct vis_conscursor *); #endif static int gfx_bm_cons_clear(uint32_t data, uint32_t width, uint32_t height); static void gfx_bm_cons_copy(struct vis_conscopy *); static void gfx_bm_cons_display(struct vis_consdisplay *); +static void gfx_bm_display_cursor(struct vis_conscursor *); /* * Set default operations to use bitmap based implementation. @@ -75,10 +81,12 @@ struct gfx_fb_ops { int (*gfx_cons_clear)(uint32_t, uint32_t, uint32_t); void (*gfx_cons_copy)(struct vis_conscopy *); void (*gfx_cons_display)(struct vis_consdisplay *); + void (*gfx_cons_display_cursor)(struct vis_conscursor *); } gfx_fb_ops = { .gfx_cons_clear = gfx_bm_cons_clear, .gfx_cons_copy = gfx_bm_cons_copy, - .gfx_cons_display = gfx_bm_cons_display + .gfx_cons_display = gfx_bm_cons_display, + .gfx_cons_display_cursor = gfx_bm_display_cursor }; /* @@ -323,6 +331,7 @@ gfx_framework_init(struct visual_ops *fb_ops) gfx_fb_ops.gfx_cons_clear = gfx_gop_cons_clear; gfx_fb_ops.gfx_cons_copy = gfx_gop_cons_copy; gfx_fb_ops.gfx_cons_display = gfx_gop_cons_display; + gfx_fb_ops.gfx_cons_display_cursor = gfx_gop_display_cursor; } #endif @@ -614,10 +623,25 @@ gfx_gop_cons_display(struct vis_consdisplay *da) bpp = roundup2(gfx_fb.framebuffer_common.framebuffer_bpp, 8) >> 3; size = sizeof (*BltBuffer) * da->width * da->height; - BltBuffer = malloc(size); - if (BltBuffer == NULL && gfx_get_fb_address() != NULL) { - /* Fall back to bitmap implementation */ - gfx_bm_cons_display(da); + + /* + * Common data to display is glyph, use preallocated + * glyph buffer. + */ + if (size == GlyphBufferSize) { + BltBuffer = GlyphBuffer; + } else { + BltBuffer = malloc(size); + } + if (BltBuffer == NULL) { + if (gfx_get_fb_address() != NULL) { + /* Fall back to bitmap implementation */ + gfx_bm_cons_display(da); + } + /* + * We can not use Blt() and we have no address + * to write data to FB. + */ return; } @@ -626,7 +650,9 @@ gfx_gop_cons_display(struct vis_consdisplay *da) bitmap_cpy((void *)BltBuffer, da->data, size, bpp); (void) gop->Blt(gop, BltBuffer, EfiBltBufferToVideo, 0, 0, da->col, da->row, da->width, da->height, 0); - free(BltBuffer); + + if (BltBuffer != GlyphBuffer) + free(BltBuffer); } #endif @@ -680,14 +706,88 @@ gfx_fb_cons_display(struct vis_consdisplay *da) void gfx_fb_display_cursor(struct vis_conscursor *ca) { +#if defined(EFI) + EFI_TPL tpl; + + tpl = BS->RaiseTPL(TPL_NOTIFY); +#endif + gfx_fb_ops.gfx_cons_display_cursor(ca); +#if defined(EFI) + BS->RestoreTPL(tpl); +#endif +} + +#if defined(EFI) +static void +gfx_gop_display_cursor(struct vis_conscursor *ca) +{ + union pixel { + EFI_GRAPHICS_OUTPUT_BLT_PIXEL p; + uint32_t p32; + } *row, fg, bg; + size_t size; + extern EFI_GRAPHICS_OUTPUT *gop; + + size = sizeof (*GlyphBuffer) * ca->width * ca->height; + if (size != GlyphBufferSize) { + free(GlyphBuffer); + GlyphBuffer = malloc(size); + if (GlyphBuffer == NULL) { + if (gfx_get_fb_address() != NULL) { + /* Fall back to bitmap implementation */ + gfx_bm_display_cursor(ca); + } + /* + * We can not use Blt() and we have no address + * to write data to FB. + */ + return; + } + GlyphBufferSize = size; + } + + /* + * Since EfiBltVideoToBltBuffer is valid, Blt() can fail only + * due to device error. + */ + if (gop->Blt(gop, GlyphBuffer, EfiBltVideoToBltBuffer, + ca->col, ca->row, 0, 0, ca->width, ca->height, 0) != EFI_SUCCESS) + return; + + fg.p.Reserved = 0; + fg.p.Red = ca->fg_color.twentyfour[0]; + fg.p.Green = ca->fg_color.twentyfour[1]; + fg.p.Blue = ca->fg_color.twentyfour[2]; + bg.p.Reserved = 0; + bg.p.Red = ca->bg_color.twentyfour[0]; + bg.p.Green = ca->bg_color.twentyfour[1]; + bg.p.Blue = ca->bg_color.twentyfour[2]; + + /* + * Build inverse image of the glyph. + * Since xor has self-inverse property, drawing cursor + * second time on the same spot, will restore the original content. + */ + for (screen_size_t i = 0; i < ca->height; i++) { + row = (union pixel *)(GlyphBuffer + i * ca->width); + for (screen_size_t j = 0; j < ca->width; j++) { + row[j].p32 = (row[j].p32 ^ fg.p32) ^ bg.p32; + } + } + + (void) gop->Blt(gop, GlyphBuffer, EfiBltBufferToVideo, + 0, 0, ca->col, ca->row, ca->width, ca->height, 0); +} +#endif + +static void +gfx_bm_display_cursor(struct vis_conscursor *ca) +{ uint32_t fg, bg; uint32_t offset, size, *fb32; uint16_t *fb16; uint8_t *fb8, *fb; uint32_t bpp, pitch; -#if defined(EFI) - EFI_TPL tpl; -#endif fb = gfx_get_fb_address(); bpp = roundup2(gfx_fb.framebuffer_common.framebuffer_bpp, 8) >> 3; @@ -700,9 +800,6 @@ gfx_fb_display_cursor(struct vis_conscursor *ca) * frame buffer by (D xor FG) xor BG. */ offset = ca->col * bpp + ca->row * pitch; -#if defined(EFI) - tpl = BS->RaiseTPL(TPL_NOTIFY); -#endif switch (gfx_fb.framebuffer_common.framebuffer_bpp) { case 8: /* 8 bit */ fg = ca->fg_color.mono; @@ -762,9 +859,6 @@ gfx_fb_display_cursor(struct vis_conscursor *ca) } break; } -#if defined(EFI) - BS->RestoreTPL(tpl); -#endif } /* @@ -799,6 +893,10 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) uint32_t c, offset, pitch, bpp; uint8_t *fb; text_color_t fg, bg; +#if defined(EFI) + EFI_GRAPHICS_OUTPUT_BLT_PIXEL p; + extern EFI_GRAPHICS_OUTPUT *gop; +#endif if (plat_stdout_is_framebuffer() == 0) return; @@ -829,6 +927,16 @@ gfx_fb_setpixel(uint32_t x, uint32_t y) fb[offset + 2] = c & 0xff; break; case 32: +#if defined(EFI) + if (gop != NULL) { + p.Reserved = 0; + p.Red = (c >> 16) & 0xff; + p.Green = (c >> 8) & 0xff; + p.Blue = c & 0xff; + gop->Blt(gop, &p, EfiBltBufferToVideo, 0, 0, + x, y, 1, 1, 0); + } else +#endif *(uint32_t *)(fb + offset) = c; break; } diff --git a/usr/src/cmd/bhyve/bhyverun.c b/usr/src/cmd/bhyve/bhyverun.c index e3c56bdbd0..18bfda76f0 100644 --- a/usr/src/cmd/bhyve/bhyverun.c +++ b/usr/src/cmd/bhyve/bhyverun.c @@ -1337,8 +1337,20 @@ main(int argc, char *argv[]) if (dbg_port != 0) init_dbgport(dbg_port); +#ifdef __FreeBSD__ if (gdb_port != 0) init_gdb(ctx, gdb_port, gdb_stop); +#else + if (gdb_port < 0) { + /* + * Set up the internal gdb state needed for basic debugging, but + * skip the step of listening on a port for the GDB server. + */ + init_mdb(ctx, gdb_stop); + } else if (gdb_port != 0) { + init_gdb(ctx, gdb_port, gdb_stop); + } +#endif if (bvmcons) init_bvmcons(); diff --git a/usr/src/cmd/bhyve/gdb.c b/usr/src/cmd/bhyve/gdb.c index 6f6884eee8..720a55c58b 100644 --- a/usr/src/cmd/bhyve/gdb.c +++ b/usr/src/cmd/bhyve/gdb.c @@ -1840,6 +1840,42 @@ limit_gdb_socket(int s) } #endif + +#ifndef __FreeBSD__ +/* + * Equivalent to init_gdb() below, but without configuring the listening socket. + * This will allow the bhyve process to tolerate mdb attaching/detaching from + * the instance while it is running. + */ +void +init_mdb(struct vmctx *_ctx, bool wait) +{ + int error; + + error = pthread_mutex_init(&gdb_lock, NULL); + if (error != 0) + errc(1, error, "gdb mutex init"); + error = pthread_cond_init(&idle_vcpus, NULL); + if (error != 0) + errc(1, error, "gdb cv init"); + + ctx = _ctx; + stopped_vcpu = -1; + TAILQ_INIT(&breakpoints); + vcpu_state = calloc(guest_ncpus, sizeof(*vcpu_state)); + if (wait) { + /* + * Set vcpu 0 in vcpus_suspended. This will trigger the + * logic in gdb_cpu_add() to suspend the first vcpu before + * it starts execution. The vcpu will remain suspended + * until a debugger connects. + */ + CPU_SET(0, &vcpus_suspended); + stopped_vcpu = 0; + } +} +#endif + void init_gdb(struct vmctx *_ctx, int sport, bool wait) { diff --git a/usr/src/cmd/bhyve/gdb.h b/usr/src/cmd/bhyve/gdb.h index 93396c1c67..95afee7ac2 100644 --- a/usr/src/cmd/bhyve/gdb.h +++ b/usr/src/cmd/bhyve/gdb.h @@ -35,5 +35,8 @@ void gdb_cpu_breakpoint(int vcpu, struct vm_exit *vmexit); void gdb_cpu_mtrap(int vcpu); void gdb_cpu_suspend(int vcpu); void init_gdb(struct vmctx *ctx, int sport, bool wait); +#ifndef __FreeBSD__ +void init_mdb(struct vmctx *ctx, bool wait); +#endif #endif /* !__GDB_H__ */ diff --git a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c index d49d998404..2e7d4d397d 100644 --- a/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c +++ b/usr/src/cmd/fs.d/zfs/fstyp/fstyp.c @@ -31,6 +31,7 @@ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <sys/debug.h> #include <sys/types.h> #include <unistd.h> #include <libintl.h> @@ -89,11 +90,17 @@ fstyp_mod_ident(fstyp_mod_handle_t handle) char *str; uint64_t u64; char buf[64]; + int num_labels = 0; - if (zpool_read_label(h->fd, &h->config, NULL) != 0) { - return (FSTYP_ERR_NO_MATCH); + if (zpool_read_label(h->fd, &h->config, &num_labels) != 0) { + /* This is the only reason zpool_read_label() can fail */ + VERIFY3S(errno, ==, ENOMEM); + return (FSTYP_ERR_NOMEM); } + if (num_labels == 0) + return (FSTYP_ERR_NO_MATCH); + if (nvlist_lookup_uint64(h->config, ZPOOL_CONFIG_POOL_STATE, &state) != 0 || state == POOL_STATE_DESTROYED) { nvlist_free(h->config); diff --git a/usr/src/cmd/sgs/rtld/common/elf.c b/usr/src/cmd/sgs/rtld/common/elf.c index ff89028c38..c8def82f61 100644 --- a/usr/src/cmd/sgs/rtld/common/elf.c +++ b/usr/src/cmd/sgs/rtld/common/elf.c @@ -126,40 +126,13 @@ elf_get_sec_dirs() } /* - * Redefine NEEDED name if necessary. + * For a.out we have actual work to do here, on ELF we just perform path + * expansion. */ static int elf_fix_name(const char *name, Rt_map *clmp, Alist **alpp, Aliste alni, uint_t orig) { - /* - * For ABI compliance, if we are asked for ld.so.1, then really give - * them libsys.so.1 (the SONAME of libsys.so.1 is ld.so.1). - */ - if (((*name == '/') && - /* BEGIN CSTYLED */ -#if defined(_ELF64) - (strcmp(name, MSG_ORIG(MSG_PTH_RTLD_64)) == 0)) || -#else - (strcmp(name, MSG_ORIG(MSG_PTH_RTLD)) == 0)) || -#endif - (strcmp(name, MSG_ORIG(MSG_FIL_RTLD)) == 0)) { - /* END CSTYLED */ - Pdesc *pdp; - - DBG_CALL(Dbg_file_fixname(LIST(clmp), name, - MSG_ORIG(MSG_PTH_LIBSYS))); - if ((pdp = alist_append(alpp, NULL, sizeof (Pdesc), - alni)) == NULL) - return (0); - - pdp->pd_pname = (char *)MSG_ORIG(MSG_PTH_LIBSYS); - pdp->pd_plen = MSG_PTH_LIBSYS_SIZE; - pdp->pd_flags = PD_FLG_PNSLASH; - - return (1); - } - return (expand_paths(clmp, name, alpp, alni, orig, 0)); } diff --git a/usr/src/cmd/sgs/rtld/common/rtld.msg b/usr/src/cmd/sgs/rtld/common/rtld.msg index add19eaf80..0c0cff9e86 100644 --- a/usr/src/cmd/sgs/rtld/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg @@ -352,7 +352,6 @@ @ MSG_PTH_LDPROF "/usr/lib/link_audit/ldprof.so.1" @ MSG_PTH_LDPROFSE "/usr/lib/secure/ldprof.so.1" -@ MSG_PTH_LIBSYS "/usr/lib/libsys.so.1" @ MSG_PTH_RTLD "/usr/lib/ld.so.1" @ MSG_PTH_LIB "/lib" @ MSG_PTH_USRLIB "/usr/lib" diff --git a/usr/src/lib/Makefile b/usr/src/lib/Makefile index a0221ca855..4afeeacfd7 100644 --- a/usr/src/lib/Makefile +++ b/usr/src/lib/Makefile @@ -227,7 +227,6 @@ SUBDIRS += \ libstmfproxy \ libsum \ libsun_ima \ - libsys \ libsysevent \ libtecla \ libtermcap \ diff --git a/usr/src/lib/brand/lx/lx_brand/common/signal.c b/usr/src/lib/brand/lx/lx_brand/common/signal.c index 74abff9c8c..b83a60380d 100644 --- a/usr/src/lib/brand/lx/lx_brand/common/signal.c +++ b/usr/src/lib/brand/lx/lx_brand/common/signal.c @@ -26,6 +26,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ #include <sys/types.h> @@ -2400,10 +2401,21 @@ lx_signalfd4(int fd, uintptr_t mask, size_t msize, int flags) return (r == -1 ? -errno : r); } +/* + * Since this brackets vfork, we also use it as a synchronisation point to + * prevent multiple vfork() calls occuring in parallel. This is necessary + * because vfork() on illumos is not MT-safe whereas it is on Linux (with + * caveats). + * + * Some real-world applications (java in particular) can run multiple vfork() + * calls in parallel across different threads and they need to be serialised + * in the lx brand. + */ void lx_block_all_signals() { - (void) syscall(SYS_brand, B_BLOCK_ALL_SIGS); + while (syscall(SYS_brand, B_BLOCK_ALL_SIGS) != 0 && errno == EAGAIN) + yield(); } void diff --git a/usr/src/lib/libsys/Makefile b/usr/src/lib/libsys/Makefile deleted file mode 100644 index f956efa735..0000000000 --- a/usr/src/lib/libsys/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -include ../Makefile.lib - -SUBDIRS = $(MACH) - -all := TARGET= all -clean := TARGET= clean -clobber := TARGET= clobber -install := TARGET= install - -.KEEP_STATE: - -all clean clobber install: $(SUBDIRS) - - -$(SUBDIRS): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/lib/libsys/Makefile.com b/usr/src/lib/libsys/Makefile.com deleted file mode 100644 index cd829c5c1b..0000000000 --- a/usr/src/lib/libsys/Makefile.com +++ /dev/null @@ -1,36 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. -# - -LIBRARY = libsys.a -VERS = .1 - -# Define libsys to be a filter on libc. The ABI requires the runtime linker as -# the soname. -SONAME = /usr/lib/ld.so.1 -DYNFLAGS += -F /usr/lib/libc.so.1 - -COMSRC = $(COMOBJ:%.o=%.c) -MACHSRC = $(MACHOBJ:%.o=%.s) - -CLOBBERFILES += $(COMSRC) $(MACHSRC) diff --git a/usr/src/lib/libsys/Makefile.targ b/usr/src/lib/libsys/Makefile.targ deleted file mode 100644 index e025958f2f..0000000000 --- a/usr/src/lib/libsys/Makefile.targ +++ /dev/null @@ -1,39 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# Copyright 2019 Peter Tribble. -# - -BUILD.SO += $(PICS) - -$(COMSRC): ../common/libsys.sh libsys.list - sh ../common/libsys.sh - -$(MACHSRC): libsys.sh libsyss.list - sh ./libsys.sh - -pics/%.o := ASFLAGS += $(AS_PICFLAGS) - -pics/%.o: %.s - $(COMPILE.s) -o $@ $< - $(POST_PROCESS_S_O) diff --git a/usr/src/lib/libsys/common/libsys.sh b/usr/src/lib/libsys/common/libsys.sh deleted file mode 100644 index 4da1d42b66..0000000000 --- a/usr/src/lib/libsys/common/libsys.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -#ident "%Z%%M% %I% %E% SMI" - -# Stub library for programmer's interface to libsys. Used to satisfy ld(1) -# processing, and serves as a precedence place-holder at execution-time. - -awk ' -/.*/ { - if ($2 == "1") { - printf("#pragma weak %s = _%s\n", $3, $3); - flag = "_"; - } else - flag = ""; - if ($1 == "f") { - printf("void *\n%s%s()\n{\n", flag, $3); - printf("\t/*NOTREACHED*/\n\treturn (0);\n}\n\n"); - } else { - if ($4 == "1") - printf("%s %s%s %s %s\n\n", $5, flag, $3, $6, $7); - else if ($4 == "2") - printf("%s %s %s%s %s %s\n\n", $5, $6, flag, $3, $7, $8); - else if ($4 == "3") - printf("%s %s %s%s%s %s %s %s\n\n", $5, $6, flag, $3, $7, $8, $9, $10); - } -} -' libsys.list > libsys.c diff --git a/usr/src/lib/libsys/common/mapfile-vers b/usr/src/lib/libsys/common/mapfile-vers deleted file mode 100644 index c847354409..0000000000 --- a/usr/src/lib/libsys/common/mapfile-vers +++ /dev/null @@ -1,451 +0,0 @@ -# -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# - -# -# MAPFILE HEADER START -# -# WARNING: STOP NOW. DO NOT MODIFY THIS FILE. -# Object versioning must comply with the rules detailed in -# -# usr/src/lib/README.mapfiles -# -# You should not be making modifications here until you've read the most current -# copy of that file. If you need help, contact a gatekeeper for guidance. -# -# MAPFILE HEADER END -# - -$mapfile_version 2 - -$if !_ELF32 -$error libsys is only supported in 32-bit form -$endif - -$if _sparc -SYMBOL_VERSION SISCD_2.3 { - global: - SISCD_2.3; -} SYSVABI_1.3; -$endif - -SYMBOL_VERSION SYSVABI_1.3 { - global: - _makecontext; - makecontext; - _swapcontext; - swapcontext; - local: - *; -} SYSVABI_1.2; - -SYMBOL_VERSION SYSVABI_1.2 { - global: - _access; - access; - _acct; - acct; - _alarm; - alarm; - _altzone; - atexit; - calloc; - _catclose; - catclose; - _catgets; - catgets; - _catopen; - catopen; - _chdir; - chdir; - _chmod; - chmod; - _chown; - chown; - _chroot; - chroot; - _close; - close; - _closedir; - closedir; - _creat; - creat; - __ctype; - _daylight; - daylight; - _dup; - dup; - _environ; - environ; - _execl; - execl; - _execle; - execle; - _execlp; - execlp; - _execv; - execv; - _execve; - execve; - _execvp; - execvp; - _exit; - exit; - _fattach; - fattach; - _fchdir; - fchdir; - _fchmod; - fchmod; - _fchown; - fchown; - _fcntl; - fcntl; - _fdetach; - fdetach; - _fork; - fork; - _fpathconf; - fpathconf; - free; - _fstat; - fstat; - _fstatvfs; - fstatvfs; - _fsync; - fsync; - _ftok; - ftok; - _getcontext; - getcontext; - _getcwd; - getcwd; - _getegid; - getegid; - _geteuid; - geteuid; - _getgid; - getgid; - _getgrgid; - getgrgid; - _getgrnam; - getgrnam; - _getgroups; - getgroups; - _getlogin; - getlogin; - _getmsg; - getmsg; - _getpgid; - getpgid; - _getpgrp; - getpgrp; - _getpid; - getpid; - _getpmsg; - getpmsg; - _getppid; - getppid; - _getpwnam; - getpwnam; - _getpwuid; - getpwuid; - _getrlimit; - getrlimit; - _getsid; - getsid; - _gettxt; - gettxt; - _getuid; - getuid; - _grantpt; - grantpt; - __huge_val; - _initgroups; - initgroups; - _ioctl; - ioctl; - _isastream; - isastream; - _kill; - kill; - _lchown; - lchown; - _link; - link; - localeconv; - _lseek; - lseek; - _lstat; - lstat; - malloc; - _memcntl; - memcntl; - _mkdir; - mkdir; - _mknod; - mknod; - _mlock; - mlock; - mmap; - _mount; - mount; - _mprotect; - mprotect; - _msgctl; - msgctl; - _msgget; - msgget; - _msgrcv; - msgrcv; - _msgsnd; - msgsnd; - _msync; - msync; - _munlock; - munlock; - _munmap; - munmap; - _nice; - nice; - _numeric; - _open; - open; - _opendir; - opendir; - _pathconf; - pathconf; - _pause; - pause; - _pipe; - pipe; - _poll; - poll; - _profil; - profil; - _ptrace; - ptrace; - _ptsname; - ptsname; - _putmsg; - putmsg; - _putpmsg; - putpmsg; - _read; - read; - _readdir; - readdir; - _readlink; - readlink; - _readv; - readv; - realloc; - remove; - _rename; - rename; - _rewinddir; - rewinddir; - _rmdir; - rmdir; - _seekdir; - seekdir; - _semctl; - semctl; - _semget; - semget; - _semop; - semop; - _setcontext; - setcontext; - _setgid; - setgid; - _setgroups; - setgroups; - setlocale; - _setpgid; - setpgid; - _setpgrp; - setpgrp; - _setrlimit; - setrlimit; - _setsid; - setsid; - _setuid; - setuid; - _shmat; - shmat; - _shmctl; - shmctl; - _shmdt; - shmdt; - _shmget; - shmget; - _sigaction; - sigaction; - _sigaddset; - sigaddset; - _sigaltstack; - sigaltstack; - _sigdelset; - sigdelset; - _sigemptyset; - sigemptyset; - _sigfillset; - sigfillset; - _sighold; - sighold; - _sigignore; - sigignore; - _sigismember; - sigismember; - _siglongjmp; - siglongjmp; - signal; - _sigpause; - sigpause; - _sigpending; - sigpending; - _sigprocmask; - sigprocmask; - _sigrelse; - sigrelse; - _sigsend; - sigsend; - _sigsendset; - sigsendset; - _sigset; - sigset; - _sigsetjmp; - sigsetjmp; - _sigsuspend; - sigsuspend; - _stat; - stat; - _statvfs; - statvfs; - _stime; - stime; - strcoll; - strerror; - strftime; - strxfrm; - _symlink; - symlink; - _sync; - sync; - _sysconf; - sysconf; - system; - _telldir; - telldir; - _time; - time; - _times; - times; - _timezone; - timezone; - _ttyname; - ttyname; - _tzname; - tzname; - _ulimit; - ulimit; - _umask; - umask; - _umount; - umount; - _uname; - uname; - _unlink; - unlink; - _unlockpt; - unlockpt; - _utime; - utime; - _wait; - wait; - _waitid; - waitid; - _waitpid; - waitpid; - _write; - write; - _writev; - writev; - -$if _sparc - # Sparc-only interfaces - _Q_add; - _Q_cmp; - _Q_cmpe; - _Q_div; - _Q_dtoq; - _Q_feq; - _Q_fge; - _Q_fgt; - _Q_fle; - _Q_flt; - _Q_fne; - _Q_itoq; - _Q_mul; - _Q_neg; - _Q_qtod; - _Q_qtoi; - _Q_qtos; - _Q_qtou; - _Q_sqrt; - _Q_stoq; - _Q_sub; - _Q_utoq; - .div; - __dtou; - __ftou; - _mmap { FLAGS = NODYNSORT }; - .mul; - .rem; - .stret1; - .stret2; - .stret4; - .stret8; - .udiv; - .umul; - .urem; -$endif - -$if _x86 - # X86-only interfaces - __flt_rounds; - _fp_hw; - _fpstart; - _fxstat; - _lxstat; - _mmap; - _nuname; - nuname; - _sbrk; - sbrk; - _xmknod; - _xstat; -$endif - - -}; diff --git a/usr/src/lib/libsys/i386/Makefile b/usr/src/lib/libsys/i386/Makefile deleted file mode 100644 index 6e0d26d1db..0000000000 --- a/usr/src/lib/libsys/i386/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# Define objects first to trigger $(PIC) rules in Makefile.lib - -COMOBJ = libsys.o -OBJECTS = $(COMOBJ) - -include $(SRC)/lib/Makefile.filter.com -include ../Makefile.com - -install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) - -include $(SRC)/lib/Makefile.filter.targ -include ../Makefile.targ diff --git a/usr/src/lib/libsys/i386/libsys.list b/usr/src/lib/libsys/i386/libsys.list deleted file mode 100644 index 847377f256..0000000000 --- a/usr/src/lib/libsys/i386/libsys.list +++ /dev/null @@ -1,192 +0,0 @@ -f 1 access -f 1 acct -f 1 alarm -f 1 catclose -f 1 catgets -f 1 catopen -f 1 chdir -f 1 chmod -f 1 chown -f 1 chroot -f 1 close -f 1 closedir -f 1 creat -f 1 dup -f 1 execl -f 1 execle -f 1 execlp -f 1 execv -f 1 execve -f 1 execvp -f 1 fattach -f 1 fchdir -f 1 fchmod -f 1 fchown -f 1 fcntl -f 1 fdetach -f 1 fork -f 1 fpathconf -f 1 fstat -f 1 fstatvfs -f 1 fsync -f 1 ftok -f 1 getcontext -f 1 getcwd -f 1 getegid -f 1 geteuid -f 1 getgid -f 1 getgrgid -f 1 getgrnam -f 1 getgroups -f 1 getlogin -f 1 getmsg -f 1 getpgid -f 1 getpgrp -f 1 getpid -f 1 getpmsg -f 1 getppid -f 1 getpwnam -f 1 getpwuid -f 1 getrlimit -f 1 getsid -f 1 gettxt -f 1 getuid -f 1 grantpt -f 1 initgroups -f 1 ioctl -f 1 isastream -f 1 kill -f 1 lchown -f 1 link -f 1 lseek -f 1 lstat -f 1 makecontext -f 1 memcntl -f 1 mkdir -f 1 mknod -f 1 mlock -f 1 mmap -f 1 mount -f 1 mprotect -f 1 msgctl -f 1 msgget -f 1 msgrcv -f 1 msgsnd -f 1 msync -f 1 munlock -f 1 munmap -f 1 nuname -f 1 nice -f 1 open -f 1 opendir -f 1 pathconf -f 1 pause -f 1 pipe -f 1 poll -f 1 profil -f 1 ptrace -f 1 ptsname -f 1 putmsg -f 1 putpmsg -f 1 read -f 1 readdir -f 1 readlink -f 1 readv -f 1 rename -f 1 rewinddir -f 1 rmdir -f 1 sbrk -f 1 seekdir -f 1 semctl -f 1 semget -f 1 semop -f 1 setcontext -f 1 setgid -f 1 setgroups -f 1 setpgid -f 1 setpgrp -f 1 setrlimit -f 1 setsid -f 1 setuid -f 1 shmat -f 1 shmctl -f 1 shmdt -f 1 shmget -f 1 sigaction -f 1 sigaddset -f 1 sigaltstack -f 1 sigdelset -f 1 sigemptyset -f 1 sigfillset -f 1 sighold -f 1 sigignore -f 1 sigismember -f 1 siglongjmp -f 1 sigpause -f 1 sigpending -f 1 sigprocmask -f 1 sigrelse -f 1 sigsend -f 1 sigsendset -f 1 sigset -f 1 sigsetjmp -f 1 sigsuspend -f 1 stat -f 1 statvfs -f 1 stime -f 1 swapcontext -f 1 symlink -f 1 sync -f 1 sysconf -f 1 telldir -f 1 time -f 1 times -f 1 ttyname -f 1 ulimit -f 1 umask -f 1 umount -f 1 uname -f 1 unlink -f 1 unlockpt -f 1 utime -f 1 wait -f 1 waitid -f 1 waitpid -f 1 write -f 1 writev - -f 0 atexit -f 0 calloc -f 0 exit -f 0 _exit -f 0 free -f 0 localeconv -f 0 malloc -f 0 realloc -f 0 remove -f 0 setlocale -f 0 signal -f 0 strcoll -f 0 strerror -f 0 strftime -f 0 strxfrm -f 0 system -f 0 _fxstat -f 0 _lxstat -f 0 _xmknod -f 0 _xstat -f 0 _fpstart - -d 0 _altzone 1 long = 0; -d 0 __ctype[257+257+7] 2 unsigned char = {0}; -d 0 _numeric[2] 2 unsigned char = {0}; - -d 1 daylight 1 int = 0; -d 1 timezone 1 long = 0; -d 1 tzname 3 char * [2] = {(char*)0,(char*)0}; - -d 1 environ 2 char ** = 0; - -d 0 __huge_val[2] 2 unsigned long = {0x7ff00000,0x0}; -d 0 __flt_rounds 1 long = 0; -d 0 _fp_hw 1 long = 3; diff --git a/usr/src/lib/libsys/sparc/Makefile b/usr/src/lib/libsys/sparc/Makefile deleted file mode 100644 index 249cb75708..0000000000 --- a/usr/src/lib/libsys/sparc/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2009 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# - -# Define objects first to trigger $(PIC) rules in Makefile.lib - -COMOBJ = libsys.o -MACHOBJ = libsyss.o -OBJECTS = $(COMOBJ) $(MACHOBJ) - -include $(SRC)/lib/Makefile.filter.com -include ../Makefile.com - -install: all $(ROOTLIBDIR) .WAIT $(ROOTLIBS) $(ROOTLINKS) - -include $(SRC)/lib/Makefile.filter.targ -include ../Makefile.targ diff --git a/usr/src/lib/libsys/sparc/libsys.list b/usr/src/lib/libsys/sparc/libsys.list deleted file mode 100644 index 9f9dde7e55..0000000000 --- a/usr/src/lib/libsys/sparc/libsys.list +++ /dev/null @@ -1,207 +0,0 @@ -f 1 access -f 1 acct -f 1 alarm -f 1 catclose -f 1 catgets -f 1 catopen -f 1 chdir -f 1 chmod -f 1 chown -f 1 chroot -f 1 close -f 1 closedir -f 1 creat -f 1 dup -f 1 execl -f 1 execle -f 1 execlp -f 1 execv -f 1 execve -f 1 execvp -f 1 fattach -f 1 fchdir -f 1 fchmod -f 1 fchown -f 1 fcntl -f 1 fdetach -f 1 fork -f 1 fpathconf -f 1 fstat -f 1 fstatvfs -f 1 fsync -f 1 ftok -f 1 getcontext -f 1 getcwd -f 1 getegid -f 1 geteuid -f 1 getgid -f 1 getgrgid -f 1 getgrnam -f 1 getgroups -f 1 getlogin -f 1 getmsg -f 1 getpgid -f 1 getpgrp -f 1 getpid -f 1 getpmsg -f 1 getppid -f 1 getpwnam -f 1 getpwuid -f 1 getrlimit -f 1 getsid -f 1 gettxt -f 1 getuid -f 1 grantpt -f 1 initgroups -f 1 ioctl -f 1 isastream -f 1 kill -f 1 lchown -f 1 link -f 1 lseek -f 1 lstat -f 1 makecontext -f 1 memcntl -f 1 mkdir -f 1 mknod -f 1 mlock -f 1 mmap -f 1 mount -f 1 mprotect -f 1 msgctl -f 1 msgget -f 1 msgrcv -f 1 msgsnd -f 1 msync -f 1 munlock -f 1 munmap -f 1 nice -f 1 open -f 1 opendir -f 1 pathconf -f 1 pause -f 1 pipe -f 1 poll -f 1 profil -f 1 ptrace -f 1 ptsname -f 1 putmsg -f 1 putpmsg -f 1 read -f 1 readdir -f 1 readlink -f 1 readv -f 1 rename -f 1 rewinddir -f 1 rmdir -f 1 seekdir -f 1 semctl -f 1 semget -f 1 semop -f 1 setcontext -f 1 setgid -f 1 setgroups -f 1 setpgid -f 1 setpgrp -f 1 setrlimit -f 1 setsid -f 1 setuid -f 1 shmat -f 1 shmctl -f 1 shmdt -f 1 shmget -f 1 sigaction -f 1 sigaddset -f 1 sigaltstack -f 1 sigdelset -f 1 sigemptyset -f 1 sigfillset -f 1 sighold -f 1 sigignore -f 1 sigismember -f 1 siglongjmp -f 1 sigpause -f 1 sigpending -f 1 sigprocmask -f 1 sigrelse -f 1 sigsend -f 1 sigsendset -f 1 sigset -f 1 sigsetjmp -f 1 sigsuspend -f 1 stat -f 1 statvfs -f 1 stime -f 1 swapcontext -f 1 symlink -f 1 sync -f 1 sysconf -f 1 telldir -f 1 time -f 1 times -f 1 ttyname -f 1 ulimit -f 1 umask -f 1 umount -f 1 uname -f 1 unlink -f 1 unlockpt -f 1 utime -f 1 wait -f 1 waitid -f 1 waitpid -f 1 write -f 1 writev - -f 0 atexit -f 0 calloc -f 0 exit -f 0 _exit -f 0 free -f 0 localeconv -f 0 malloc -f 0 realloc -f 0 remove -f 0 setlocale -f 0 signal -f 0 strcoll -f 0 strerror -f 0 strftime -f 0 strxfrm -f 0 system -f 0 _Q_add -f 0 _Q_cmp -f 0 _Q_cmpe -f 0 _Q_div -f 0 _Q_dtoq -f 0 _Q_feq -f 0 _Q_fge -f 0 _Q_fgt -f 0 _Q_fle -f 0 _Q_flt -f 0 _Q_fne -f 0 _Q_itoq -f 0 _Q_mul -f 0 _Q_neg -f 0 _Q_qtod -f 0 _Q_qtoi -f 0 _Q_qtos -f 0 _Q_qtou -f 0 _Q_sqrt -f 0 _Q_stoq -f 0 _Q_sub -f 0 _Q_utoq -f 0 __dtou -f 0 __ftou - -d 0 _altzone 1 long = 0; -d 0 __ctype[257+257+7] 2 unsigned char = {0}; -d 0 _numeric[2] 2 unsigned char = {0}; - -d 1 daylight 1 int = 0; -d 1 timezone 1 long = 0; -d 1 tzname 3 char * [2] = {(char*)0,(char*)0}; - -d 1 environ 2 char ** = 0; - -d 0 __huge_val[2] 2 unsigned long = {0x7ff00000,0x0}; diff --git a/usr/src/lib/libsys/sparc/libsys.sh b/usr/src/lib/libsys/sparc/libsys.sh deleted file mode 100644 index 7a3079a756..0000000000 --- a/usr/src/lib/libsys/sparc/libsys.sh +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1995 by Sun Microsystems, Inc. -# All rights reserved. -# -# Stub library for programmer's interface to libsys. Used to satisfy ld(1) -# processing, and serves as a precedence place-holder at execution-time. - -awk ' -BEGIN { - printf("\t.file\t\"libsyss.s\"\n\t.section\t\".text\"\n"); -} -/.*/ { - printf("\t.global\t%s\n%s:\n\tt 5\n\t.type\t%s,#function\n\t.size\t%s,.-%s\n", $0, $0, $0, $0, $0); -} -' libsyss.list > libsyss.s diff --git a/usr/src/lib/libsys/sparc/libsyss.list b/usr/src/lib/libsys/sparc/libsyss.list deleted file mode 100644 index 15189a3e50..0000000000 --- a/usr/src/lib/libsys/sparc/libsyss.list +++ /dev/null @@ -1,10 +0,0 @@ -.div -.mul -.rem -.stret1 -.stret2 -.stret4 -.stret8 -.udiv -.umul -.urem diff --git a/usr/src/lib/libvmm/libvmm.c b/usr/src/lib/libvmm/libvmm.c index dc552a8de0..df3d8ec99f 100644 --- a/usr/src/lib/libvmm/libvmm.c +++ b/usr/src/lib/libvmm/libvmm.c @@ -11,6 +11,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ /* @@ -199,12 +200,31 @@ vmm_map(vmm_t *vmm, boolean_t writable) for (ms = list_head(&vmm->vmm_memlist); ms != NULL; ms = list_next(&vmm->vmm_memlist, ms)) { - off_t mapoff = ms->vms_gpa; + off_t mapoff; + + if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) == 0) { + /* + * sysmem segments will be located at an offset + * equivalent to their GPA. + */ + mapoff = ms->vms_gpa; + } else { + /* + * devmem segments are located in a special region away + * from the normal GPA space. + */ + if (vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid, + &mapoff) != 0) { + goto fail; + } + } - if ((ms->vms_flags & VMM_MEMSEG_DEVMEM) && - vm_get_devmem_offset(vmm->vmm_ctx, ms->vms_segid, &mapoff) - != 0) - goto fail; + /* + * While 'mapoff' points to the front of the segment, the actual + * mapping may be at some offset beyond that. + */ + VERIFY(ms->vms_segoff >= 0); + mapoff += ms->vms_segoff; vmm->vmm_memsize += ms->vms_maplen; diff --git a/usr/src/lib/libzfs/common/libzfs_import.c b/usr/src/lib/libzfs/common/libzfs_import.c index 706f08e6ec..dc15aca0c0 100644 --- a/usr/src/lib/libzfs/common/libzfs_import.c +++ b/usr/src/lib/libzfs/common/libzfs_import.c @@ -169,23 +169,66 @@ zpool_clear_label(int fd) int l; vdev_label_t *label; uint64_t size; + int labels_cleared = 0; if (fstat64(fd, &statbuf) == -1) return (0); + size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); if ((label = calloc(sizeof (vdev_label_t), 1)) == NULL) return (-1); for (l = 0; l < VDEV_LABELS; l++) { - if (pwrite64(fd, label, sizeof (vdev_label_t), + uint64_t state, guid; + nvlist_t *config; + + if (pread64(fd, label, sizeof (vdev_label_t), label_offset(size, l)) != sizeof (vdev_label_t)) { - free(label); - return (-1); + continue; + } + + if (nvlist_unpack(label->vl_vdev_phys.vp_nvlist, + sizeof (label->vl_vdev_phys.vp_nvlist), &config, 0) != 0) { + continue; + } + + /* Skip labels which do not have a valid guid. */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_GUID, + &guid) != 0 || guid == 0) { + nvlist_free(config); + continue; + } + + /* Skip labels which are not in a known valid state. */ + if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_POOL_STATE, + &state) != 0 || state > POOL_STATE_L2CACHE) { + nvlist_free(config); + continue; + } + + nvlist_free(config); + + /* + * A valid label was found, overwrite this label's nvlist + * and uberblocks with zeros on disk. This is done to prevent + * system utilities, like blkid, from incorrectly detecting a + * partial label. The leading pad space is left untouched. + */ + memset(label, 0, sizeof (vdev_label_t)); + size_t label_size = sizeof (vdev_label_t) - (2 * VDEV_PAD_SIZE); + + if (pwrite64(fd, label, label_size, label_offset(size, l) + + (2 * VDEV_PAD_SIZE)) == label_size) { + labels_cleared++; } } free(label); + + if (labels_cleared == 0) + return (-1); + return (0); } diff --git a/usr/src/lib/libzutil/common/zutil_import.c b/usr/src/lib/libzutil/common/zutil_import.c index 961247c5c0..b4e6ccc0ca 100644 --- a/usr/src/lib/libzutil/common/zutil_import.c +++ b/usr/src/lib/libzutil/common/zutil_import.c @@ -25,6 +25,7 @@ * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright 2015 RackTop Systems. * Copyright (c) 2016, Intel Corporation. + * Copyright 2020 Joyent, Inc. */ /* @@ -913,8 +914,11 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels) *config = NULL; + if (num_labels != NULL) + *num_labels = 0; + if (fstat64(fd, &statbuf) == -1) - return (-1); + return (0); size = P2ALIGN_TYPED(statbuf.st_size, sizeof (vdev_label_t), uint64_t); if ((label = malloc(sizeof (vdev_label_t))) == NULL) @@ -968,11 +972,6 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels) free(label); *config = expected_config; - if (count == 0) { - errno = ENOENT; - return (-1); - } - return (0); } diff --git a/usr/src/man/man1/sed.1 b/usr/src/man/man1/sed.1 index 688d11ae41..441f877919 100644 --- a/usr/src/man/man1/sed.1 +++ b/usr/src/man/man1/sed.1 @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.TH SED 1 "Feb 14, 2015" +.TH SED 1 "Aug 7, 2020" .SH NAME \fBsed\fP \- stream editor @@ -53,7 +53,7 @@ are specified, modifying the input as specified by a list of commands. The input is then written to the standard output. A single command may be specified as the first argument to -\fB.\fP +\fBsed\fP. Multiple commands may be specified by using the \fB\-e\fP or diff --git a/usr/src/man/man3lib/Makefile b/usr/src/man/man3lib/Makefile index 6beb4fcb31..8df73bde6b 100644 --- a/usr/src/man/man3lib/Makefile +++ b/usr/src/man/man3lib/Makefile @@ -97,7 +97,6 @@ MANFILES= libMPAPI.3lib \ libslp.3lib \ libsocket.3lib \ libstmf.3lib \ - libsys.3lib \ libsysevent.3lib \ libtecla.3lib \ libthread.3lib \ diff --git a/usr/src/man/man3lib/libsys.3lib b/usr/src/man/man3lib/libsys.3lib deleted file mode 100644 index df7229abf2..0000000000 --- a/usr/src/man/man3lib/libsys.3lib +++ /dev/null @@ -1,214 +0,0 @@ -'\" te -.\" Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved. -.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. -.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. -.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] -.TH LIBSYS 3LIB "May 22, 2003" -.SH NAME -libsys \- system library -.SH SYNOPSIS -.LP -.nf -cc [ \fIflag\fR... ] \fIfile\fR... \fB-lsys\fR [ \fIlibrary\fR... ] -.fi - -.SH DESCRIPTION -.sp -.LP -Functions in this library provide basic system services. This library is -implemented as a filter on the C library (see \fBlibc\fR(3LIB)). -.SH INTERFACES -.sp -.LP -The shared object \fBlibsys.so.1\fR provides the public interfaces defined -below. See \fBIntro\fR(3) for additional information on shared object -interfaces. -.sp - -.sp -.TS -l l l -l l l . -\fB__ctype\fR \fB__huge_val\fR \fB_access\fR -\fB_acct\fR \fB_alarm\fR \fB_altzone\fR -\fB_catclose\fR \fB_catgets\fR \fB_catopen\fR -\fB_chdir\fR \fB_chmod\fR \fB_chown\fR -\fB_chroot\fR \fB_close\fR \fB_closedir\fR -\fB_creat\fR \fB_daylight\fR \fB_dup\fR -\fB_environ\fR \fB_execl\fR \fB_execle\fR -\fB_execlp\fR \fB_execv\fR \fB_execve\fR -\fB_execvp\fR \fB_exit\fR \fB_fattach\fR -\fB_fchdir\fR \fB_fchmod\fR \fB_fchown\fR -\fB_fcntl\fR \fB_fdetach\fR \fB_fork\fR -\fB_fpathconf\fR \fB_fstat\fR \fB_fstatvfs\fR -\fB_fsync\fR \fB_ftok\fR \fB_getcontext\fR -\fB_getcwd\fR \fB_getegid\fR \fB_geteuid\fR -\fB_getgid\fR \fB_getgrgid\fR \fB_getgrnam\fR -\fB_getgroups\fR \fB_getlogin\fR \fB_getmsg\fR -\fB_getpgid\fR \fB_getpgrp\fR \fB_getpid\fR -\fB_getpmsg\fR \fB_getppid\fR \fB_getpwnam\fR -\fB_getpwuid\fR \fB_getrlimit\fR \fB_getsid\fR -\fB_gettxt\fR \fB_getuid\fR \fB_grantpt\fR -\fB_initgroups\fR \fB_ioctl\fR \fB_isastream\fR -\fB_kill\fR \fB_lchown\fR \fB_link\fR -\fB_lseek\fR \fB_lstat\fR \fB_makecontext\fR -\fB_memcntl\fR \fB_mkdir\fR \fB_mknod\fR -\fB_mlock\fR \fB_mmap\fR \fB_mount\fR -\fB_mprotect\fR \fB_msgctl\fR \fB_msgget\fR -\fB_msgrcv\fR \fB_msgsnd\fR \fB_msync\fR -\fB_munlock\fR \fB_munmap\fR \fB_nice\fR -\fB_numeric\fR \fB_open\fR \fB_opendir\fR -\fB_pathconf\fR \fB_pause\fR \fB_pipe\fR -\fB_poll\fR \fB_profil\fR \fB_ptrace\fR -\fB_ptsname\fR \fB_putmsg\fR \fB_putpmsg\fR -\fB_read\fR \fB_readdir\fR \fB_readlink\fR -\fB_readv\fR \fB_rename\fR \fB_rewinddir\fR -\fB_rmdir\fR \fB_seekdir\fR \fB_semctl\fR -\fB_semget\fR \fB_semop\fR \fB_setcontext\fR -\fB_setgid\fR \fB_setgroups\fR \fB_setpgid\fR -\fB_setpgrp\fR \fB_setrlimit\fR \fB_setsid\fR -\fB_setuid\fR \fB_shmat\fR \fB_shmctl\fR -\fB_shmdt\fR \fB_shmget\fR \fB_sigaction\fR -\fB_sigaddset\fR \fB_sigaltstack\fR \fB_sigdelset\fR -\fB_sigemptyset\fR \fB_sigfillset\fR \fB_sighold\fR -\fB_sigignore\fR \fB_sigismember\fR \fB_siglongjmp\fR -\fB_sigpause\fR \fB_sigpending\fR \fB_sigprocmask\fR -\fB_sigrelse\fR \fB_sigsend\fR \fB_sigsendset\fR -\fB_sigset\fR \fB_sigsetjmp\fR \fB_sigsuspend\fR -\fB_stat\fR \fB_statvfs\fR \fB_stime\fR -\fB_swapcontext\fR \fB_symlink\fR \fB_sync\fR -\fB_sysconf\fR \fB_telldir\fR \fB_time\fR -\fB_times\fR \fB_timezone\fR \fB_ttyname\fR -\fB_tzname\fR \fB_ulimit\fR \fB_umask\fR -\fB_umount\fR \fB_uname\fR \fB_unlink\fR -\fB_unlockpt\fR \fB_utime\fR \fB_wait\fR -\fB_waitid\fR \fB_waitpid\fR \fB_write\fR -\fB_writev\fR \fBaccess\fR \fBacct\fR -\fBalarm\fR \fBatexit\fR \fBcalloc\fR -\fBcatclose\fR \fBcatgets\fR \fBcatopen\fR -\fBchdir\fR \fBchmod\fR \fBchown\fR -\fBchroot\fR \fBclose\fR \fBclosedir\fR -\fBcreat\fR \fBdaylight\fR \fBdup\fR -\fBenviron\fR \fBexecl\fR \fBexecle\fR -\fBexeclp\fR \fBexecv\fR \fBexecve\fR -\fBexecvp\fR \fBexit\fR \fBfattach\fR -\fBfchdir\fR \fBfchmod\fR \fBfchown\fR -\fBfcntl\fR \fBfdetach\fR \fBfork\fR -\fBfpathconf\fR \fBfree\fR \fBfstat\fR -\fBfstatvfs\fR \fBfsync\fR \fBftok\fR -\fBgetcontext\fR \fBgetcwd\fR \fBgetegid\fR -\fBgeteuid\fR \fBgetgid\fR \fBgetgrgid\fR -\fBgetgrnam\fR \fBgetgroups\fR \fBgetlogin\fR -\fBgetmsg\fR \fBgetpgid\fR \fBgetpgrp\fR -\fBgetpid\fR \fBgetpmsg\fR \fBgetppid\fR -\fBgetpwnam\fR \fBgetpwuid\fR \fBgetrlimit\fR -\fBgetsid\fR \fBgettxt\fR \fBgetuid\fR -\fBgrantpt\fR \fBinitgroups\fR \fBioctl\fR -\fBisastream\fR \fBkill\fR \fBlchown\fR -\fBlink\fR \fBlocaleconv\fR \fBlseek\fR -\fBlstat\fR \fBmakecontext\fR \fBmalloc\fR -\fBmemcntl\fR \fBmkdir\fR \fBmknod\fR -\fBmlock\fR \fBmmap\fR \fBmount\fR -\fBmprotect\fR \fBmsgctl\fR \fBmsgget\fR -\fBmsgrcv\fR \fBmsgsnd\fR \fBmsync\fR -\fBmunlock\fR \fBmunmap\fR \fBnice\fR -\fBopen\fR \fBopendir\fR \fBpathconf\fR -\fBpause\fR \fBpipe\fR \fBpoll\fR -\fBprofil\fR \fBptrace\fR \fBptsname\fR -\fBputmsg\fR \fBputpmsg\fR \fBread\fR -\fBreaddir\fR \fBreadlink\fR \fBreadv\fR -\fBrealloc\fR \fBremove\fR \fBrename\fR -\fBrewinddir\fR \fBrmdir\fR \fBseekdir\fR -\fBsemctl\fR \fBsemget\fR \fBsemop\fR -\fBsetcontext\fR \fBsetgid\fR \fBsetgroups\fR -\fBsetlocale\fR \fBsetpgid\fR \fBsetpgrp\fR -\fBsetrlimit\fR \fBsetsid\fR \fBsetuid\fR -\fBshmat\fR \fBshmctl\fR \fBshmdt\fR -\fBshmget\fR \fBsigaction\fR \fBsigaddset\fR -\fBsigaltstack\fR \fBsigdelset\fR \fBsigemptyset\fR -\fBsigfillset\fR \fBsighold\fR \fBsigignore\fR -\fBsigismember\fR \fBsiglongjmp\fR \fBsignal\fR -\fBsigpause\fR \fBsigpending\fR \fBsigprocmask\fR -\fBsigrelse\fR \fBsigsend\fR \fBsigsendset\fR -\fBsigset\fR \fBsigsetjmp\fR \fBsigsuspend\fR -\fBstat\fR \fBstatvfs\fR \fBstime\fR -\fBstrcoll\fR \fBstrerror\fR \fBstrftime\fR -\fBstrxfrm\fR \fBswapcontext\fR \fBsymlink\fR -\fBsync\fR \fBsysconf\fR \fBsystem\fR -\fBtelldir\fR \fBtime\fR \fBtimes\fR -\fBtimezone\fR \fBttyname\fR \fBtzname\fR -\fBulimit\fR \fBumask\fR \fBumount\fR -\fBuname\fR \fBunlink\fR \fBunlockpt\fR -\fButime\fR \fBwait\fR \fBwaitid\fR -\fBwaitpid\fR \fBwrite\fR \fBwritev\fR -.TE - -.sp -.LP -The following interfaces are unique to the SPARC version of this library: -.sp - -.sp -.TS -l l l -l l l . -\fB\&.div\fR \fB\&.mul\fR \fB\&.rem\fR -\fB\&.stret1\fR \fB\&.stret2\fR \fB\&.stret4\fR -\fB\&.stret8\fR \fB\&.udiv\fR \fB\&.umul\fR -\fB\&.urem\fR \fB_Q_add\fR \fB_Q_cmp\fR -\fB_Q_cmpe\fR \fB_Q_div\fR \fB_Q_dtoq\fR -\fB_Q_feq\fR \fB_Q_fge\fR \fB_Q_fgt\fR -\fB_Q_fle\fR \fB_Q_flt\fR \fB_Q_fne\fR -\fB_Q_itoq\fR \fB_Q_mul\fR \fB_Q_neg\fR -\fB_Q_qtod\fR \fB_Q_qtoi\fR \fB_Q_qtos\fR -\fB_Q_qtou\fR \fB_Q_sqrt\fR \fB_Q_stoq\fR -\fB_Q_sub\fR \fB_Q_utoq\fR \fB__dtou\fR -\fB__ftou\fR -.TE - -.sp -.LP -The following interfaces are unique to the x86 version of this library: -.sp - -.sp -.TS -l l l -l l l . -\fB__flt_rounds\fR \fB_fp_hw\fR \fB_fpstart\fR -\fB_fxstat\fR \fB_lxstat\fR \fB_nuname\fR -\fB_sbrk\fR \fB_xmknod\fR \fB_xstat\fR -\fBnuname\fR \fBsbrk\fR -.TE - -.SH FILES -.sp -.ne 2 -.na -\fB\fB/usr/lib/libsys.so.1\fR\fR -.ad -.RS 24n -shared object -.RE - -.SH ATTRIBUTES -.sp -.LP -See \fBattributes\fR(5) for descriptions of the following attributes: -.sp - -.sp -.TS -box; -c | c -l | l . -ATTRIBUTE TYPE ATTRIBUTE VALUE -_ -MT-Level Safe -.TE - -.SH SEE ALSO -.sp -.LP -\fBpvs\fR(1), \fBIntro\fR(2), \fBIntro\fR(3), \fBlibc\fR(3LIB), -\fBattributes\fR(5) diff --git a/usr/src/pkg/manifests/system-library.man3lib.inc b/usr/src/pkg/manifests/system-library.man3lib.inc index bf60cd2b7a..750b223713 100644 --- a/usr/src/pkg/manifests/system-library.man3lib.inc +++ b/usr/src/pkg/manifests/system-library.man3lib.inc @@ -74,7 +74,6 @@ file path=usr/share/man/man3lib/libsecdb.3lib file path=usr/share/man/man3lib/libsendfile.3lib file path=usr/share/man/man3lib/libsip.3lib file path=usr/share/man/man3lib/libsocket.3lib -file path=usr/share/man/man3lib/libsys.3lib file path=usr/share/man/man3lib/libsysevent.3lib file path=usr/share/man/man3lib/libthread.3lib file path=usr/share/man/man3lib/libtsnet.3lib diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf index 6ae9fc7378..1ab189080b 100644 --- a/usr/src/pkg/manifests/system-library.mf +++ b/usr/src/pkg/manifests/system-library.mf @@ -467,7 +467,6 @@ file path=usr/lib/libsldap.so.1 file path=usr/lib/libsmbios.so.1 file path=usr/lib/libsoftcrypto.so.1 file path=usr/lib/libsum.so.1 -file path=usr/lib/libsys.so.1 $(sparc_ONLY)file path=usr/lib/libv12n.so.1 file path=usr/lib/libvolmgt.so.1 file path=usr/lib/libwrap.so.1.0 @@ -1209,7 +1208,6 @@ link path=usr/lib/libsmbios.so target=libsmbios.so.1 link path=usr/lib/libsocket.so target=../../lib/libsocket.so.1 link path=usr/lib/libsocket.so.1 target=../../lib/libsocket.so.1 link path=usr/lib/libsoftcrypto.so target=./libsoftcrypto.so.1 -link path=usr/lib/libsys.so target=./libsys.so.1 link path=usr/lib/libsysevent.so target=../../lib/libsysevent.so.1 link path=usr/lib/libsysevent.so.1 target=../../lib/libsysevent.so.1 link path=usr/lib/libtermcap.so target=../../lib/libtermcap.so.1 diff --git a/usr/src/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index 662050d421..51a81cbc04 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -1893,6 +1893,12 @@ file \ file \ path=opt/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_exported \ mode=0555 +file \ + path=opt/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_removed \ + mode=0555 +file \ + path=opt/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid \ + mode=0555 file path=opt/zfs-tests/tests/functional/cli_root/zpool_offline/cleanup \ mode=0555 file path=opt/zfs-tests/tests/functional/cli_root/zpool_offline/setup \ diff --git a/usr/src/test/zfs-tests/runfiles/omnios.run b/usr/src/test/zfs-tests/runfiles/omnios.run index 2ac29f68d9..36d7298d11 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -340,7 +340,8 @@ tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_encrypted', 'zpool_import_encrypted_load'] [/opt/zfs-tests/tests/functional/cli_root/zpool_labelclear] -tests = ['zpool_labelclear_active', 'zpool_labelclear_exported'] +tests = ['zpool_labelclear_active', 'zpool_labelclear_exported', + 'zpool_labelclear_removed', 'zpool_labelclear_valid'] pre = post = diff --git a/usr/src/test/zfs-tests/runfiles/openindiana.run b/usr/src/test/zfs-tests/runfiles/openindiana.run index 96a7c0f509..0796f96204 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -340,7 +340,8 @@ tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_encrypted', 'zpool_import_encrypted_load'] [/opt/zfs-tests/tests/functional/cli_root/zpool_labelclear] -tests = ['zpool_labelclear_active', 'zpool_labelclear_exported'] +tests = ['zpool_labelclear_active', 'zpool_labelclear_exported', + 'zpool_labelclear_removed', 'zpool_labelclear_valid'] pre = post = diff --git a/usr/src/test/zfs-tests/runfiles/smartos.run b/usr/src/test/zfs-tests/runfiles/smartos.run index 26fc1273e3..86eacd2eb8 100644 --- a/usr/src/test/zfs-tests/runfiles/smartos.run +++ b/usr/src/test/zfs-tests/runfiles/smartos.run @@ -291,7 +291,8 @@ tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_encrypted', 'zpool_import_encrypted_load'] [/opt/zfs-tests/tests/functional/cli_root/zpool_labelclear] -tests = ['zpool_labelclear_active', 'zpool_labelclear_exported'] +tests = ['zpool_labelclear_active', 'zpool_labelclear_exported', + 'zpool_labelclear_removed', 'zpool_labelclear_valid'] pre = post = diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh index 58ab57db05..fd33fb9506 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_attach/attach-o_ashift.ksh @@ -51,8 +51,8 @@ log_onexit cleanup disk1=$TEST_BASE_DIR/$FILEDISK0 disk2=$TEST_BASE_DIR/$FILEDISK1 -log_must mkfile $SIZE $disk1 -log_must mkfile $SIZE $disk2 +log_must truncate -s $SIZE $disk1 +log_must truncate -s $SIZE $disk2 typeset ashifts=("9" "10" "11" "12" "13" "14" "15" "16") for ashift in ${ashifts[@]} @@ -84,13 +84,7 @@ do # clean things for the next run log_must zpool destroy $TESTPOOL1 log_must zpool labelclear $disk1 - # depending on if we expect to have failed the 'zpool attach' - if [[ $cmdval -le $ashift ]] - then - log_must zpool labelclear $disk2 - else - log_mustnot zpool labelclear $disk2 - fi + log_must zpool labelclear $disk2 done done diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/labelclear.cfg b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/labelclear.cfg index 6ae5395635..4d7edbb005 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/labelclear.cfg +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/labelclear.cfg @@ -17,9 +17,6 @@ . $STF_SUITE/include/libtest.shlib -typeset LABELCLEAR="zpool labelclear" -typeset LABELREAD="zdb -lq" - typeset disks=(${DISKS[*]}) typeset disk1=${disks[0]} typeset disk2=${disks[1]} diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_active.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_active.ksh index a29c09095f..977a1806eb 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_active.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_active.ksh @@ -43,26 +43,26 @@ log_assert "zpool labelclear will fail on all vdevs of imported pool" log_must zpool create -O mountpoint=none -f $TESTPOOL $disk1 log $disk2 # Check that labelclear [-f] will fail on ACTIVE pool vdevs -log_mustnot $LABELCLEAR $disk1 -log_must $LABELREAD $disk1 -log_mustnot $LABELCLEAR -f $disk1 -log_must $LABELREAD $disk1 -log_mustnot $LABELCLEAR $disk2 -log_must $LABELREAD $disk2 -log_mustnot $LABELCLEAR -f $disk2 -log_must $LABELREAD $disk2 +log_mustnot zpool labelclear $disk1 +log_must zdb -lq $disk1 +log_mustnot zpool labelclear -f $disk1 +log_must zdb -lq $disk1 +log_mustnot zpool labelclear $disk2 +log_must zdb -lq $disk2 +log_mustnot zpool labelclear -f $disk2 +log_must zdb -lq $disk2 # Add a cache/spare to the pool, check that labelclear [-f] will fail # on the vdev and will succeed once it's removed from pool config for vdevtype in "cache" "spare"; do log_must zpool add $TESTPOOL $vdevtype $disk3 - log_mustnot $LABELCLEAR $disk3 - log_must $LABELREAD $disk3 - log_mustnot $LABELCLEAR -f $disk3 - log_must $LABELREAD $disk3 + log_mustnot zpool labelclear $disk3 + log_must zdb -lq $disk3 + log_mustnot zpool labelclear -f $disk3 + log_must zdb -lq $disk3 log_must zpool remove $TESTPOOL $disk3 - log_must $LABELCLEAR $disk3 - log_mustnot $LABELREAD $disk3 + log_must zpool labelclear $disk3 + log_mustnot zdb -lq $disk3 done log_pass "zpool labelclear will fail on all vdevs of imported pool" diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_exported.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_exported.ksh index 82df8216eb..0a9016c471 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_exported.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_exported.ksh @@ -52,21 +52,21 @@ for vdevtype in "" "cache" "spare"; do log_must zpool export $TESTPOOL # Check that labelclear will fail without -f - log_mustnot $LABELCLEAR $disk1 - log_must $LABELREAD $disk1 - log_mustnot $LABELCLEAR $disk2 - log_must $LABELREAD $disk2 + log_mustnot zpool labelclear $disk1 + log_must zdb -lq $disk1 + log_mustnot zpool labelclear $disk2 + log_must zdb -lq $disk2 # Check that labelclear will succeed with -f - log_must $LABELCLEAR -f $disk1 - log_mustnot $LABELREAD $disk1 - log_must $LABELCLEAR -f $disk2 - log_mustnot $LABELREAD $disk2 + log_must zpool labelclear -f $disk1 + log_mustnot zdb -lq $disk1 + log_must zpool labelclear -f $disk2 + log_mustnot zdb -lq $disk2 # Check that labelclear on auxilary vdevs will succeed if [[ -n $vdevtype ]]; then - log_must $LABELCLEAR $disk3 - log_mustnot $LABELREAD $disk3 + log_must zpool labelclear $disk3 + log_mustnot zdb -lq $disk3 fi done diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_removed.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_removed.ksh new file mode 100755 index 0000000000..f93de6e224 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_removed.ksh @@ -0,0 +1,62 @@ +#!/bin/ksh -p +# +# 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 2016 Nexenta Systems, Inc. +# Copyright (c) 2019 by Lawrence Livermore National Security, LLC. +# + +. $STF_SUITE/tests/functional/cli_root/zpool_labelclear/labelclear.cfg + +# DESCRIPTION: +# Check that `zpool labelclear` can clear labels on removed devices. +# +# STRATEGY: +# 1. Create a pool with primary, log, spare and cache devices. +# 2. Remove a top-level vdev, log, spare, and cache device. +# 3. Run `zpool labelclear` on the removed device. +# 4. Verify the label has been removed. +# + +verify_runnable "global" + +function cleanup +{ + poolexists $TESTPOOL && destroy_pool $TESTPOOL + rm -f $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4 $DEVICE5 +} + +log_onexit cleanup +log_assert "zpool labelclear works for removed devices" + +DEVICE1="$TEST_BASE_DIR/device-1" +DEVICE2="$TEST_BASE_DIR/device-2" +DEVICE3="$TEST_BASE_DIR/device-3" +DEVICE4="$TEST_BASE_DIR/device-4" +DEVICE5="$TEST_BASE_DIR/device-5" + +log_must truncate -s $((SPA_MINDEVSIZE * 8)) $DEVICE1 +log_must truncate -s $SPA_MINDEVSIZE $DEVICE2 $DEVICE3 $DEVICE4 $DEVICE5 + +log_must zpool create -f $TESTPOOL $DEVICE1 $DEVICE2 \ + log $DEVICE3 cache $DEVICE4 spare $DEVICE5 +log_must zpool sync + +# Remove each type of vdev and verify the label can be cleared. +for dev in $DEVICE5 $DEVICE4 $DEVICE3 $DEVICE2; do + log_must zpool remove $TESTPOOL $dev + log_must zpool sync $TESTPOOL + log_must zpool labelclear $dev + log_mustnot zdb -lq $dev +done + +log_pass "zpool labelclear works for removed devices" diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh new file mode 100755 index 0000000000..9c0c4d07c8 --- /dev/null +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh @@ -0,0 +1,92 @@ +#!/bin/ksh -p +# +# 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 2016 Nexenta Systems, Inc. +# Copyright (c) 2019 by Lawrence Livermore National Security, LLC. +# Copyright 2020 Joyent, Inc. +# + +. $STF_SUITE/tests/functional/cli_root/zpool_labelclear/labelclear.cfg + +# DESCRIPTION: +# Check that `zpool labelclear` only clears valid labels. Expected +# label offsets which do not contain intact labels are left untouched. +# +# STRATEGY: +# 1. Create a pool with primary, log, spare and cache devices. +# 2. Export the pool. +# 3. Write a known pattern over the first two device labels. +# 4. Verify with zdb that only the last two device labels are intact. +# 5. Verify the pool could be imported using those labels. +# 6. Run `zpool labelclear` to destroy those last two labels. +# 7. Verify the pool can no longer be found; let alone imported. +# 8. Verify the pattern is intact to confirm `zpool labelclear` did +# not write to first two label offsets. +# 9. Verify that no valid label remain. +# + +verify_runnable "global" + +function cleanup +{ + poolexists $TESTPOOL && destroy_pool $TESTPOOL + rm -f $PATTERN_FILE $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4 +} + +log_onexit cleanup +log_assert "zpool labelclear will only clear valid labels" + +PATTERN_FILE=$TEST_BASE_DIR/pattern + +DEVICE1="$TEST_BASE_DIR/device-1" +DEVICE2="$TEST_BASE_DIR/device-2" +DEVICE3="$TEST_BASE_DIR/device-3" +DEVICE4="$TEST_BASE_DIR/device-4" + +log_must dd if=/dev/urandom of=$PATTERN_FILE bs=1048576 count=4 + +log_must truncate -s $SPA_MINDEVSIZE $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4 + +log_must zpool create -O mountpoint=none -f $TESTPOOL $DEVICE1 \ + log $DEVICE2 cache $DEVICE3 spare $DEVICE4 +log_must zpool export $TESTPOOL + +# Overwrite the first 4M of each device and verify the expected labels. +for dev in $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4; do + dd if=$PATTERN_FILE of=$dev bs=1048576 conv=notrunc + log_must eval "zdb -l $dev | grep 'labels = 2 3'" +done + +# Verify the pool could be imported using those labels. +log_must eval "zpool import -d $TEST_BASE_DIR | grep $TESTPOOL" + +# Verify the last two labels on each vdev can be cleared. +for dev in $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4; do + log_must zpool labelclear -f $dev +done + +# Verify there is no longer a pool which can be imported. +log_mustnot eval "zpool import -d $TEST_BASE_DIR | grep $TESTPOOL" + +# Verify the original pattern over the first two labels is intact +for dev in $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4; do + log_must dd if=$dev bs=1048576 count=4 | cmp -- - $PATTERN_FILE + log_mustnot zdb -lq $dev +done + +# Verify an error is reported when there are no labels to clear. +for dev in $DEVICE1 $DEVICE2 $DEVICE3 $DEVICE4; do + log_mustnot zpool labelclear -f $dev +done + +log_pass "zpool labelclear will only clear valid labels" diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh index 77f85c6bea..ae415487c7 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace-o_ashift.ksh @@ -51,8 +51,8 @@ log_onexit cleanup disk1=$TEST_BASE_DIR/$FILEDISK0 disk2=$TEST_BASE_DIR/$FILEDISK1 -log_must mkfile $SIZE $disk1 -log_must mkfile $SIZE $disk2 +log_must truncate -s $SIZE $disk1 +log_must truncate -s $SIZE $disk2 typeset ashifts=("9" "10" "11" "12" "13" "14" "15" "16") for ashift in ${ashifts[@]} @@ -84,15 +84,8 @@ do fi # clean things for the next run log_must zpool destroy $TESTPOOL1 - # depending on if we expect to have failed the 'zpool replace' - if [[ $cmdval -le $ashift ]] - then - log_mustnot zpool labelclear $disk1 - log_must zpool labelclear $disk2 - else - log_must zpool labelclear $disk1 - log_mustnot zpool labelclear $disk2 - fi + log_must zpool labelclear $disk1 + log_must zpool labelclear $disk2 done done diff --git a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh index 714f1180f5..e740de133a 100644 --- a/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh +++ b/usr/src/test/zfs-tests/tests/functional/cli_root/zpool_replace/replace_prop_ashift.ksh @@ -52,8 +52,8 @@ log_onexit cleanup disk1=$TEST_BASE_DIR/$FILEDISK0 disk2=$TEST_BASE_DIR/$FILEDISK1 -log_must mkfile $SIZE $disk1 -log_must mkfile $SIZE $disk2 +log_must truncate -s $SIZE $disk1 +log_must truncate -s $SIZE $disk2 typeset ashifts=("9" "10" "11" "12" "13" "14" "15" "16") for ashift in ${ashifts[@]} @@ -89,7 +89,7 @@ do fi # clean things for the next run log_must zpool destroy $TESTPOOL1 - log_mustnot zpool labelclear $disk1 + log_must zpool labelclear $disk1 log_must zpool labelclear $disk2 done done diff --git a/usr/src/uts/common/brand/lx/os/lx_brand.c b/usr/src/uts/common/brand/lx/os/lx_brand.c index c7e5351778..31bb86cce1 100644 --- a/usr/src/uts/common/brand/lx/os/lx_brand.c +++ b/usr/src/uts/common/brand/lx/os/lx_brand.c @@ -26,6 +26,7 @@ /* * Copyright 2020 Joyent, Inc. + * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. */ /* @@ -1876,23 +1877,35 @@ lx_brandsys(int cmd, int64_t *rval, uintptr_t arg1, uintptr_t arg2, (void) lx_start_nfs_lockd(); return (0); - case B_BLOCK_ALL_SIGS: + case B_BLOCK_ALL_SIGS: { + uint_t result = 0; + mutex_enter(&p->p_lock); pd = ptolxproc(p); - pd->l_block_all_signals++; + /* + * This is used to block handling of all signals during vfork() + * or clone(LX_CLONE_VFORK) emulation to match Linux semantics + * and prevent the parent's signal handlers being called before + * they are properly reset. + */ + if (pd->l_block_all_signals != 0) { + result = set_errno(EAGAIN); + } else { + pd->l_block_all_signals = 1; + } mutex_exit(&p->p_lock); - return (0); + return (result); + } case B_UNBLOCK_ALL_SIGS: { - uint_t result; + uint_t result = 0; mutex_enter(&p->p_lock); pd = ptolxproc(p); if (pd->l_block_all_signals == 0) { result = set_errno(EINVAL); } else { - pd->l_block_all_signals--; - result = 0; + pd->l_block_all_signals = 0; } mutex_exit(&p->p_lock); return (result); diff --git a/usr/src/uts/i86pc/io/vmm/vm/vm_glue.h b/usr/src/uts/i86pc/io/vmm/vm/vm_glue.h index f894fcaf68..436b8e9691 100644 --- a/usr/src/uts/i86pc/io/vmm/vm/vm_glue.h +++ b/usr/src/uts/i86pc/io/vmm/vm/vm_glue.h @@ -12,6 +12,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #ifndef _VM_GLUE_ @@ -76,8 +77,8 @@ struct vm_page { }; /* Illumos-specific functions for setup and operation */ -int vm_segmap_obj(struct vmspace *, vm_object_t, struct as *, caddr_t *, - uint_t, uint_t, uint_t); +int vm_segmap_obj(vm_object_t, off_t, size_t, struct as *, caddr_t *, uint_t, + uint_t, uint_t); int vm_segmap_space(struct vmspace *, off_t, struct as *, caddr_t *, off_t, uint_t, uint_t, uint_t); void *vmspace_find_kva(struct vmspace *, uintptr_t, size_t); diff --git a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c index 95a146661c..2f84ac5e95 100644 --- a/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c +++ b/usr/src/uts/i86pc/io/vmm/vmm_sol_dev.c @@ -14,6 +14,7 @@ * Copyright 2015 Pluribus Networks Inc. * Copyright 2019 Joyent, Inc. * Copyright 2020 OmniOS Community Edition (OmniOSce) Association. + * Copyright 2020 Oxide Computer Company */ #include <sys/types.h> @@ -184,25 +185,30 @@ vmmdev_devmem_create(vmm_softc_t *sc, struct vm_memseg *mseg, const char *name) } static boolean_t -vmmdev_devmem_segid(vmm_softc_t *sc, off_t off, off_t len, int *segidp) +vmmdev_devmem_segid(vmm_softc_t *sc, off_t off, off_t len, int *segidp, + off_t *map_offp) { list_t *dl = &sc->vmm_devmem_list; vmm_devmem_entry_t *de = NULL; + const off_t map_end = off + len; VERIFY(off >= VM_DEVMEM_START); - for (de = list_head(dl); de != NULL; de = list_next(dl, de)) { - /* XXX: Only hit on direct offset/length matches for now */ - if (de->vde_off == off && de->vde_len == len) { - break; - } - } - if (de == NULL) { + if (map_end < off) { + /* No match on overflow */ return (B_FALSE); } - *segidp = de->vde_segid; - return (B_TRUE); + for (de = list_head(dl); de != NULL; de = list_next(dl, de)) { + const off_t item_end = de->vde_off + de->vde_len; + + if (de->vde_off <= off && item_end >= map_end) { + *segidp = de->vde_segid; + *map_offp = off - de->vde_off; + return (B_TRUE); + } + } + return (B_FALSE); } static void @@ -2076,9 +2082,10 @@ vmm_segmap(dev_t dev, off_t off, struct as *as, caddr_t *addrp, off_t len, vms = vm_get_vmspace(vm); if (off >= VM_DEVMEM_START) { int segid; + off_t map_off = 0; /* Mapping a devmem "device" */ - if (!vmmdev_devmem_segid(sc, off, len, &segid)) { + if (!vmmdev_devmem_segid(sc, off, len, &segid, &map_off)) { err = ENODEV; goto out; } @@ -2086,7 +2093,8 @@ vmm_segmap(dev_t dev, off_t off, struct as *as, caddr_t *addrp, off_t len, if (err != 0) { goto out; } - err = vm_segmap_obj(vms, vmo, as, addrp, prot, maxprot, flags); + err = vm_segmap_obj(vmo, map_off, len, as, addrp, prot, maxprot, + flags); } else { /* Mapping a part of the guest physical space */ err = vm_segmap_space(vms, off, as, addrp, len, prot, maxprot, diff --git a/usr/src/uts/i86pc/io/vmm/vmm_sol_vm.c b/usr/src/uts/i86pc/io/vmm/vmm_sol_vm.c index 9bd55c41f2..bedc338474 100644 --- a/usr/src/uts/i86pc/io/vmm/vmm_sol_vm.c +++ b/usr/src/uts/i86pc/io/vmm/vmm_sol_vm.c @@ -12,6 +12,7 @@ /* * Copyright 2019 Joyent, Inc. + * Copyright 2020 Oxide Computer Company */ #include <sys/param.h> @@ -894,12 +895,15 @@ vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags) /* Provided custom for bhyve 'devmem' segment mapping */ int -vm_segmap_obj(struct vmspace *vms, vm_object_t vmo, struct as *as, +vm_segmap_obj(vm_object_t vmo, off_t map_off, size_t size, struct as *as, caddr_t *addrp, uint_t prot, uint_t maxprot, uint_t flags) { - const size_t size = vmo->vmo_size; int err; + VERIFY(map_off >= 0); + VERIFY(size <= vmo->vmo_size); + VERIFY((size + map_off) <= vmo->vmo_size); + if (vmo->vmo_type != OBJT_DEFAULT) { /* Only support default objects for now */ return (ENOTSUP); @@ -911,7 +915,7 @@ vm_segmap_obj(struct vmspace *vms, vm_object_t vmo, struct as *as, if (err == 0) { segvmm_crargs_t svma; - svma.kaddr = vmo->vmo_data; + svma.kaddr = (caddr_t)vmo->vmo_data + map_off; svma.prot = prot; svma.cookie = vmo; svma.hold = (segvmm_holdfn_t)vm_object_reference; |