Bug 4640 - [PATCH]: linuxthreads/signals: Do not restore handler for invalid signal
Summary: [PATCH]: linuxthreads/signals: Do not restore handler for invalid signal
Status: RESOLVED FIXED
Alias: None
Product: uClibc
Classification: Unclassified
Component: Threads (show other bugs)
Version: unspecified
Hardware: PC Linux
: P5 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 10:02 UTC by Markos Chandras
Modified: 2012-01-15 00:35 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
proposed patch (1.05 KB, application/octet-stream)
2011-12-19 10:02 UTC, Markos Chandras
Details
Update patch including the Signed-off-by line (1.11 KB, patch)
2011-12-19 13:13 UTC, Markos Chandras
Details

Note You need to log in before you can comment on or make changes to this bug.
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 ;)