[bash/f17] Don't call malloc in signal handler

Roman Rakus rrakus at fedoraproject.org
Mon Apr 23 14:01:18 UTC 2012


commit fc4c557d86d7ec8d6d61414bfac7b566d1170497
Author: Roman Rakus <rrakus at redhat.com>
Date:   Mon Apr 23 15:47:26 2012 +0200

    Don't call malloc in signal handler
    
    bugzilla: #800473
    
    Signed-off-by: Roman Rakus <rrakus at redhat.com>

 bash-4.1-defer-sigchld-trap.patch |   30 ++++++++++++++++++++++++++++++
 bash.spec                         |   10 +++++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/bash-4.1-defer-sigchld-trap.patch b/bash-4.1-defer-sigchld-trap.patch
new file mode 100644
index 0000000..8ff26af
--- /dev/null
+++ b/bash-4.1-defer-sigchld-trap.patch
@@ -0,0 +1,30 @@
+diff -pruN bash-4.1/jobs.c bash-4.1.patched/jobs.c
+--- bash-4.1/jobs.c	2009-11-30 03:42:05.000000000 +0530
++++ bash-4.1.patched/jobs.c	2012-03-06 16:44:15.706595703 +0530
+@@ -3037,6 +3037,7 @@ waitchld (wpid, block)
+   PROCESS *child;
+   pid_t pid;
+   int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
++  int called_from_sighand = sigchld;
+   static int wcontinued = WCONTINUED;	/* run-time fix for glibc problem */
+ 
+   call_set_current = children_exited = 0;
+@@ -3161,7 +3162,17 @@ waitchld (wpid, block)
+ 	  longjmp (wait_intr_buf, 1);
+ 	}
+ 
+-      run_sigchld_trap (children_exited);
++      /* Queue up the trap handler if we're called directly from within the
++         signal handler. */
++      if (called_from_sighand)
++	{
++	  int i = children_exited;
++	  interrupt_immediately = 0;
++	  while (i--)
++	    trap_handler (SIGCHLD);
++	}
++      else
++	run_sigchld_trap (children_exited);
+     }
+ 
+   /* We have successfully recorded the useful information about this process
diff --git a/bash.spec b/bash.spec
index 894dc89..c37ca57 100644
--- a/bash.spec
+++ b/bash.spec
@@ -6,7 +6,7 @@
 Version: %{baseversion}%{patchleveltag}
 Name: bash
 Summary: The GNU Bourne Again shell
-Release: 1%{?dist}
+Release: 2%{?dist}
 Group: System Environment/Shells
 License: GPLv3+
 Url: http://www.gnu.org/software/bash
@@ -79,6 +79,9 @@ Patch120: bash-4.2-rc2-logout.patch
 # Static analyzis shows some issues in bash-2.05a-interpreter.patch
 Patch121: bash-4.2-coverity.patch
 
+# Don't call malloc in signal handler
+Patch122: bash-4.1-defer-sigchld-trap.patch
+
 BuildRequires: texinfo bison
 BuildRequires: ncurses-devel
 BuildRequires: autoconf, gettext
@@ -154,6 +157,8 @@ This package contains documentation files for %{name}.
 %patch119 -p1 -b .broken_pipe
 %patch120 -p1 -b .logout
 %patch121 -p1 -b .coverity
+%patch122 -p1 -b .defer_sigchld_trap
+
 echo %{version} > _distribution
 echo %{release} > _patchlevel
 
@@ -321,6 +326,9 @@ end
 #%doc doc/*.ps doc/*.0 doc/*.html doc/article.txt
 
 %changelog
+* Mon Apr 23 2012 Roman Rakus <rrakus at redhat.com> - 4.2.24-2
+- Don't call malloc in signal handler
+
 * Tue Mar 13 2012 Roman Rakus <rrakus at redhat.com> - 4.2.24-1
 - Patchlevel 24
 


More information about the scm-commits mailing list