kdudka pushed to zsh (master). "queue signals when manipulating global state to avoid deadlock"

notifications at fedoraproject.org notifications at fedoraproject.org
Mon Apr 20 10:49:49 UTC 2015


>From f4499343c8a1dfaa6ef3944587627b711ac06073 Mon Sep 17 00:00:00 2001
From: Kamil Dudka <kdudka at redhat.com>
Date: Mon, 20 Apr 2015 12:44:30 +0200
Subject: queue signals when manipulating global state to avoid deadlock


diff --git a/zsh-5.0.7-signal-safety.patch b/zsh-5.0.7-signal-safety.patch
new file mode 100644
index 0000000..f12781f
--- /dev/null
+++ b/zsh-5.0.7-signal-safety.patch
@@ -0,0 +1,104 @@
+From 7c9af538d63b4623b38ef2fa9903e0f0344ffc32 Mon Sep 17 00:00:00 2001
+From: "Barton E. Schaefer" <schaefer at zsh.org>
+Date: Fri, 20 Feb 2015 18:45:36 -0800
+Subject: [PATCH] 34590: queue_signals() around more scopes that manipulate
+ global state
+
+Upstream-commit: a4ff8e69570cbdb8e7d5bf1d5cc4000ffe63e15e
+Signed-off-by: Kamil Dudka <kdudka at redhat.com>
+---
+ Src/exec.c |  4 +++-
+ Src/text.c | 15 +++++++++++++++
+ 2 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/Src/exec.c b/Src/exec.c
+index 04c8b50..b59eb5e 100644
+--- a/Src/exec.c
++++ b/Src/exec.c
+@@ -2320,6 +2320,7 @@ addvars(Estate state, Wordcode pc, int addflags)
+ void
+ setunderscore(char *str)
+ {
++    queue_signals();
+     if (str && *str) {
+ 	int l = strlen(str) + 1, nl = (l + 31) & ~31;
+ 
+@@ -2337,6 +2338,7 @@ setunderscore(char *str)
+ 	*zunderscore = '\0';
+ 	underscoreused = 1;
+     }
++    unqueue_signals();
+ }
+ 
+ /* These describe the type of expansions that need to be done on the words
+@@ -5246,7 +5248,7 @@ execsave(void)
+ {
+     struct execstack *es;
+ 
+-    es = (struct execstack *) malloc(sizeof(struct execstack));
++    es = (struct execstack *) zalloc(sizeof(struct execstack));
+     es->list_pipe_pid = list_pipe_pid;
+     es->nowait = nowait;
+     es->pline_level = pline_level;
+diff --git a/Src/text.c b/Src/text.c
+index f55553e..8f8eb34 100644
+--- a/Src/text.c
++++ b/Src/text.c
+@@ -173,6 +173,8 @@ getpermtext(Eprog prog, Wordcode c, int start_indent)
+ {
+     struct estate s;
+ 
++    queue_signals();
++
+     if (!c)
+ 	c = prog->prog;
+ 
+@@ -193,6 +195,9 @@ getpermtext(Eprog prog, Wordcode c, int start_indent)
+     *tptr = '\0';
+     freeeprog(prog);		/* mark as unused */
+     untokenize(tbuf);
++
++    unqueue_signals();
++
+     return tbuf;
+ }
+ 
+@@ -206,6 +211,8 @@ getjobtext(Eprog prog, Wordcode c)
+ 
+     struct estate s;
+ 
++    queue_signals();
++
+     if (!c)
+ 	c = prog->prog;
+ 
+@@ -224,6 +231,9 @@ getjobtext(Eprog prog, Wordcode c)
+     *tptr = '\0';
+     freeeprog(prog);		/* mark as unused */
+     untokenize(jbuf);
++
++    unqueue_signals();
++
+     return jbuf;
+ }
+ 
+@@ -879,6 +889,9 @@ getredirs(LinkList redirs)
+ 	">", ">|", ">>", ">>|", "&>", "&>|", "&>>", "&>>|", "<>", "<",
+ 	"<<", "<<-", "<<<", "<&", ">&", NULL /* >&- */, "<", ">"
+     };
++
++    queue_signals();
++
+     taddchr(' ');
+     for (n = firstnode(redirs); n; incnode(n)) {
+ 	Redir f = (Redir) getdata(n);
+@@ -966,4 +979,6 @@ getredirs(LinkList redirs)
+ 	}
+     }
+     tptr--;
++
++    unqueue_signals();
+ }
+-- 
+2.1.0
+
diff --git a/zsh.spec b/zsh.spec
index b3e4e87..37cb9a4 100644
--- a/zsh.spec
+++ b/zsh.spec
@@ -32,6 +32,9 @@ Patch8: zsh-5.0.7-cd-sigsegv.patch
 # fix SIGSEGV when handling heredocs and keyboard interrupt (#972624)
 Patch9: zsh-5.0.7-heredocs-sigsegv.patch
 
+# queue signals when manipulating global state to avoid deadlock
+Patch10: zsh-5.0.7-signal-safety.patch
+
 BuildRequires: coreutils sed ncurses-devel libcap-devel
 BuildRequires: texinfo texi2html gawk hostname
 Requires(post): info grep
@@ -72,6 +75,7 @@ This package contains the Zsh manual in html format.
 %patch7 -p1
 %patch8 -p1
 %patch9 -p1
+%patch10 -p1
 
 cp -p %SOURCE7 .
 
@@ -191,6 +195,7 @@ fi
 %changelog
 * Mon Apr 20 2015 Kamil Dudka <kdudka at redhat.com> - 5.0.7-7
 - fix SIGSEGV when handling heredocs and keyboard interrupt (#972624)
+- queue signals when manipulating global state to avoid deadlock
 
 * Sun Jan 25 2015 Kamil Dudka <kdudka at redhat.com> - 5.0.7-6
 - use correct allocation function in the new 'cd' code (#1183238)
-- 
cgit v0.10.2


	http://pkgs.fedoraproject.org/cgit/zsh.git/commit/?h=master&id=f4499343c8a1dfaa6ef3944587627b711ac06073


More information about the scm-commits mailing list