[rtems-central commit] spec: Fix stack corruption in test case
Sebastian Huber
sebh at rtems.org
Wed Dec 22 15:24:14 UTC 2021
Module: rtems-central
Branch: master
Commit: 446c5d945c5d4db83666c240c71aa0b8591debf1
Changeset: http://git.rtems.org/rtems-central/commit/?id=446c5d945c5d4db83666c240c71aa0b8591debf1
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Dec 22 11:40:13 2021 +0100
spec: Fix stack corruption in test case
---
spec/rtems/task/req/delete.yml | 17 ++++++++++++++++-
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 4c886ab..76d60ff 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 813ecf9..1318aaa 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
+ );
}
}
More information about the vc
mailing list