summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/man/man3c/putenv.3c2
-rw-r--r--usr/src/pkg/manifests/system-test-libctest.mf2
-rw-r--r--usr/src/test/libc-tests/runfiles/default.run2
-rw-r--r--usr/src/test/libc-tests/tests/Makefile1
-rw-r--r--usr/src/test/libc-tests/tests/env-7076.c73
-rw-r--r--usr/src/uts/intel/io/scsi/adapters/pvscsi/pvscsi.c15
6 files changed, 90 insertions, 5 deletions
diff --git a/usr/src/man/man3c/putenv.3c b/usr/src/man/man3c/putenv.3c
index d5b59a42fe..572ded7a6e 100644
--- a/usr/src/man/man3c/putenv.3c
+++ b/usr/src/man/man3c/putenv.3c
@@ -8,7 +8,7 @@
.\" 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 PUTENV 3C "Aug 7, 2004"
+.TH PUTENV 3C "Jun 22, 2016"
.SH NAME
putenv \- change or add value to environment
.SH SYNOPSIS
diff --git a/usr/src/pkg/manifests/system-test-libctest.mf b/usr/src/pkg/manifests/system-test-libctest.mf
index 6fb203a3ab..c2ae2bcf0f 100644
--- a/usr/src/pkg/manifests/system-test-libctest.mf
+++ b/usr/src/pkg/manifests/system-test-libctest.mf
@@ -81,6 +81,8 @@ file path=opt/libc-tests/tests/call_once.64 mode=0555
file path=opt/libc-tests/tests/catopen mode=0555
file path=opt/libc-tests/tests/endian.32 mode=0555
file path=opt/libc-tests/tests/endian.64 mode=0555
+file path=opt/libc-tests/tests/env-7076.32 mode=0555
+file path=opt/libc-tests/tests/env-7076.64 mode=0555
file path=opt/libc-tests/tests/fpround_test mode=0555
file path=opt/libc-tests/tests/fpround_test.$(ARCH) mode=0555
file path=opt/libc-tests/tests/fpround_test.$(ARCH64) mode=0555
diff --git a/usr/src/test/libc-tests/runfiles/default.run b/usr/src/test/libc-tests/runfiles/default.run
index 801558459a..864001eb46 100644
--- a/usr/src/test/libc-tests/runfiles/default.run
+++ b/usr/src/test/libc-tests/runfiles/default.run
@@ -62,6 +62,8 @@ outputdir = /var/tmp/test_results
[/opt/libc-tests/tests/catopen]
[/opt/libc-tests/tests/env-OS-4089.32]
[/opt/libc-tests/tests/env-OS-4089.64]
+[/opt/libc-tests/tests/env-7076.32]
+[/opt/libc-tests/tests/env-7076.64]
[/opt/libc-tests/tests/endian.32]
[/opt/libc-tests/tests/endian.64]
[/opt/libc-tests/tests/quick_exit]
diff --git a/usr/src/test/libc-tests/tests/Makefile b/usr/src/test/libc-tests/tests/Makefile
index 34c0123d88..68f6df3b2d 100644
--- a/usr/src/test/libc-tests/tests/Makefile
+++ b/usr/src/test/libc-tests/tests/Makefile
@@ -35,6 +35,7 @@ PROGS = \
c11_tss \
call_once \
endian \
+ env-7076 \
quick_exit_order \
quick_exit_status \
timespec_get
diff --git a/usr/src/test/libc-tests/tests/env-7076.c b/usr/src/test/libc-tests/tests/env-7076.c
new file mode 100644
index 0000000000..6349747bd8
--- /dev/null
+++ b/usr/src/test/libc-tests/tests/env-7076.c
@@ -0,0 +1,73 @@
+/*
+ * 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 Joyent, Inc.
+ */
+
+/*
+ * Regression test for 7076 where doing a putenv() call without an '=' sign
+ * may lead to a segmentation fault when doing a getenv() depending on the
+ * circumstances of the environment's layout. Verify putenv() mimics
+ * unsetenv().
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/debug.h>
+
+int
+main(void)
+{
+ if (putenv("FOO=bar") != 0) {
+ fprintf(stderr, "failed to put FOO into the environment: %s\n",
+ strerror(errno));
+ return (1);
+ }
+
+ if (getenv("FOO") == NULL) {
+ fprintf(stderr, "failed to retrieve FOO from the "
+ "environment!\n");
+ return (1);
+ }
+
+ VERIFY0(unsetenv("FOO"));
+
+ if (getenv("FOO") != NULL) {
+ fprintf(stderr, "Somehow retrieved FOO from the "
+ "environment after unsetenv()!\n");
+ return (1);
+ }
+
+ if (putenv("FOO=bar") != 0) {
+ fprintf(stderr, "failed to put FOO into the environment: %s\n",
+ strerror(errno));
+ return (1);
+ }
+
+ if (getenv("FOO") == NULL) {
+ fprintf(stderr, "failed to retrieve FOO from the "
+ "environment!\n");
+ return (1);
+ }
+
+ VERIFY0(putenv("FOO"));
+
+ if (getenv("FOO") != NULL) {
+ fprintf(stderr, "Somehow retrieved FOO from the "
+ "environment after putenv()!\n");
+ return (1);
+ }
+
+ return (0);
+}
diff --git a/usr/src/uts/intel/io/scsi/adapters/pvscsi/pvscsi.c b/usr/src/uts/intel/io/scsi/adapters/pvscsi/pvscsi.c
index d0a9db6736..edef3dd442 100644
--- a/usr/src/uts/intel/io/scsi/adapters/pvscsi/pvscsi.c
+++ b/usr/src/uts/intel/io/scsi/adapters/pvscsi/pvscsi.c
@@ -346,6 +346,8 @@ pvscsi_config_one(dev_info_t *pdip, pvscsi_softc_t *pvs, int target,
pvscsi_device_t *devnode;
struct scsi_inquiry inq;
+ ASSERT(DEVI_BUSY_OWNED(pdip));
+
/* Inquiry target */
inqrc = pvscsi_inquiry_target(pvs, target, &inq);
@@ -446,8 +448,10 @@ pvscsi_config_all(dev_info_t *pdip, pvscsi_softc_t *pvs)
{
int target;
- for (target = 0; target < PVSCSI_MAXTGTS; target++)
+ for (target = 0; target < PVSCSI_MAXTGTS; target++) {
+ /* ndi_devi_enter is done in pvscsi_bus_config */
(void) pvscsi_config_one(pdip, pvs, target, NULL);
+ }
return (NDI_SUCCESS);
}
@@ -550,9 +554,12 @@ static void
pvscsi_handle_msg(void *arg)
{
pvscsi_msg_t *msg = (pvscsi_msg_t *)arg;
+ dev_info_t *dip = msg->msg_pvs->dip;
+ int circ;
- (void) pvscsi_config_one(msg->msg_pvs->dip, msg->msg_pvs, msg->target,
- NULL);
+ ndi_devi_enter(dip, &circ);
+ (void) pvscsi_config_one(dip, msg->msg_pvs, msg->target, NULL);
+ ndi_devi_exit(dip, circ);
kmem_free(msg, sizeof (pvscsi_msg_t));
}
@@ -2280,7 +2287,7 @@ pvscsi_bus_config(dev_info_t *pdip, uint_t flags, ddi_bus_config_op_t op,
switch (op) {
case BUS_CONFIG_ONE:
if ((p = strrchr((char *)arg, '@')) != NULL &&
- ddi_strtol(p + 1, NULL, 10, &target) == 0)
+ ddi_strtol(p + 1, NULL, 16, &target) == 0)
ret = pvscsi_config_one(pdip, pvs, (int)target, childp);
break;
case BUS_CONFIG_DRIVER: