Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [BUG] malloc inside signal handler
- X-seq: zsh-workers 49224
- From: zsugabubus <zsugabubus@national.shitposting.agency>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [BUG] malloc inside signal handler
- Date: Sat, 31 Jul 2021 22:25:47 +0200
- Archived-at: <https://zsh.org/workers/49224>
- In-reply-to: <CAH+w=7YaKruWbbROqsi09KVNyv38wWgk8c+6wwk4NL4x64n=UQ@mail.gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20210724225048.ly7qpdvi55j3h5mi@localhost> <CAH+w=7YaKruWbbROqsi09KVNyv38wWgk8c+6wwk4NL4x64n=UQ@mail.gmail.com>
On Fri, Jul 30, 2021 at 06:33:08PM -0700, Bart Schaefer wrote:
> Under what circumstances are you generating this error?
I had the crash with the following command:
zsh -c ". hashes.zsh; print ~dir"
that was being executed inside $TERMINAL -e so that explains SIGWINCH.
(hashes.zsh contains a few hash -d lines.)
Unfortunately, I could not find any way to reproduce this again, even
though I call it a few hundred times a day.
However, looking at the stack trace it seems straightforward (for me)
what's going on:
shingetline() calls winch_unblock() and dont_queue_signals() so fgetc()
can be interrupted at any time.
$ gdb zsh -ex 'b input.c:153' -ex 'r' -ex 'b adjustwinsize' -ex 'signal SIGWINCH' -ex 'bt'
Just to make sure, it confirms that SIGWINCH can be handled around
fgetc(), maybe during a memory allocation inside it so if
adjustwinsize() also uses malloc() that can be fatal.
--
zsugabubus
Messages sorted by:
Reverse Date,
Date,
Thread,
Author