zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: Zsh bugfixes released by RedHat
Date: Thu, 06 Nov 2014 10:40:01 -0800	[thread overview]
Message-ID: <141106104001.ZM3973@torch.brasslantern.com> (raw)
In-Reply-To: <87ioisdzw9.fsf@gmail.com>

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();
 }
 
 /*


  reply	other threads:[~2014-11-06 18:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 15:56 Bart Schaefer
2014-11-06 16:58 ` Jérémie Roquet
2014-11-06 17:04 ` Christian Neukirchen
2014-11-06 18:40   ` Bart Schaefer [this message]
2014-11-06 17:13 ` Ray Andrews
2014-11-06 16:30   ` Bart Schaefer
2014-11-06 20:15     ` Axel Beckert
2014-11-06 20:47       ` Bart Schaefer
2014-11-06 22:10         ` Christian Neukirchen
2014-11-06 22:21           ` Jérémie Roquet
2014-11-07 15:06             ` Christian Neukirchen
2014-11-06 22:10         ` Axel Beckert
2014-11-06 21:57       ` Ray Andrews

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=141106104001.ZM3973@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).