summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Zeller <mike@mikezeller.net>2020-03-24 14:13:05 -0400
committerMike Zeller <mike@mikezeller.net>2020-03-24 14:13:05 -0400
commit68523a5e89dad2d9596d59b5f5bdc02f624b90cb (patch)
tree6cde4b61225154f034ab77d9ab0a03b1737104ea
parent243ff5fd79328d2bed0de7bbf0e538681ce8d638 (diff)
parent6fc9a8917bb40c1476c23626baae1fc359df05c1 (diff)
downloadillumos-joyent-OS-8143.tar.gz
Merge remote-tracking branch 'origin/master' into OS-8143OS-8143
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_futex.c13
-rw-r--r--usr/src/uts/common/io/fd.c1
-rw-r--r--usr/src/uts/common/krtld/kobj.c30
-rw-r--r--usr/src/uts/common/krtld/reloc.h4
-rw-r--r--usr/src/uts/common/sys/kobj_impl.h7
-rw-r--r--usr/src/uts/common/xen/dtrace/xdt.c5
-rw-r--r--usr/src/uts/common/xen/io/xnb.c1
-rw-r--r--usr/src/uts/i86pc/os/cpupm/cpupm_mach.c3
-rw-r--r--usr/src/uts/i86pc/os/fakebop.c1
-rw-r--r--usr/src/uts/i86pc/vm/htable.c2
-rw-r--r--usr/src/uts/i86pc/vm/vm_machdep.c1
-rw-r--r--usr/src/uts/i86xpv/cpu/generic_cpu/gcpu_mca_xpv.c1
-rw-r--r--usr/src/uts/i86xpv/io/privcmd_hcall.c1
-rw-r--r--usr/src/uts/i86xpv/io/psm/xpv_psm.c1
-rw-r--r--usr/src/uts/i86xpv/os/mp_xen.c1
-rw-r--r--usr/src/uts/i86xpv/os/xpv_panic.c1
-rw-r--r--usr/src/uts/intel/amd64/krtld/kobj_reloc.c12
17 files changed, 56 insertions, 29 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_futex.c b/usr/src/uts/common/brand/lx/syscall/lx_futex.c
index 3642b006c0..2a804dbcfe 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_futex.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_futex.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
#include <sys/types.h>
@@ -408,6 +408,17 @@ futex_wait(memid_t *memid, caddr_t addr,
goto out;
}
+ /*
+ * We can't have hrtime and a timeout of 0. See below about
+ * CLOCK_REALTIME.
+ * On Linux this is is an invalid state anyway, so we'll short cut
+ * this early to avoid a panic from passing a null pointer to ts2hrt().
+ */
+ if (hrtime && timeout == NULL) {
+ err = set_errno(EINVAL);
+ goto out;
+ }
+
futex_hashin(fwp);
err = 0;
diff --git a/usr/src/uts/common/io/fd.c b/usr/src/uts/common/io/fd.c
index 5ad6022610..aae0cd09c2 100644
--- a/usr/src/uts/common/io/fd.c
+++ b/usr/src/uts/common/io/fd.c
@@ -810,6 +810,7 @@ fdgetlabel(struct fcu_obj *fjp, int unit)
nexttype = fdp->d_deffdtype;
try_this = 1; /* always try the current characteristics */
+ rval = ENXIO;
for (tries = nfdtypes; tries; tries--) {
if (try_this) {
fjp->fj_flags &= ~FUNIT_CHAROK;
diff --git a/usr/src/uts/common/krtld/kobj.c b/usr/src/uts/common/krtld/kobj.c
index 711fe6db82..e6a91bcb33 100644
--- a/usr/src/uts/common/krtld/kobj.c
+++ b/usr/src/uts/common/krtld/kobj.c
@@ -305,8 +305,8 @@ int use_iflush; /* iflush after relocations */
* through this function pointer cannot handle more that one conversion
* specification in the format string.
*/
-void (*_kobj_printf)(void *, const char *, ...); /* printf routine */
-void (*_vkobj_printf)(void *, const char *, va_list); /* vprintf routine */
+void (*_kobj_printf)(void *, const char *, ...) __KPRINTFLIKE(2);
+void (*_vkobj_printf)(void *, const char *, va_list) __KVPRINTFLIKE(2);
/*
* Standalone function pointers for use within krtld.
@@ -511,7 +511,7 @@ kobj_init(
#ifdef KOBJ_DEBUG
if (kobj_debug & D_DEBUG)
_kobj_printf(ops,
- "krtld: transferring control to: 0x%p\n", entry);
+ "krtld: transferring control to: 0x%lx\n", entry);
#endif
/*
@@ -532,7 +532,7 @@ kobj_init(
#ifdef KOBJ_DEBUG
if (kobj_debug & D_DEBUG)
_kobj_printf(ops,
- "krtld: really transferring control to: 0x%p\n", entry);
+ "krtld: really transferring control to: 0x%lx\n", entry);
#endif
/* restore printf/bcopy/bzero vectors before returning */
@@ -857,9 +857,9 @@ load_exec(val_t *bootaux, char *filename)
if (kobj_debug & D_LOADING) {
_kobj_printf(ops, "krtld: file=%s\n", mp->filename);
_kobj_printf(ops, "\ttext: 0x%p", mp->text);
- _kobj_printf(ops, " size: 0x%x\n", mp->text_size);
+ _kobj_printf(ops, " size: 0x%lx\n", mp->text_size);
_kobj_printf(ops, "\tdata: 0x%p", mp->data);
- _kobj_printf(ops, " dsize: 0x%x\n", mp->data_size);
+ _kobj_printf(ops, " dsize: 0x%lx\n", mp->data_size);
}
#endif /* KOBJ_DEBUG */
@@ -968,9 +968,9 @@ load_linker(val_t *bootaux)
if (kobj_debug & D_LOADING) {
_kobj_printf(ops, "krtld: file=%s\n", mp->filename);
_kobj_printf(ops, "\ttext:0x%p", mp->text);
- _kobj_printf(ops, " size: 0x%x\n", mp->text_size);
+ _kobj_printf(ops, " size: 0x%lx\n", mp->text_size);
_kobj_printf(ops, "\tdata:0x%p", mp->data);
- _kobj_printf(ops, " dsize: 0x%x\n", mp->data_size);
+ _kobj_printf(ops, " dsize: 0x%lx\n", mp->data_size);
}
#endif /* KOBJ_DEBUG */
@@ -2010,9 +2010,9 @@ kobj_load_module(struct modctl *modp, int use_path)
if (kobj_debug & D_LOADING) {
_kobj_printf(ops, "krtld: file=%s\n", mp->filename);
_kobj_printf(ops, "\ttext:0x%p", mp->text);
- _kobj_printf(ops, " size: 0x%x\n", mp->text_size);
+ _kobj_printf(ops, " size: 0x%lx\n", mp->text_size);
_kobj_printf(ops, "\tdata:0x%p", mp->data);
- _kobj_printf(ops, " dsize: 0x%x\n", mp->data_size);
+ _kobj_printf(ops, " dsize: 0x%lx\n", mp->data_size);
}
#endif /* KOBJ_DEBUG */
@@ -2724,8 +2724,8 @@ crypto_es_hash(struct module *mp, char *hash, char *shstrtab)
if (kobj_debug & D_DEBUG)
_kobj_printf(ops,
"krtld: crypto_es_hash: updating hash with"
- " %s data size=%d\n", shstrtab + shp->sh_name,
- shp->sh_size);
+ " %s data size=%lx\n", shstrtab + shp->sh_name,
+ (size_t)shp->sh_size);
#endif
ASSERT(shp->sh_addr != 0);
SHA1Update(&ctx, (const uint8_t *)shp->sh_addr, shp->sh_size);
@@ -2878,7 +2878,7 @@ do_dependents(struct modctl *modp, char *modname, size_t modnamelen)
_kobj_printf(ops, "%s: dependency ", modp->mod_modname);
_kobj_printf(ops, "'%s' too long ", dep);
- _kobj_printf(ops, "(max %d chars)\n", modnamelen);
+ _kobj_printf(ops, "(max %d chars)\n", (int)modnamelen);
kobj_free(dep, p - d + 1);
@@ -3840,7 +3840,7 @@ kobj_read_file(struct _buf *file, char *buf, uint_t size, uint_t off)
if (_moddebug & MODDEBUG_ERRMSG) {
_kobj_printf(ops, "kobj_read_file: size=%x,", size);
_kobj_printf(ops, " offset=%x at", off);
- _kobj_printf(ops, " buf=%x\n", buf);
+ _kobj_printf(ops, " buf=%lx\n", (uintptr_t)buf);
}
/*
@@ -3883,7 +3883,7 @@ kobj_read_file(struct _buf *file, char *buf, uint_t size, uint_t off)
if (dlen != size) {
_kobj_printf(ops, "kobj_read_file: z_uncompress "
- "failed to uncompress (size returned 0x%x , "
+ "failed to uncompress (size returned 0x%lx , "
"expected size: 0x%x)\n", dlen, size);
return (-1);
}
diff --git a/usr/src/uts/common/krtld/reloc.h b/usr/src/uts/common/krtld/reloc.h
index b7ae5a8997..4f0c576203 100644
--- a/usr/src/uts/common/krtld/reloc.h
+++ b/usr/src/uts/common/krtld/reloc.h
@@ -21,6 +21,8 @@
/*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Copyright 2020 Joyent, Inc.
*/
#ifndef _RELOC_DOT_H
@@ -274,7 +276,7 @@ extern const char *conv_reloc_SPARC_type(Word);
_kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \
_kobj_printf(ops, MSG_REL_FILE, (file)); \
_kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \
- _kobj_printf(ops, MSG_REL_NOFIT, EC_XWORD((uvalue)))
+ _kobj_printf(ops, MSG_REL_NOFIT, (u_longlong_t)EC_XWORD((uvalue)))
#else /* !_KERNEL */
diff --git a/usr/src/uts/common/sys/kobj_impl.h b/usr/src/uts/common/sys/kobj_impl.h
index a8488365b9..752217b5cf 100644
--- a/usr/src/uts/common/sys/kobj_impl.h
+++ b/usr/src/uts/common/sys/kobj_impl.h
@@ -21,6 +21,8 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2020 Joyent, Inc.
*/
/*
@@ -184,8 +186,9 @@ extern void mach_modpath(char *, const char *);
extern void kobj_setup_standalone_vectors(void);
extern void kobj_restore_vectors(void);
-extern void (*_kobj_printf)(void *, const char *fmt, ...);
-extern void (*_vkobj_printf)(void *, const char *fmt, va_list);
+extern void (*_kobj_printf)(void *, const char *fmt, ...) __KPRINTFLIKE(2);
+extern void (*_vkobj_printf)(void *, const char *fmt, va_list)
+ __KVPRINTFLIKE(2);
extern void (*kobj_bcopy)(const void *, void *, size_t);
extern void (*kobj_bzero)(void *, size_t);
extern size_t (*kobj_strlcat)(char *, const char *, size_t);
diff --git a/usr/src/uts/common/xen/dtrace/xdt.c b/usr/src/uts/common/xen/dtrace/xdt.c
index 37cb920932..b26e9128bc 100644
--- a/usr/src/uts/common/xen/dtrace/xdt.c
+++ b/usr/src/uts/common/xen/dtrace/xdt.c
@@ -702,6 +702,7 @@ xdt_process_rec(uint_t cpuid, struct t_rec *rec)
ASSERT(rec != NULL);
ASSERT(xdt_ncpus == xpv_nr_phys_cpus());
+ eid = 0;
if (cpuid >= xdt_ncpus) {
tbuf.stat_spurious_cpu++;
goto done;
@@ -973,7 +974,7 @@ switchdone:
*
* data[0] = eip
* data[1] = trapnr | (error_code_valid << 15)
- * | (error_code << 16);
+ * | (error_code << 16);
*/
XDT_PROBE4(XDT_PV_TRAP, data[0], data[1] & 0x7fff,
(data[1] >> 15) & 1, data[1] >> 16);
@@ -985,7 +986,7 @@ switchdone:
* data[0] = rip(0:31)
* data[1] = rip(32:63)
* data[2] = trapnr | (error_code_valid << 15)
- * | (error_code << 16);
+ * | (error_code << 16);
*/
rip64 = (((uint64_t)data[1]) << 32) | data[2];
XDT_PROBE4(XDT_PV_TRAP, rip64, data[2] & 0x7fff,
diff --git a/usr/src/uts/common/xen/io/xnb.c b/usr/src/uts/common/xen/io/xnb.c
index c21476df89..23e1d971cb 100644
--- a/usr/src/uts/common/xen/io/xnb.c
+++ b/usr/src/uts/common/xen/io/xnb.c
@@ -666,6 +666,7 @@ xnb_to_peer(xnb_t *xnbp, mblk_t *mp)
* to transfer them.
*/
+ len = 0;
mutex_enter(&xnbp->xnb_rx_lock);
/*
diff --git a/usr/src/uts/i86pc/os/cpupm/cpupm_mach.c b/usr/src/uts/i86pc/os/cpupm/cpupm_mach.c
index af14349807..900d4199c1 100644
--- a/usr/src/uts/i86pc/os/cpupm/cpupm_mach.c
+++ b/usr/src/uts/i86pc/os/cpupm/cpupm_mach.c
@@ -695,12 +695,11 @@ cpupm_plat_domain_id(cpu_t *cp, cpupm_dtype_t type)
return (CPUPM_NO_DOMAIN);
}
-/*ARGSUSED*/
uint_t
cpupm_plat_state_enumerate(cpu_t *cp, cpupm_dtype_t type,
cpupm_state_t *states)
{
- int *speeds;
+ int *speeds = NULL;
uint_t nspeeds, i;
/*
diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c
index 166791b2c1..75c4c618a7 100644
--- a/usr/src/uts/i86pc/os/fakebop.c
+++ b/usr/src/uts/i86pc/os/fakebop.c
@@ -1039,6 +1039,7 @@ xen_vbdroot_props(char *s)
short minor;
long addr = 0;
+ mi = '\0';
pnp = vbdpath + strlen(vbdpath);
prop_p = s + strlen(lnamefix);
while ((*prop_p != '\0') && (*prop_p != 's') && (*prop_p != 'p'))
diff --git a/usr/src/uts/i86pc/vm/htable.c b/usr/src/uts/i86pc/vm/htable.c
index 08e2130117..b201d8cfc4 100644
--- a/usr/src/uts/i86pc/vm/htable.c
+++ b/usr/src/uts/i86pc/vm/htable.c
@@ -2455,7 +2455,7 @@ x86pte_zero(htable_t *dest, uint_t entry, uint_t count)
caddr_t dst_va;
size_t size;
#ifdef __xpv
- int x;
+ int x = 0;
x86pte_t newpte;
#endif
diff --git a/usr/src/uts/i86pc/vm/vm_machdep.c b/usr/src/uts/i86pc/vm/vm_machdep.c
index 9cba487a0a..0b1ed510e9 100644
--- a/usr/src/uts/i86pc/vm/vm_machdep.c
+++ b/usr/src/uts/i86pc/vm/vm_machdep.c
@@ -2791,6 +2791,7 @@ page_swap_with_hypervisor(struct vnode *vp, u_offset_t off, caddr_t vaddr,
page_t *pp, *expp, *pp_first, **pplist = NULL;
mfn_t *mfnlist = NULL;
+ extra = 0;
contig = flags & PG_PHYSCONTIG;
if (minctg == 1)
contig = 0;
diff --git a/usr/src/uts/i86xpv/cpu/generic_cpu/gcpu_mca_xpv.c b/usr/src/uts/i86xpv/cpu/generic_cpu/gcpu_mca_xpv.c
index be28a710bf..3fec6adeb1 100644
--- a/usr/src/uts/i86xpv/cpu/generic_cpu/gcpu_mca_xpv.c
+++ b/usr/src/uts/i86xpv/cpu/generic_cpu/gcpu_mca_xpv.c
@@ -82,6 +82,7 @@ gcpu_xpv_proxy_logout(int what, struct mc_info *mi, struct mcinfo_common **micp,
/* Skip over the MC_TYPE_GLOBAL record */
ASSERT(mgi->common.type == MC_TYPE_GLOBAL);
+ mcrp = NULL;
mic = x86_mcinfo_next((struct mcinfo_common *)(uintptr_t)mgi);
idx++;
diff --git a/usr/src/uts/i86xpv/io/privcmd_hcall.c b/usr/src/uts/i86xpv/io/privcmd_hcall.c
index 0c9a6198ab..85ab0ed707 100644
--- a/usr/src/uts/i86xpv/io/privcmd_hcall.c
+++ b/usr/src/uts/i86xpv/io/privcmd_hcall.c
@@ -1067,6 +1067,7 @@ privcmd_HYPERVISOR_mmuext_op(struct mmuext_op *op, int count, uint_t *scount,
struct mmuext_op *kop, single_kop;
import_export_t op_ie, scnt_ie;
+ kop = NULL;
op_ie = scnt_ie = null_ie;
error = 0;
diff --git a/usr/src/uts/i86xpv/io/psm/xpv_psm.c b/usr/src/uts/i86xpv/io/psm/xpv_psm.c
index 94308c3f2f..5e19d7def9 100644
--- a/usr/src/uts/i86xpv/io/psm/xpv_psm.c
+++ b/usr/src/uts/i86xpv/io/psm/xpv_psm.c
@@ -1111,6 +1111,7 @@ xpv_psm_get_msi_vector(dev_info_t *dip, int type, int entry)
uchar_t vector;
ASSERT((handle != NULL) && (cap_ptr != 0));
+ vector = 0;
if (type == DDI_INTR_TYPE_MSI) {
msi_ctrl = pci_config_get16(handle, cap_ptr + PCI_MSI_CTRL);
/*
diff --git a/usr/src/uts/i86xpv/os/mp_xen.c b/usr/src/uts/i86xpv/os/mp_xen.c
index fb41f72b0b..d430ad8735 100644
--- a/usr/src/uts/i86xpv/os/mp_xen.c
+++ b/usr/src/uts/i86xpv/os/mp_xen.c
@@ -846,6 +846,7 @@ vcpu_config_report(processorid_t id, uint_t newstate, int error)
size_t len;
char *ps;
+ ps = NULL;
switch (newstate) {
case P_ONLINE:
ps = PS_ONLINE;
diff --git a/usr/src/uts/i86xpv/os/xpv_panic.c b/usr/src/uts/i86xpv/os/xpv_panic.c
index 594fcd4c31..3778f526ef 100644
--- a/usr/src/uts/i86xpv/os/xpv_panic.c
+++ b/usr/src/uts/i86xpv/os/xpv_panic.c
@@ -195,6 +195,7 @@ xpv_va_walk(uintptr_t *vaddr)
static pfn_t toplevel_pfn;
static uintptr_t lastva;
+ pte = 0;
/*
* If we do anything other than a simple scan through memory, don't
* trust the mapped page tables.
diff --git a/usr/src/uts/intel/amd64/krtld/kobj_reloc.c b/usr/src/uts/intel/amd64/krtld/kobj_reloc.c
index c284865769..eac50929cc 100644
--- a/usr/src/uts/intel/amd64/krtld/kobj_reloc.c
+++ b/usr/src/uts/intel/amd64/krtld/kobj_reloc.c
@@ -22,6 +22,8 @@
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2020 Joyent, Inc.
*/
/*
* Copyright (c) 2017 Joyent, Inc.
@@ -212,7 +214,7 @@ do_relocate(struct module *mp, char *reltbl, int nreloc, int relocsize,
if ((rtype > R_AMD64_NUM) || IS_TLS_INS(rtype)) {
_kobj_printf(ops, "krtld: invalid relocation type %d",
rtype);
- _kobj_printf(ops, " at 0x%llx:", off);
+ _kobj_printf(ops, " at 0x%lx:", off);
_kobj_printf(ops, " file=%s\n", mp->filename);
err = 1;
continue;
@@ -233,8 +235,8 @@ do_relocate(struct module *mp, char *reltbl, int nreloc, int relocsize,
(mp->symtbl+(stndx * mp->symhdr->sh_entsize));
_kobj_printf(ops, "krtld:\t%s",
conv_reloc_amd64_type(rtype));
- _kobj_printf(ops, "\t0x%8llx", off);
- _kobj_printf(ops, " 0x%8llx", addend);
+ _kobj_printf(ops, "\t0x%8lx", off);
+ _kobj_printf(ops, " %8lld", (longlong_t)addend);
_kobj_printf(ops, " %s\n",
(const char *)mp->strings + symp->st_name);
}
@@ -313,8 +315,8 @@ do_relocate(struct module *mp, char *reltbl, int nreloc, int relocsize,
#ifdef KOBJ_DEBUG
if (kobj_debug & D_RELOCATIONS) {
- _kobj_printf(ops, "krtld:\t\t\t\t0x%8llx", off);
- _kobj_printf(ops, " 0x%8llx\n", value);
+ _kobj_printf(ops, "krtld:\t\t\t\t0x%8lx", off);
+ _kobj_printf(ops, " 0x%8lx\n", value);
}
#endif