[PATCH] linuxthreads/signals: Do not restore handler for invalid signal

Markos Chandras Markos.Chandras at imgtec.com
Thu Jan 5 12:12:19 UTC 2012


On 01/05/2012 11:55 AM, Markos Chandras wrote:
> Invalid signals have no handlers so when trying to restore the old
> handler to a bad signal a SIGSEGV occurs. This is because the library
> tries to store the old handler to an invalid memory area where it things
> the bad signal lives.
>
> Signed-off-by: Markos Chandras<markos.chandras at imgtec.com>
> ---
>   libpthread/linuxthreads/signals.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/libpthread/linuxthreads/signals.c b/libpthread/linuxthreads/signals.c
> index c081255..61b411a 100644
> --- a/libpthread/linuxthreads/signals.c
> +++ b/libpthread/linuxthreads/signals.c
> @@ -113,7 +113,7 @@ int __pthread_sigaction(int sig, const struct sigaction * act,
>       newactp = NULL;
>     if (__libc_sigaction(sig, newactp, oact) == -1)
>       {
> -      if (act)
> +      if (act&&  (sig>  0&&  sig<  NSIG))
>   	__sighandler[sig].old = (arch_sighandler_t) old;
>         return -1;
>       }

For some peculiar reason, the first e-mail I sent with the summary did 
not make it to the mailing list. This patch is in conjunction with bug 
https://bugs.busybox.net/show_bug.cgi?id=4640 and since I am not sure 
whether linuxthreads are maintained anymore or not, I would like to send 
this patch here for review.

-- 
markos



More information about the uClibc mailing list