From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17800 invoked by alias); 23 Feb 2015 14:15:45 -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: 34618 Received: (qmail 16101 invoked from network); 23 Feb 2015 14:15:33 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 From: Kamil Dudka To: Bart Schaefer Cc: zsh-workers@zsh.org Subject: Re: PATCH Re: deadlock in free() called from a signal handler Date: Mon, 23 Feb 2015 15:15:22 +0100 Message-ID: <2067297.ZNlDuaAVYz@kdudka.brq.redhat.com> User-Agent: KMail/4.14.4 (Linux/3.18.7-200.fc21.x86_64; KDE/4.14.4; x86_64; ; ) In-Reply-To: <150220182812.ZM11805@torch.brasslantern.com> References: <37490085.zXPQGCoLTl@kdudka.brq.redhat.com> <150219092329.ZM17912@torch.brasslantern.com> <150220182812.ZM11805@torch.brasslantern.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 On Friday 20 February 2015 18:28:12 Bart Schaefer wrote: > On Feb 19, 9:23am, Bart Schaefer wrote: > } > } In every case I can remember so far, when this happens it means that we > } ought to be using the signal queuing macros at a scope outside the call > } to the malloc library. > } [...] > } So ... per my very first remark above, it's probably worth examining the > } context in execcmd() to see if signal queuing is appropriate there, or > } if we just need it in setunderscore(). But it may also make sense to > } replace that one last malloc() and put queuing in zfree()/zsfree() too. > > (Above edited for silly typo.) > > There doesn't appear to be an appropriate scope for queuing signals in > execcmd(). However, setunderscore() and all of the functions in text.c > manipulate global state, so they should be considered non-reentrant. > > The following patch does not yet put signal queuing into zfree(), but > does wrap it around setunderscore() and the three non-static functions > in text.c, as well as replace that one remaining malloc() with zalloc(). > Hopefully this doesn't slow down execution noticeably. Thank you for the patch! We will give it a try. Kamil