mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-14 20:05:27 +08:00
testsuites/validation: fix setjmp UB
Storing the return value of setjmp to a local variable is undefined behavior. Fixes #5373.
This commit is contained in:
@@ -777,19 +777,15 @@ static void Signal( rtems_signal_set signals )
|
|||||||
if ( ctx->interrupt || ctx->nested_request ) {
|
if ( ctx->interrupt || ctx->nested_request ) {
|
||||||
if ( ctx->blocked ) {
|
if ( ctx->blocked ) {
|
||||||
SetFatalHandler( ResumeThreadDispatch, ctx );
|
SetFatalHandler( ResumeThreadDispatch, ctx );
|
||||||
cpu_self = _Thread_Dispatch_disable();
|
(void) _Thread_Dispatch_disable();
|
||||||
|
|
||||||
int jumped = setjmp( ctx->thread_dispatch_context );
|
if ( setjmp( ctx->thread_dispatch_context ) == 0 ) {
|
||||||
|
|
||||||
/* cpu_self can be clobbered by setjmp/longjmp, so reload it */
|
|
||||||
cpu_self = _Per_CPU_Get();
|
|
||||||
|
|
||||||
if ( jumped == 0 ) {
|
|
||||||
Block( ctx );
|
Block( ctx );
|
||||||
} else {
|
} else {
|
||||||
_Thread_Dispatch_unnest( cpu_self );
|
_Thread_Dispatch_unnest( _Per_CPU_Get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cpu_self = _Per_CPU_Get();
|
||||||
if ( ctx->interrupt ) {
|
if ( ctx->interrupt ) {
|
||||||
CallWithinISR( Restart, ctx );
|
CallWithinISR( Restart, ctx );
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user