-
Notifications
You must be signed in to change notification settings - Fork 15.5k
[sanitizer_common] child_stdin_fd_ should only be set on posix_spawn path #171508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Andrew Haberlandt (ndrewh) Changes#170809 added the child_stdin_fd_ field on SymbolizerProcess to allow the parent process to hold on to the read in of the child's stdin pipe. This was to avoid SIGPIPE. However, the llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp Lines 525 to 535 in 7f5ed91
This could cause a double-close of this fd (problematic in the case of fd reuse). This moves the Full diff: https://github.com/llvm/llvm-project/pull/171508.diff 1 Files Affected:
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
index 29c73e3e1cac1..ab6aee7c9fba7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp
@@ -176,6 +176,10 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() {
internal_close(outfd[1]);
return false;
}
+
+ // We intentionally hold on to the read-end so that we don't get a SIGPIPE
+ child_stdin_fd_ = outfd[0];
+
# else // SANITIZER_APPLE
UNIMPLEMENTED();
# endif // SANITIZER_APPLE
@@ -192,9 +196,6 @@ bool SymbolizerProcess::StartSymbolizerSubprocess() {
input_fd_ = infd[0];
output_fd_ = outfd[1];
- // We intentionally hold on to the read-end so that we don't get a SIGPIPE
- child_stdin_fd_ = outfd[0];
-
CHECK_GT(pid, 0);
// Check that symbolizer subprocess started successfully.
|
|
Auto-merging this to avoid any unintended impact to non-Darwin platforms caused by #170809 |
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/206/builds/10287 Here is the relevant piece of the build log for the reference |
#170809 added the child_stdin_fd_ field on SymbolizerProcess to allow the parent process to hold on to the read in of the child's stdin pipe. This was to avoid SIGPIPE.
However, the
StartSubprocesspath still closes the stdin fd in the parent here:llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp
Lines 525 to 535 in 7f5ed91
This could cause a double-close of this fd (problematic in the case of fd reuse).
This moves the
child_stdin_fd_field to only be initialized on the posix_spawn path. This should ensure #170809 only truly affects Darwin.