teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame SOURCES/rpm-4.16.1.3-unblock-signals-in-forked-scriptlets.patch

a5e32e
commit cb6aa82dbc10d554f8d234e934ae7c77e39a3ce2
a5e32e
Author: Panu Matilainen <pmatilai@redhat.com>
a5e32e
Date:   Tue Jan 12 13:35:23 2021 +0200
a5e32e
a5e32e
    Unblock signals in forked scriptlets
a5e32e
    
a5e32e
    Since commit c5f82d3f6223ebd0c5cc0a07ea60393ae7284929 we've blocked
a5e32e
    most signals during transactions, which makes sense to rpm itself but
a5e32e
    the signal mask is inherited to childs and carried even across exec(),
a5e32e
    so all scriptlets are executing with those signals blocked as well.
a5e32e
    Which in turn does not make sense, the scriptlets could run stuff that
a5e32e
    actually depends on signal delivery (such as SIGALARM in RhBug:1913765).
a5e32e
    
a5e32e
    Unblock all signals for forked scriptlet execution (Lua scriptlets are
a5e32e
    totally different as they execute in-process for now)
a5e32e
a5e32e
diff --git a/lib/rpmscript.c b/lib/rpmscript.c
a5e32e
index 2ae3378f7..c69d29554 100644
a5e32e
--- a/lib/rpmscript.c
a5e32e
+++ b/lib/rpmscript.c
a5e32e
@@ -152,6 +152,11 @@ static void doScriptExec(ARGV_const_t argv, ARGV_const_t prefixes,
a5e32e
 			FD_t scriptFd, FD_t out)
a5e32e
 {
a5e32e
     int xx;
a5e32e
+    sigset_t set;
a5e32e
+
a5e32e
+    /* Unmask all signals, the scripts may need them */
a5e32e
+    sigfillset(&set);
a5e32e
+    sigprocmask(SIG_UNBLOCK, &set, NULL);
a5e32e
 
a5e32e
     /* SIGPIPE is ignored in rpm, reset to default for the scriptlet */
a5e32e
     (void) signal(SIGPIPE, SIG_DFL);