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 /usr/src/cmd | |
parent | a8ff5009e5f7ea544c79b60ea65577f19304ff0b (diff) | |
parent | 09f210323354e07890b312da9b4f5e33ae6b6df5 (diff) | |
download | illumos-joyent-sasinfo.tar.gz |
Merge branch 'master' into sasinfosasinfo
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/bhyve/bhyverun.c | 12 | ||||
-rw-r--r-- | usr/src/cmd/bhyve/gdb.c | 36 | ||||
-rw-r--r-- | usr/src/cmd/bhyve/gdb.h | 3 | ||||
-rw-r--r-- | usr/src/cmd/fs.d/zfs/fstyp/fstyp.c | 11 | ||||
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/elf.c | 31 | ||||
-rw-r--r-- | usr/src/cmd/sgs/rtld/common/rtld.msg | 1 |
6 files changed, 62 insertions, 32 deletions
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" |