diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-22 11:40:13 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-12-22 13:36:39 +0100 |
commit | 446c5d945c5d4db83666c240c71aa0b8591debf1 (patch) | |
tree | 83b468db25b718ed97e6dbecff752e2ea9a128be | |
parent | spec: Clear pending events after test case (diff) | |
download | rtems-central-446c5d945c5d4db83666c240c71aa0b8591debf1.tar.bz2 |
spec: Fix stack corruption in test case
-rw-r--r-- | spec/rtems/task/req/delete.yml | 17 | ||||
-rw-r--r-- | spec/rtems/task/req/restart.yml | 19 |
2 files changed, 33 insertions, 3 deletions
diff --git a/spec/rtems/task/req/delete.yml b/spec/rtems/task/req/delete.yml index 4c886abe..76d60ff6 100644 --- a/spec/rtems/task/req/delete.yml +++ b/spec/rtems/task/req/delete.yml @@ -512,6 +512,12 @@ test-context: member: | rtems_id mutex_id - brief: | + This member provides an event set used to set up the blocking conditions of + the task to delete. + description: null + member: | + rtems_event_set events +- brief: | This member contains the identifier of the worker task. description: null member: | @@ -901,7 +907,16 @@ test-support: | ObtainMutexTimed( ctx->mutex_id, ticks ); ctx->worker_is_mutex_owner = true; } else { - (void) ReceiveAnyEventsTimed( ticks ); + /* + * Do not use a stack variable for the event set, since we may jump out + * of the directive call. + */ + (void) rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_EVENT_ANY | RTEMS_WAIT, + ticks, + &ctx->events + ); } } diff --git a/spec/rtems/task/req/restart.yml b/spec/rtems/task/req/restart.yml index 813ecf97..1318aaa5 100644 --- a/spec/rtems/task/req/restart.yml +++ b/spec/rtems/task/req/restart.yml @@ -691,6 +691,12 @@ test-context: member: | rtems_id mutex_id - brief: | + This member provides an event set used to set up the blocking conditions of + the task to restart. + description: null + member: | + rtems_event_set events +- brief: | This member contains the identifier of the worker task. description: null member: | @@ -1012,7 +1018,7 @@ test-support: | } } - static void Block( const Context *ctx ) + static void Block( Context *ctx ) { rtems_interval ticks; @@ -1025,7 +1031,16 @@ test-support: | if ( ctx->enqueued ) { ObtainMutexTimed( ctx->mutex_id, ticks ); } else { - (void) ReceiveAnyEventsTimed( ticks ); + /* + * Do not use a stack variable for the event set, since we may jump out + * of the directive call. + */ + (void) rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_EVENT_ANY | RTEMS_WAIT, + ticks, + &ctx->events + ); } } |