diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-05 06:58:16 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-04-06 09:08:21 +0200 |
commit | 8b922aafc724e1d3fbcf3ad8bd75e91646356551 (patch) | |
tree | 860379fc5fcbe84d52909385d5da7b1c18d46efe /cpukit/posix/src | |
parent | posix: Make _POSIX_signals_Check_signal() static (diff) | |
download | rtems-8b922aafc724e1d3fbcf3ad8bd75e91646356551.tar.bz2 |
posix: Fix _POSIX_signals_Check_signal()
Do not save and restore the thread wait information. This is
superfluous and may overwrite thread wait information updates due to
interrupts leading to system corruption.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/psignal.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/cpukit/posix/src/psignal.c b/cpukit/posix/src/psignal.c index 354fb33adb..6e18e05cc2 100644 --- a/cpukit/posix/src/psignal.c +++ b/cpukit/posix/src/psignal.c @@ -113,10 +113,8 @@ static void _POSIX_signals_Check_signal( bool is_global ) { - siginfo_t siginfo_struct; - sigset_t saved_signals_unblocked; - Thread_Wait_information stored_thread_wait_information; - Thread_Control *executing; + siginfo_t siginfo_struct; + sigset_t saved_signals_unblocked; if ( ! _POSIX_signals_Clear_signals( api, signo, &siginfo_struct, is_global, true, true ) ) @@ -143,16 +141,6 @@ static void _POSIX_signals_Check_signal( saved_signals_unblocked = api->signals_unblocked; api->signals_unblocked &= ~_POSIX_signals_Vectors[ signo ].sa_mask; - executing = _Thread_Get_executing(); - - /* - * We have to save the blocking information of the current wait queue - * because the signal handler may subsequently go on and put the thread - * on a wait queue, for its own purposes. - */ - memcpy( &stored_thread_wait_information, &executing->Wait, - sizeof( stored_thread_wait_information )); - /* * Here, the signal handler function executes */ @@ -170,12 +158,6 @@ static void _POSIX_signals_Check_signal( } /* - * Restore the blocking information - */ - memcpy( &executing->Wait, &stored_thread_wait_information, - sizeof( executing->Wait )); - - /* * Restore the previous set of unblocked signals */ api->signals_unblocked = saved_signals_unblocked; @@ -211,6 +193,15 @@ void _POSIX_signals_Action_handler( return; /* + * In case the executing thread is blocked or about to block on something + * that uses the thread wait information, then this is a kernel bug. + */ + _Assert( + ( _Thread_Wait_flags_get( executing ) + & ( THREAD_WAIT_STATE_BLOCKED | THREAD_WAIT_STATE_INTEND_TO_BLOCK ) ) == 0 + ); + + /* * If we invoke any user code, there is the possibility that * a new signal has been posted that we should process so we * restart the loop if a signal handler was invoked. |