zsh-workers
 help / color / mirror / code / Atom feed
From: "Antoine C." <acalando@free.fr>
To: Zsh Workers List <zsh-workers@zsh.org>
Subject: [BUG] Crash due to malloc call in signal handler
Date: Thu, 12 Dec 2019 19:28:59 +0100 (CET)	[thread overview]
Message-ID: <2022943386.989309814.1576175339554.JavaMail.root@zimbra62-e11.priv.proxad.net> (raw)

Hello,

I finally found the cause of the frequent crashes I reported one
year ago ( https://www.zsh.org/mla/workers/2019/msg00059.html ).

This is due to malloc calls from signal handler, for instance:

#0  tcache_get (tc_idx=17) at malloc.c:2943
#1  __GI___libc_malloc (bytes=296) at malloc.c:3050
#2  0x000055c2217b27b5 in malloc (size=8) at ./main.c:255
#3  0x000055c2218166f9 in zalloc (size=8) at mem.c:966
#4  0x000055c221806da2 in addbgstatus (pid=11959, status=0) at jobs.c:2192
#5  0x000055c2218478e7 in wait_for_processes () at signals.c:583
#6  0x000055c221847cdc in zhandler (sig=17) at signals.c:648
#7  <signal handler called>
#8  0x00007f8895b69209 in __GI___sigsuspend (set=0x7ffe759b7160) at ../sysdeps/unix/sysv/linux/sigsuspend.c:26
#9  0x000055c221847376 in signal_suspend (sig=17, wait_cmd=1) at signals.c:393
#10 0x000055c2218054e8 in waitforpid (pid=11953, wait_cmd=1) at jobs.c:1551
#11 0x000055c221807a10 in bin_fg (name=0x7f8896af4798 "wait", argv=0x7f8896af4830, ops=0x7ffe759b75c0, func=4) at jobs.c:2371

All the backtraces I get does not always show a signal, and I 
get a lot a various errors occuring either in a malloc or a free;
however, I have been debugging this problem by enabling mcheck(),
and in this very case, all the crashes occur within freehook() 
and when tracing back the associated malloc() I can find it 
always occurs during double interlaced malloc() calls from the
main and signal contexts.

I can provide more info to reproduce the problem.

Antoine

             reply	other threads:[~2019-12-12 18:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20191212182957epcas5p48645aa560e781ac1c34f00662a6d6176@epcas5p4.samsung.com>
2019-12-12 18:28 ` Antoine C. [this message]
2019-12-13  9:40   ` Peter Stephenson
2019-12-13  9:45     ` Roman Perepelitsa
2019-12-13 10:16       ` Peter Stephenson
2019-12-13 10:19         ` Roman Perepelitsa
2019-12-13 10:31           ` Peter Stephenson

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=2022943386.989309814.1576175339554.JavaMail.root@zimbra62-e11.priv.proxad.net \
    --to=acalando@free.fr \
    --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).