summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorTodd Whiteman <todd.whiteman@joyent.com>2018-03-26 20:45:07 -0700
committerTodd Whiteman <todd.whiteman@joyent.com>2018-03-26 20:45:07 -0700
commit4d2c16cd9a06798bb86bd90546b9b160ec77b537 (patch)
treee1a8f9ebe6462cbde12d8253b1e07697b0c0bc31 /usr/src/lib
parentd0b07e82639d8b5395b7297d94674ff3c006630c (diff)
downloadillumos-joyent-166.tar.gz
Revert "OS-6467 LX go 1.9 aborts on unexpected signal interpositioning"166
This reverts commit b036e0fd770de1dd266db82dad196891746e92e1.
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/clone.c43
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/fork.c10
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/signal.c12
-rw-r--r--usr/src/lib/brand/lx/lx_brand/sys/lx_misc.h5
4 files changed, 15 insertions, 55 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/clone.c b/usr/src/lib/brand/lx/lx_brand/common/clone.c
index 109baf3d0a..f8d5d9cd02 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/clone.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/clone.c
@@ -391,23 +391,8 @@ lx_clone(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5)
/*
* Suspend signal delivery, run the stack management prefork
* handler and perform the actual fork(2) operation.
- *
- * During vfork, Linux will not deliver any signals to any
- * thread in the parent. Some applications (e.g. Go) depend on
- * this. For example, we must prevent the following sequence:
- * 1) Parent with many threads, one thread calls vfork
- * 2) vforked child resets all signal handlers
- * 3) a different child of the parent exits and SIGCHLD is sent
- * to parent before the vforked child execs/exits
- * The parent cannot receive the SIGCHLD until afer we repair
- * the parent's signal handlers in lx_sighandlers_restore, once
- * the parent resumes after the vfork.
*/
- if (flags & LX_CLONE_VFORK) {
- lx_block_all_signals();
- } else {
- _sigoff();
- }
+ _sigoff();
lx_stack_prefork();
if (flags & LX_CLONE_VFORK) {
lx_sighandlers_t saved;
@@ -459,20 +444,16 @@ lx_clone(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5)
(void) uucopy(&rval, ptidp, sizeof (int));
}
- /*
- * Re-enable signal delivery in the parent process.
- */
- if (flags & LX_CLONE_VFORK) {
- lx_unblock_all_signals();
- } else {
- _sigon();
- }
-
if (rval > 0) {
lx_ptrace_stop_if_option(ptrace_event, B_FALSE,
(ulong_t)rval, NULL);
}
+ /*
+ * Re-enable signal delivery in the parent process.
+ */
+ _sigon();
+
return ((rval < 0) ? -errno : rval);
}
@@ -581,18 +562,14 @@ lx_clone(uintptr_t p1, uintptr_t p2, uintptr_t p3, uintptr_t p4, uintptr_t p5)
}
/*
- * Re-enable signal delivery in the child process.
+ * Stop for ptrace if required.
*/
- if (flags & LX_CLONE_VFORK) {
- lx_unblock_all_signals();
- } else {
- _sigon();
- }
+ lx_ptrace_stop_if_option(ptrace_event, B_TRUE, 0, NULL);
/*
- * Stop for ptrace if required.
+ * Re-enable signal delivery in the child process.
*/
- lx_ptrace_stop_if_option(ptrace_event, B_TRUE, 0, NULL);
+ _sigon();
/*
* The child process returns via the regular emulated system
diff --git a/usr/src/lib/brand/lx/lx_brand/common/fork.c b/usr/src/lib/brand/lx/lx_brand/common/fork.c
index beb76fcf59..aa14267185 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/fork.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/fork.c
@@ -22,7 +22,7 @@
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
- * Copyright 2017 Joyent, Inc.
+ * Copyright 2016 Joyent, Inc. All rights reserved.
*/
#include <errno.h>
@@ -124,7 +124,7 @@ lx_vfork(void)
* the comments in lx_clone for more detail.
*/
- lx_block_all_signals();
+ _sigoff();
lx_stack_prefork();
lx_sighandlers_save(&saved);
lx_tsd->lxtsd_is_vforked++;
@@ -138,7 +138,7 @@ lx_vfork(void)
switch (ret) {
case -1:
lx_stack_postfork();
- lx_unblock_all_signals();
+ _sigon();
return (-errno);
case 0:
@@ -158,8 +158,6 @@ lx_vfork(void)
lx_debug("\tvfork native stack sp %p",
vforkuc.uc_brand_data[1]);
- lx_unblock_all_signals();
-
/* Stop for ptrace if required. */
lx_ptrace_stop_if_option(LX_PTRACE_O_TRACEVFORK, B_TRUE, 0,
NULL);
@@ -178,9 +176,9 @@ lx_vfork(void)
default:
/* parent - child should have exited or exec-ed by now */
lx_stack_postfork();
- lx_unblock_all_signals();
lx_ptrace_stop_if_option(LX_PTRACE_O_TRACEVFORK, B_FALSE,
(ulong_t)ret, NULL);
+ _sigon();
return (ret);
}
}
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 a8e3601cb9..c46d8b44ec 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/signal.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/signal.c
@@ -2378,15 +2378,3 @@ lx_signalfd4(int fd, uintptr_t mask, size_t msize, int flags)
return (r == -1 ? -errno : r);
}
-
-void
-lx_block_all_signals()
-{
- (void) syscall(SYS_brand, B_BLOCK_ALL_SIGS);
-}
-
-void
-lx_unblock_all_signals()
-{
- (void) syscall(SYS_brand, B_UNBLOCK_ALL_SIGS);
-}
diff --git a/usr/src/lib/brand/lx/lx_brand/sys/lx_misc.h b/usr/src/lib/brand/lx/lx_brand/sys/lx_misc.h
index ce241db8bc..5879311cef 100644
--- a/usr/src/lib/brand/lx/lx_brand/sys/lx_misc.h
+++ b/usr/src/lib/brand/lx/lx_brand/sys/lx_misc.h
@@ -25,7 +25,7 @@
*/
/*
- * Copyright 2017 Joyent, Inc.
+ * Copyright 2016 Joyent, Inc. All rights reserved.
*/
#ifndef _SYS_LX_H
@@ -147,9 +147,6 @@ extern void lx_free_other_stacks(void);
extern void lx_stack_prefork(void);
extern void lx_stack_postfork(void);
-extern void lx_block_all_signals();
-extern void lx_unblock_all_signals();
-
/*
* NO_UUCOPY disables calls to the uucopy* system calls to help with
* debugging brand library accesses to linux application memory.