From c3d209cab1511045e9bb1a521f1bd85995d4fd7e Mon Sep 17 00:00:00 2001 From: Patrick Mooney Date: Mon, 3 Aug 2020 23:23:51 +0000 Subject: 13008 bhyve devmem could match better 13009 mdb-bhyve mishandles memseg offsets 13010 bhyve should not exit when VM debugged Reviewed by: Andy Fiddaman Reviewed by: Hans Rosenfeld Approved by: Robert Mustacchi --- usr/src/lib/libvmm/libvmm.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'usr/src/lib') 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; -- cgit v1.2.3 From 0904e7ecf266ebe6844dfc4b178441dc8d81296b Mon Sep 17 00:00:00 2001 From: Richard Lowe Date: Wed, 8 Jul 2020 01:25:37 -0400 Subject: 12944 remove long obsolete libsys Reviewed by: Robert Mustacchi Reviewed by: Toomas Soome Approved by: Dan McDonald --- exception_lists/interface_check | 5 - usr/src/cmd/sgs/rtld/common/elf.c | 31 +- usr/src/cmd/sgs/rtld/common/rtld.msg | 1 - usr/src/lib/Makefile | 1 - usr/src/lib/libsys/Makefile | 43 --- usr/src/lib/libsys/Makefile.com | 36 -- usr/src/lib/libsys/Makefile.targ | 39 -- usr/src/lib/libsys/common/libsys.sh | 53 --- usr/src/lib/libsys/common/mapfile-vers | 451 ----------------------- usr/src/lib/libsys/i386/Makefile | 37 -- usr/src/lib/libsys/i386/libsys.list | 192 ---------- usr/src/lib/libsys/sparc/Makefile | 38 -- usr/src/lib/libsys/sparc/libsys.list | 207 ----------- usr/src/lib/libsys/sparc/libsys.sh | 39 -- usr/src/lib/libsys/sparc/libsyss.list | 10 - usr/src/man/man3lib/Makefile | 1 - usr/src/man/man3lib/libsys.3lib | 214 ----------- usr/src/pkg/manifests/system-library.man3lib.inc | 1 - usr/src/pkg/manifests/system-library.mf | 2 - 19 files changed, 2 insertions(+), 1399 deletions(-) delete mode 100644 usr/src/lib/libsys/Makefile delete mode 100644 usr/src/lib/libsys/Makefile.com delete mode 100644 usr/src/lib/libsys/Makefile.targ delete mode 100644 usr/src/lib/libsys/common/libsys.sh delete mode 100644 usr/src/lib/libsys/common/mapfile-vers delete mode 100644 usr/src/lib/libsys/i386/Makefile delete mode 100644 usr/src/lib/libsys/i386/libsys.list delete mode 100644 usr/src/lib/libsys/sparc/Makefile delete mode 100644 usr/src/lib/libsys/sparc/libsys.list delete mode 100644 usr/src/lib/libsys/sparc/libsys.sh delete mode 100644 usr/src/lib/libsys/sparc/libsyss.list delete mode 100644 usr/src/man/man3lib/libsys.3lib (limited to 'usr/src/lib') 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$ 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 f629e7b64b..94c5c5bf51 100644 --- a/usr/src/cmd/sgs/rtld/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg @@ -346,7 +346,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 7b87fe98e9..08fabd7093 100644 --- a/usr/src/lib/Makefile +++ b/usr/src/lib/Makefile @@ -221,7 +221,6 @@ SUBDIRS += \ libstmfproxy \ libsum \ libsun_ima \ - libsys \ libsysevent \ libtecla \ libtermcap \ 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/man/man3lib/Makefile b/usr/src/man/man3lib/Makefile index 68478b2e04..e1ff6e7c7e 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 -- cgit v1.2.3 From 0ac8993002ee179cc3289243a0fc956ee0db04da Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 30 Jul 2020 01:12:12 -0500 Subject: 13013 Port OpenZFS zpool label clear improvements 13012 zpool_read_label semantics should match OpenZFS Portions contributed by: Jason King Reviewed by: Matt Ahrens Reviewed by: Tim Chase Reviewed by: Tony Hutter Reviewed by: Andy Fiddaman Reviewed by: Toomas Soome Approved by: Dan McDonald --- usr/src/cmd/fs.d/zfs/fstyp/fstyp.c | 11 ++- usr/src/lib/libzfs/common/libzfs_import.c | 49 +++++++++++- usr/src/lib/libzutil/common/zutil_import.c | 11 ++- usr/src/pkg/manifests/system-test-zfstest.mf | 6 ++ usr/src/test/zfs-tests/runfiles/omnios.run | 3 +- usr/src/test/zfs-tests/runfiles/openindiana.run | 3 +- usr/src/test/zfs-tests/runfiles/smartos.run | 3 +- .../cli_root/zpool_attach/attach-o_ashift.ksh | 12 +-- .../cli_root/zpool_labelclear/labelclear.cfg | 3 - .../zpool_labelclear/zpool_labelclear_active.ksh | 28 +++---- .../zpool_labelclear/zpool_labelclear_exported.ksh | 20 ++--- .../zpool_labelclear/zpool_labelclear_removed.ksh | 62 +++++++++++++++ .../zpool_labelclear/zpool_labelclear_valid.ksh | 92 ++++++++++++++++++++++ .../cli_root/zpool_replace/replace-o_ashift.ksh | 15 +--- .../cli_root/zpool_replace/replace_prop_ashift.ksh | 6 +- 15 files changed, 260 insertions(+), 64 deletions(-) create mode 100755 usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_removed.ksh create mode 100755 usr/src/test/zfs-tests/tests/functional/cli_root/zpool_labelclear/zpool_labelclear_valid.ksh (limited to 'usr/src/lib') 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 #include #include +#include #include #include #include @@ -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/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/pkg/manifests/system-test-zfstest.mf b/usr/src/pkg/manifests/system-test-zfstest.mf index eca36deda1..8174cd0af3 100644 --- a/usr/src/pkg/manifests/system-test-zfstest.mf +++ b/usr/src/pkg/manifests/system-test-zfstest.mf @@ -1884,6 +1884,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 5693772b65..4c52926b16 100644 --- a/usr/src/test/zfs-tests/runfiles/omnios.run +++ b/usr/src/test/zfs-tests/runfiles/omnios.run @@ -339,7 +339,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 b004b2e96a..27697582ef 100644 --- a/usr/src/test/zfs-tests/runfiles/openindiana.run +++ b/usr/src/test/zfs-tests/runfiles/openindiana.run @@ -339,7 +339,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 e8f2a35b12..30e8efc0d3 100644 --- a/usr/src/test/zfs-tests/runfiles/smartos.run +++ b/usr/src/test/zfs-tests/runfiles/smartos.run @@ -289,7 +289,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 -- cgit v1.2.3 From 1fc24ed72de4ac8eab15db9b0af90b3e9654262b Mon Sep 17 00:00:00 2001 From: Andy Fiddaman Date: Wed, 12 Aug 2020 03:33:17 +0100 Subject: OS-8200 LX: serialise parallel vfork()/clone(LX_CLONE_VFORK) invocations (#321) Reviewed by: Jerry Jelinek Reviewed by: Mike Zeller Approved by: Jason King --- usr/src/lib/brand/lx/lx_brand/common/signal.c | 14 +++++++++++++- usr/src/uts/common/brand/lx/os/lx_brand.c | 25 +++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) (limited to 'usr/src/lib') 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 @@ -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/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); -- cgit v1.2.3