Run safe signal handlers before returning from sigsuspend

This commit is contained in:
Petr Písař 2012-02-06 14:24:42 +01:00
parent 39fd376542
commit c52b77d65b
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,43 @@
From 38d7c791f597c3d567a70466dc2e48b73ec318bf Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Mon, 26 Dec 2011 19:06:54 +0200
Subject: [PATCH] Signal handlers must run before sigsuspend returns
The whole point of sigsuspend and pause is to wait until a signal has
arrived, and then return *after* it has been triggered. Currently
delayed/"safe" signals prevent that from happening, which might cause
race conditions.
This patch prevents that (as far as possible) by running the signal
handlers ASAP.
Petr Pisar: Back-ported to 5.14.2.
---
ext/POSIX/POSIX.xs | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 8dc1f5a..4b9779b 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -1550,6 +1550,8 @@ sigaction(sig, optaction, oldaction = 0)
SysRet
sigpending(sigset)
POSIX::SigSet sigset
+ CLEANUP:
+ PERL_ASYNC_CHECK();
SysRet
sigprocmask(how, sigset, oldsigset = 0)
@@ -2019,6 +2021,8 @@ pathconf(filename, name)
SysRet
pause()
+ CLEANUP:
+ PERL_ASYNC_CHECK();
SysRet
setgid(gid)
--
1.7.7.6

View File

@ -88,6 +88,10 @@ Patch12: perl-5.14.2-add-a-couple-missing-LEAVEs-in-perlio_async_run.patc
# fixed in Unicode-Collate-0.87.
Patch13: perl-5.14.2-locale-search-inc.patch
# Run safe signal handlers before returning from sigsuspend() and pause(),
# rhbz#771228, RT#107216, fixed after 5.15.6.
Patch14: perl-5.14.2-Signal-handlers-must-run-before-sigsuspend-returns.patch
# Update some of the bundled modules
# see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
@ -1253,6 +1257,7 @@ tarball from perl.org.
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
#copy the example script
cp -a %{SOURCE5} .
@ -1456,6 +1461,7 @@ pushd %{build_archlib}/CORE/
'Fedora Patch11: Fix leak with non-matching named captures' \
'Fedora Patch12: Fix interrupted reading' \
'Fedora Patch13: Fix searching for Unicode::Collate::Locale data' \
'Fedora Patch14: Run signal handlers before returning from sigsuspend' \
%{nil}
rm patchlevel.bak
@ -2415,6 +2421,8 @@ sed \
%changelog
* Mon Feb 06 2012 Petr Pisar <ppisar@redhat.com> - 4:5.14.2-211
- Fix searching for Unicode::Collate::Locale data (bug #756118)
- Run safe signal handlers before returning from sigsuspend() and pause()
(bug #771228)
* Tue Jan 10 2012 Paul Howarth <paul@city-fan.org> - 4:5.14.2-210
- Rebuild again now that perl dependency generator is fixed (#772632, #772699)