Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] Crash due to malloc call in signal handler



On Fri, Dec 13, 2019 at 11:17 AM Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
>
> On Fri, 2019-12-13 at 10:45 +0100, Roman Perepelitsa wrote:
> > On Fri, Dec 13, 2019 at 10:40 AM Peter Stephenson
> > <p.stephenson@xxxxxxxxxxx> wrote:
> > >
> > > The main shell is suspended, waiting for a child to finish, so the fact
> > > it's in the signal handler isn't saying anything.
> > >
> > > From the look of it, some memory corruption must already have occurred
> > > at this point to get the malloc to fail.
> > malloc is not async signal safe. It's illegal to call it from a signal
> > handler. I'm not saying this is what's causing a crash.
>
> In zsh, this is handled by queuing interrupts and only allowing them to
> run in a few places in the code.  Obviously, waiting for a child to
> exit is one of those places.

The stack trace shows malloc being called zhandler. zhandler is a
signal handler. What am I missing?

Roman.



Messages sorted by: Reverse Date, Date, Thread, Author