Bug 4640

Summary: [PATCH]: linuxthreads/signals: Do not restore handler for invalid signal
Product: uClibc Reporter: Markos Chandras <hwoarang>
Component: ThreadsAssignee: unassigned
Status: RESOLVED FIXED    
Severity: minor CC: uclibc-cvs
Priority: P5    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Host: Target:
Build:
Attachments: proposed patch
Update patch including the Signed-off-by line

Description Markos Chandras 2011-12-19 10:02:42 UTC
Created attachment 3920 [details]
proposed patch

The attached patch handles invalid signal numbers in linuxthreads. Right now, when an invalid signal number is issued, libpthread does not handle it appropriately and it tries to restore the signal handler instead. However, since the sig variable can contain any number, the sighandler[sig] can easily lead to memory violation error and a SIGSEGV is thrown. The patch solves this problem by ensuring that only valid signal numbers will be handled by libpthread.
Comment 1 Markos Chandras 2011-12-19 13:13:36 UTC
Created attachment 3926 [details]
Update patch including the Signed-off-by line
Comment 2 Mike Frysinger 2012-01-05 22:48:26 UTC
use ARRAY_SIZE(__sighandler) rather than NSIG
Comment 3 Markos Chandras 2012-01-06 09:32:54 UTC
Agreed but NSIG is used everywhere in this file so either I need to replace every instant of NSIG with ARRAY_SIZE(__sighandler) or use my patch as is so there is a constant reference to the way NSIG is expressed..
Comment 4 Mike Frysinger 2012-01-15 00:35:57 UTC
not exactly a great reason for adding more bad code ;)