From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28445 invoked by alias); 6 Nov 2014 18:40:17 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33614 Received: (qmail 5572 invoked from network); 6 Nov 2014 18:40:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=V7nKCljn c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=QfJG4gzBtou0gDjA-LAA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <141106104001.ZM3973@torch.brasslantern.com> Date: Thu, 06 Nov 2014 10:40:01 -0800 In-reply-to: <87ioisdzw9.fsf@gmail.com> Comments: In reply to Christian Neukirchen "Re: Zsh bugfixes released by RedHat" (Nov 6, 6:04pm) References: <141106075609.ZM3709@torch.brasslantern.com> <87ioisdzw9.fsf@gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Zsh bugfixes released by RedHat MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 6, 6:04pm, Christian Neukirchen wrote: } } Patch23: BZ-978613-malloc-from-signal-handler-workaround.patch Thanks. This patch actually doesn't make a lot of sense, because free() is #define macro'd to zfree() which already contains calls to do signal queueing around all the interesting parts. If there really has been a signal problem discovered here, I think the following is a more complete fix, as calling a signal handler with cmdstack and cmpsp out of sync would be just as bad as calling it within a malloc operation. diff --git a/Src/exec.c b/Src/exec.c index d2d4e80..042215d 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4555,6 +4555,7 @@ execshfunc(Shfunc shf, LinkList args) fputc('\n', xtrerr); fflush(xtrerr); } + queue_signals(); ocs = cmdstack; ocsp = cmdsp; cmdstack = (unsigned char *) zalloc(CMDSTACKSZ); @@ -4562,7 +4563,11 @@ execshfunc(Shfunc shf, LinkList args) if ((osfc = sfcontext) == SFC_NONE) sfcontext = SFC_DIRECT; xtrerr = stderr; + unqueue_signals(); + doshfunc(shf, args, 0); + + queue_signals(); sfcontext = osfc; free(cmdstack); cmdstack = ocs; @@ -4570,6 +4575,7 @@ execshfunc(Shfunc shf, LinkList args) if (!list_pipe) deletefilelist(last_file_list, 0); + unqueue_signals(); } /*