From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/
Date: Thu, 17 May 2018 18:40:49 +0000 (UTC) [thread overview]
Message-ID: <1526582307.b2a5f03abc0c172b6189226e6f9a7491a002cf51.zmedico@gentoo> (raw)
commit: b2a5f03abc0c172b6189226e6f9a7491a002cf51
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu May 17 18:38:27 2018 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu May 17 18:38:27 2018 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2a5f03a
MergeProcess,spawn: unregister SIGCHLD and wakeup_fd (bug 655656)
In order to prevent forked processes from invoking the parent process's
SIGCHLD handler and writing to wakeup_fd (triggering BlockingIOError),
unregister the SIGCHLD and wakeup_fd.
Bug: https://bugs.gentoo.org/655656
Reported-by: Helmut Jarausch <jarausch <AT> igpm.rwth-aachen.de>
pym/portage/dbapi/_MergeProcess.py | 10 ++++++++++
pym/portage/process.py | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/pym/portage/dbapi/_MergeProcess.py b/pym/portage/dbapi/_MergeProcess.py
index fefdf8635..371550079 100644
--- a/pym/portage/dbapi/_MergeProcess.py
+++ b/pym/portage/dbapi/_MergeProcess.py
@@ -178,6 +178,16 @@ class MergeProcess(ForkProcess):
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ # Unregister SIGCHLD handler and wakeup_fd for the parent
+ # process's event loop (bug 655656).
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ try:
+ wakeup_fd = signal.set_wakeup_fd(-1)
+ if wakeup_fd > 0:
+ os.close(wakeup_fd)
+ except (ValueError, OSError):
+ pass
+
portage.locks._close_fds()
# We don't exec, so use close_fds=False
# (see _setup_pipes docstring).
diff --git a/pym/portage/process.py b/pym/portage/process.py
index 2af783e22..fd326731a 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -472,6 +472,16 @@ def _exec(binary, mycommand, opt_name, fd_pipes, env, gid, groups, uid, umask,
signal.signal(signal.SIGINT, signal.SIG_DFL)
signal.signal(signal.SIGTERM, signal.SIG_DFL)
+ # Unregister SIGCHLD handler and wakeup_fd for the parent
+ # process's event loop (bug 655656).
+ signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+ try:
+ wakeup_fd = signal.set_wakeup_fd(-1)
+ if wakeup_fd > 0:
+ os.close(wakeup_fd)
+ except (ValueError, OSError):
+ pass
+
# Quiet killing of subprocesses by SIGPIPE (see bug #309001).
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
next reply other threads:[~2018-05-17 18:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-17 18:40 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-12-28 0:01 [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/ Zac Medico
2014-08-19 7:01 Michał Górny
2014-08-19 7:01 Michał Górny
2014-08-04 21:41 Arfrever Frehtes Taifersar Arahesis
2014-08-03 21:53 Pavel Kazakov
2011-10-16 21:13 Zac Medico
2011-09-06 18:35 Zac Medico
2011-05-05 15:13 Zac Medico
2011-03-27 20:57 Zac Medico
2011-02-14 4:02 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1526582307.b2a5f03abc0c172b6189226e6f9a7491a002cf51.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox