The size of the reserved TLS space is not guaranteed to adhere to stack
alignment requirements which can cause stack_end to become misaligned.
This enforces the alignment of stack_end.
---
cpukit/score/src/threadinitialize.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cpukit/score/src/threadinitialize.c
b/cpukit/score/src/threadinitialize.c
index 05c30c3d43..ad5dccbbb2 100644
--- a/cpukit/score/src/threadinitialize.c
+++ b/cpukit/score/src/threadinitialize.c
@@ -108,6 +108,10 @@ bool _Thread_Initialize(
( ( (uintptr_t) stack_end + tls_align - 1 ) & ~( tls_align - 1 ) );
}
+ /* Enforce stack alignment */
+ stack_end = (char *)((uintptr_t) stack_end &
+ ~( (uintptr_t) CPU_STACK_ALIGNMENT - 1 ));
+
_Stack_Initialize(
&the_thread->Start.Initial_stack,
stack_begin,
--
2.20.1
_______________________________________________
devel mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/devel