infinite recursion in sbrk()/abort()

Jeff Johnston jjohnstn@redhat.com
Thu Nov 1 02:01:00 GMT 2007


DJ Delorie wrote:
>> Maybe _raise_r() shouldn't try to initialize the tables, but instead
>> assume SIG_DFL if the table is missing?
>>     
>
> Maybe like this?
>
> 	* libc/signal/signal.c (_raise_r): Avoid potential recursion
> 	from calling malloc() while in a signal.
>   

Looks fine.  Feel free to check it in.

-- Jeff J.
> Index: signal.c
> ===================================================================
> RCS file: /cvs/src/src/newlib/libc/signal/signal.c,v
> retrieving revision 1.5
> diff -p -U3 -r1.5 signal.c
> --- signal.c	28 Oct 2005 21:21:07 -0000	1.5
> +++ signal.c	30 Oct 2007 21:29:19 -0000
> @@ -154,10 +154,11 @@ _DEFUN (_raise_r, (ptr, sig),
>        return -1;
>      }
>  
> -  if (ptr->_sig_func == NULL && _init_signal_r (ptr) != 0)
> -    return -1;
> -  
> -  func = ptr->_sig_func[sig];
> +  if (ptr->_sig_func == NULL)
> +    func = SIG_DFL;
> +  else
> +    func = ptr->_sig_func[sig];
> +
>    if (func == SIG_DFL)
>      return _kill_r (ptr, _getpid_r (ptr), sig);
>    else if (func == SIG_IGN)
>   



More information about the Newlib mailing list