bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: core dump in torture test


From: Lucas Gonze
Subject: Re: core dump in torture test
Date: Sat, 19 Oct 2002 17:39:11 -0400 (EDT)

> If malloc is interrupted, and the signal handler uses malloc, there's no
> guarantee that malloc will function properly.  The same applies to stdio
> and other things that operate on data in the user space.  Sometimes it
> works, sometimes it doesn't.  (I'd like it to work all the time - back
> 15 years ago when I first was interested in sigwinch, it seemed to work
> just fine using malloc in a signal handler, but that was BSD 4.3).

Got it.  Yeah, I was thinking of the same thing when I said that 
problems with reentrant code called by a signal handler is less of a bug 
than problems with repeated creation and deletion.

But note the signal handler itself, which clears itself during an 
invocation.  The OS would have to invoke winchange_handler and switch 
away before executing the first line of it:

void winchange_handler(int signo){

  signal(SIGCHLD, SIG_IGN);
  if( victim == NULL )
    // not initialized yet, so there's no window to change
    return;

  victim->recalc_window();
  signal(SIGWINCH, winchange_handler);
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]