summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2016-08-22 10:42:14 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2016-08-22 10:42:14 +0000
commitd0de416eba4efacef1c1fc99a50645dfe855b4e0 (patch)
tree7a49eae6c66a678973da0f6b6211f07be4215216 /usr/src
parentfa4a6a633d447e433f22c28800fcd967975ef403 (diff)
parent09c0accb630678e1a150310a8852806c5052b2ac (diff)
downloadillumos-joyent-d0de416eba4efacef1c1fc99a50645dfe855b4e0.tar.gz
[illumos-gate merge]
commit 09c0accb630678e1a150310a8852806c5052b2ac 1769 dladm show-link truncates OVER field commit 69f14d1fbc2690fc894c66653f1b371783f23f46 7307 Fixing 5780 introduced a regression commit 03aa4c8d900cbdc3667ab4b43388d480324be58e 7240 adding DHCP address through libipadm fails commit 831abf2c3ce98eddc86402eb1c97c92fa48c7349 7236 libumem should be able to abort() when an allocation fails
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/dladm/dladm.c15
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/umem.c3
-rw-r--r--usr/src/lib/libdhcpagent/common/dhcpagent_ipc.h17
-rw-r--r--usr/src/lib/libumem/common/envvar.c5
-rw-r--r--usr/src/lib/libumem/common/umem.c6
-rw-r--r--usr/src/lib/libumem/common/umem_impl.h3
-rw-r--r--usr/src/uts/common/exec/elf/elf_notes.c5
7 files changed, 39 insertions, 15 deletions
diff --git a/usr/src/cmd/dladm/dladm.c b/usr/src/cmd/dladm/dladm.c
index 5c44ecf0ef..dce24dd440 100644
--- a/usr/src/cmd/dladm/dladm.c
+++ b/usr/src/cmd/dladm/dladm.c
@@ -18,9 +18,11 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015 Joyent, Inc. All rights reserved.
+ * Copyright 2016 Nexenta Systems, Inc.
*/
#include <stdio.h>
@@ -688,8 +690,8 @@ typedef struct link_fields_buf_s {
char link_class[DLADM_STRSIZE];
char link_mtu[11];
char link_state[DLADM_STRSIZE];
- char link_bridge[MAXLINKNAMELEN];
- char link_over[MAXLINKNAMELEN];
+ char link_bridge[MAXLINKNAMELEN * MAXPORT];
+ char link_over[MAXLINKNAMELEN * MAXPORT];
char link_phys_state[DLADM_STRSIZE];
char link_phys_media[DLADM_STRSIZE];
char link_phys_speed[DLADM_STRSIZE];
@@ -714,7 +716,7 @@ static const ofmt_field_t link_fields[] = {
offsetof(link_fields_buf_t, link_state), print_default_cb},
{ "BRIDGE", 11,
offsetof(link_fields_buf_t, link_bridge), print_default_cb},
-{ "OVER", DLPI_LINKNAME_MAX,
+{ "OVER", 30,
offsetof(link_fields_buf_t, link_over), print_default_cb},
{ NULL, 0, 0, NULL}}
;
@@ -2798,7 +2800,7 @@ print_link_topology(show_state_t *state, datalink_id_t linkid,
(void) strlcat(lbuf->link_over, tmpbuf,
sizeof (lbuf->link_over));
if (i != (ginfo.lg_nports - 1)) {
- (void) strlcat(lbuf->link_over, " ",
+ (void) strlcat(lbuf->link_over, ",",
sizeof (lbuf->link_over));
}
}
@@ -2861,7 +2863,7 @@ print_link_topology(show_state_t *state, datalink_id_t linkid,
(void) strlcat(lbuf->link_over, tmpbuf,
sizeof (lbuf->link_over));
if (i != nports - 1) {
- (void) strlcat(lbuf->link_over, " ",
+ (void) strlcat(lbuf->link_over, ",",
sizeof (lbuf->link_over));
}
}
@@ -3619,6 +3621,9 @@ do_show_link(int argc, char *argv[], const char *use)
}
if (state.ls_parsable)
ofmtflags |= OFMT_PARSABLE;
+ else
+ ofmtflags |= OFMT_WRAP;
+
oferr = ofmt_open(fields_str, link_fields, ofmtflags, 0, &ofmt);
dladm_ofmt_check(oferr, state.ls_parsable, ofmt);
state.ls_ofmt = ofmt;
diff --git a/usr/src/cmd/mdb/common/modules/libumem/umem.c b/usr/src/cmd/mdb/common/modules/libumem/umem.c
index 250a090b12..65a06cb31c 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/umem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/umem.c
@@ -25,7 +25,7 @@
/*
* Copyright 2012 Joyent, Inc. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
*/
#include "umem.h"
@@ -336,6 +336,7 @@ umem_debug_flags_t umem_status_flags[] = {
{ "nosignal", UMF_CHECKSIGNAL },
{ "firewall", UMF_FIREWALL },
{ "lite", UMF_LITE },
+ { "checknull", UMF_CHECKNULL },
{ NULL }
};
diff --git a/usr/src/lib/libdhcpagent/common/dhcpagent_ipc.h b/usr/src/lib/libdhcpagent/common/dhcpagent_ipc.h
index 5dcb6b5b40..be2da33666 100644
--- a/usr/src/lib/libdhcpagent/common/dhcpagent_ipc.h
+++ b/usr/src/lib/libdhcpagent/common/dhcpagent_ipc.h
@@ -22,6 +22,9 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
+/*
+ * Copyright (c) 2013, 2015 by Delphix. All rights reserved.
+ */
#ifndef _DHCPAGENT_IPC_H
#define _DHCPAGENT_IPC_H
@@ -255,8 +258,13 @@ typedef hrtime_t dhcp_ipc_id_t;
/*
* note: the first 4 fields of the dhcp_ipc_request_t and dhcp_ipc_reply_t
* are intentionally identical; code in dhcpagent_ipc.c counts on it!
+ *
+ * we pack these structs to ensure that their lengths will be identical between
+ * 32-bit and 64-bit executables.
*/
+#pragma pack(4)
+
struct dhcp_ipc_request {
dhcp_ipc_type_t message_type; /* type of request */
dhcp_ipc_id_t ipc_id; /* per-socket unique request id */
@@ -276,13 +284,10 @@ struct dhcp_ipc_reply {
uchar_t buffer[1]; /* dynamically extended */
};
-/*
- * since ansi c won't let us define arrays with 0 elements, the
- * size of the ipc request/reply structures is off-by-1; use macros.
- */
+#pragma pack()
-#define DHCP_IPC_REPLY_SIZE (sizeof (dhcp_ipc_reply_t) - 1)
-#define DHCP_IPC_REQUEST_SIZE (sizeof (dhcp_ipc_request_t) - 1)
+#define DHCP_IPC_REPLY_SIZE offsetof(dhcp_ipc_reply_t, buffer)
+#define DHCP_IPC_REQUEST_SIZE offsetof(dhcp_ipc_request_t, buffer)
#define DHCP_IPC_DEFAULT_WAIT 120 /* seconds */
diff --git a/usr/src/lib/libumem/common/envvar.c b/usr/src/lib/libumem/common/envvar.c
index 0c4d872814..6c57d9553e 100644
--- a/usr/src/lib/libumem/common/envvar.c
+++ b/usr/src/lib/libumem/common/envvar.c
@@ -26,6 +26,7 @@
/*
* Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2015 by Delphix. All rights reserved.
*/
#include <ctype.h>
@@ -226,6 +227,10 @@ static umem_env_item_t umem_debug_items[] = {
"Enables writing all logged messages to stderr",
&umem_output, 2
},
+ { "checknull", "Private", ITEM_FLAG,
+ "Abort if an allocation would return null",
+ &umem_flags, UMF_CHECKNULL
+ },
{ NULL, "-- end of UMEM_DEBUG --", ITEM_INVALID }
};
diff --git a/usr/src/lib/libumem/common/umem.c b/usr/src/lib/libumem/common/umem.c
index 00028e5f80..dbc738a049 100644
--- a/usr/src/lib/libumem/common/umem.c
+++ b/usr/src/lib/libumem/common/umem.c
@@ -26,6 +26,7 @@
/*
* Copyright (c) 2014 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2015 by Delphix. All rights reserved.
*/
/*
@@ -1234,6 +1235,9 @@ umem_alloc_retry(umem_cache_t *cp, int umflag)
* Initialization failed. Do normal failure processing.
*/
}
+ if (umem_flags & UMF_CHECKNULL) {
+ umem_err_recoverable("umem: out of heap space");
+ }
if (umflag & UMEM_NOFAIL) {
int def_result = UMEM_CALLBACK_EXIT(255);
int result = def_result;
@@ -1377,7 +1381,7 @@ umem_log_enter(umem_log_header_t *lhp, void *data, size_t size)
static void
umem_log_event(umem_log_header_t *lp, umem_cache_t *cp,
- umem_slab_t *sp, void *addr)
+ umem_slab_t *sp, void *addr)
{
umem_bufctl_audit_t *bcp;
UMEM_LOCAL_BUFCTL_AUDIT(&bcp);
diff --git a/usr/src/lib/libumem/common/umem_impl.h b/usr/src/lib/libumem/common/umem_impl.h
index f63246e166..7d5056f172 100644
--- a/usr/src/lib/libumem/common/umem_impl.h
+++ b/usr/src/lib/libumem/common/umem_impl.h
@@ -26,6 +26,7 @@
/*
* Copyright (c) 2012 Joyent, Inc. All rights reserved.
+ * Copyright (c) 2015 by Delphix. All rights reserved.
*/
#ifndef _UMEM_IMPL_H
@@ -68,6 +69,8 @@ extern "C" {
#define UMF_RANDOMIZE 0x00000400 /* randomize other umem_flags */
#define UMF_PTC 0x00000800 /* cache has per-thread caching */
+#define UMF_CHECKNULL 0x00001000 /* heap exhaustion checking */
+
#define UMF_BUFTAG (UMF_DEADBEEF | UMF_REDZONE)
#define UMF_TOUCH (UMF_BUFTAG | UMF_LITE | UMF_CONTENTS)
#define UMF_RANDOM (UMF_TOUCH | UMF_AUDIT | UMF_NOMAGAZINE)
diff --git a/usr/src/uts/common/exec/elf/elf_notes.c b/usr/src/uts/common/exec/elf/elf_notes.c
index 4b9c93c6ae..7adaa69cd9 100644
--- a/usr/src/uts/common/exec/elf/elf_notes.c
+++ b/usr/src/uts/common/exec/elf/elf_notes.c
@@ -393,9 +393,10 @@ write_elfnotes(proc_t *p, int sig, vnode_t *vp, offset_t offset,
error = elfnote(vp, &offset, NT_FDINFO,
sizeof (fdinfo), &fdinfo, rlimit, credp);
VN_RELE(fvp);
- VN_RELE(vroot);
- if (error)
+ if (error) {
+ VN_RELE(vroot);
goto done;
+ }
continue;
}