Do not close an IPC pipe that already has a desired descriptor
This commit is contained in:
parent
539a03b8cf
commit
ba7b23759d
@ -0,0 +1,35 @@
|
||||
From 30c869b87739b56280daca3cd44b0588144747b7 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Timmermans <fawaka@gmail.com>
|
||||
Date: Sun, 16 Dec 2018 01:05:06 +0100
|
||||
Subject: [PATCH] Always mark pipe in list pipe-open as inherit-on-exec
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is the my_popen_list counterpart of
|
||||
c6fe5b981b942ddabb23ed4b7602067e906e6d88
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
util.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util.c b/util.c
|
||||
index 99bf4ae2b0..8c9909e10c 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -2330,8 +2330,10 @@ Perl_my_popen_list(pTHX_ const char *mode, int n, SV **args)
|
||||
if (p[THAT] != (*mode == 'r')) /* if dup2() didn't close it */
|
||||
PerlLIO_close(p[THAT]); /* close parent's end of _the_ pipe */
|
||||
}
|
||||
- else
|
||||
+ else {
|
||||
+ setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
|
||||
PerlLIO_close(p[THAT]); /* close parent's end of _the_ pipe */
|
||||
+ }
|
||||
#if !defined(HAS_FCNTL) || !defined(F_SETFD)
|
||||
/* No automatic close - do it by hand */
|
||||
# ifndef NOFILE
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,43 @@
|
||||
From c6fe5b981b942ddabb23ed4b7602067e906e6d88 Mon Sep 17 00:00:00 2001
|
||||
From: Leon Timmermans <fawaka@gmail.com>
|
||||
Date: Sat, 15 Dec 2018 19:08:41 +0100
|
||||
Subject: [PATCH] Always mark pipe in pipe-open as inherit-on-exec
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since 2cdf406a a lot of file descriptors are opened close-on-exec,
|
||||
including the pipe that is passed to the child process in a pipe-open.
|
||||
This is usually fine because a dup2 follows to rename that handle to
|
||||
stdin/stdout that will set the inherit-on-exec. However, if the pipe
|
||||
descriptor already has the right value, for example because stdin was
|
||||
closed, then no dup2 happens and hence it's still marked as
|
||||
close-on-exec right when we want to perform an exec.
|
||||
|
||||
This patch explicitly marks such a handle as inherit-on-exec, to ensure
|
||||
it will be open for the child process.
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
util.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/util.c b/util.c
|
||||
index a9bf9b8609..99bf4ae2b0 100644
|
||||
--- a/util.c
|
||||
+++ b/util.c
|
||||
@@ -2469,8 +2469,10 @@ Perl_my_popen(pTHX_ const char *cmd, const char *mode)
|
||||
if (p[THAT] != (*mode == 'r')) /* if dup2() didn't close it */
|
||||
PerlLIO_close(p[THAT]);
|
||||
}
|
||||
- else
|
||||
+ else {
|
||||
+ setfd_cloexec_or_inhexec_by_sysfdness(p[THIS]);
|
||||
PerlLIO_close(p[THAT]);
|
||||
+ }
|
||||
#ifndef OS2
|
||||
if (doexec) {
|
||||
#if !defined(HAS_FCNTL) || !defined(F_SETFD)
|
||||
--
|
||||
2.17.2
|
||||
|
@ -219,6 +219,11 @@ Patch39: perl-5.28.1-ext-GDBM_File-t-fatal.t-handle-non-fatality.patch
|
||||
Patch40: perl-5.29.5-Correct-spelling-error-in-skip-message.patch
|
||||
Patch41: perl-5.29.5-Avoid-Use-of-uninitialized-value-res-in-numeric-eq-w.patch
|
||||
|
||||
# Do not close an IPC pipe that already has a desired descriptor, RT#133726,
|
||||
# in upstream after 5.29.5
|
||||
Patch42: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec.patch
|
||||
Patch43: perl-5.29.5-Always-mark-pipe-in-pipe-open-as-inherit-on-exec-2.patch
|
||||
|
||||
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
|
||||
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
|
||||
|
||||
@ -2814,6 +2819,8 @@ Perl extension for Version Objects
|
||||
%patch39 -p1
|
||||
%patch40 -p1
|
||||
%patch41 -p1
|
||||
%patch42 -p1
|
||||
%patch43 -p1
|
||||
%patch200 -p1
|
||||
%patch201 -p1
|
||||
|
||||
@ -2851,6 +2858,7 @@ perl -x patchlevel.h \
|
||||
'Fedora Patch35: Fix in-place edit to replace files on a successful perl exit status (bug #1650041)' \
|
||||
'Fedora Patch38: Fix compiling regular expressions that contain both compile- and run-time compiled code blocks (RT#133687)' \
|
||||
'Fedora Patch39: Adjust tests to gdbm-1.15 (RT#133295)' \
|
||||
'Fedora Patch42: Do not close an IPC pipe that already has a desired descriptor (RT#133726)' \
|
||||
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
|
||||
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
|
||||
%{nil}
|
||||
@ -5141,6 +5149,7 @@ popd
|
||||
%changelog
|
||||
* Mon Jan 14 2019 Petr Pisar <ppisar@redhat.com> - 4:5.28.1-430
|
||||
- Adjust tests to gdbm-1.15 using an upstream fix (RT#133295)
|
||||
- Do not close an IPC pipe that already has a desired descriptor (RT#133726)
|
||||
|
||||
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429
|
||||
- Rebuilt for libcrypt.so.2 (#1666033)
|
||||
|
Loading…
Reference in New Issue
Block a user