You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I performed a cursory search to see if the bug report is relevant, not redundant, nor in conflict with other tickets.
Describe the bug
This is strictly speaking not a real bug but for me it "looks" more like a bug than a feature request.
The function UT_CallTaskPipe() stores the 32kiB object shown below on the stack. In RTEMS the stack size is fix and does not grow. Moreover, stacks are usually configured small as real time systems have often limited RAM. For example, osal/src/bsp/pc-rtems/src/bsp_start.c configures CONFIGURE_INIT_TASK_STACK_SIZE (20 * 1024). Hence the recommendation is not to put large objects on the stack.
cfe/modules/core_private/ut-stubs/src/ut_support.c:239:
union
{
CFE_SB_Buffer_t Buf;
uint8 Bytes[CFE_MISSION_SB_MAX_SB_MSG_SIZE];
} SBBuf;
I found this issue when some cFS tests unexpectedly crashed. I know, one simply needs to enlarge the stack size to circumvent this problem. Yet, I think it would be better to change the code to avoid putting 32kiB on the stack in the first place - especially given the fact that the stack bsp_start.c configures is too small for this object and finding the cause of the crash tasks some time.
To Reproduce
Steps to reproduce the behavior:
This is some issue difficult to reproduce. In my case some coverage-*-tests crashed when compiled with -O2 but passed when compiled with -O0.
To see the size of the object, add the following line into the code of the function UT_CallTaskPipe() of file cfe/modules/core_private/ut-stubs/src/ut_support.c and run the test coverage-es-ALL-testrunner.exe:
printf("SBBuf size: %zd\n", sizeof(SBBuf));
You can use the RTEMS Stack Bounds Checker (https://docs.rtems.org/branches/master/c-user/stack_bounds_checker.html) but use a stack size of more then 40KiB. It looks like even the Stack Bounds Checker gets confused when the stack is way too small (apparently UT_CallTaskPipe() uses only a small part of the 32KiB object).
Expected behavior
I suggest to avoid putting the local variable SBBuf of function UT_CallTaskPipe() on the stack and find a better solution.
Code snips
See above.
System observed on:
OS: RTEMS 6
Architecture: ARM
BSP: xilinx_zynq_a9_qemu
Compiled with -O2
Tests executed with QEMU
Additional context
I will not provide a patch because I do not foresee whether you consider this a bug in the first place and what an expert for this part of the code will advise as an appropriate way to prevent this issue.
In case you think this is not a bug, just close this issue. I fully understand that setting an appropriate stack size is in the responsibility of the RTEMS developer.
Reporter Info
Frank Kuehndel, embedded brains
The text was updated successfully, but these errors were encountered:
Checklist (Please check before submitting)
Describe the bug
This is strictly speaking not a real bug but for me it "looks" more like a bug than a feature request.
The function
UT_CallTaskPipe()
stores the 32kiB object shown below on the stack. In RTEMS the stack size is fix and does not grow. Moreover, stacks are usually configured small as real time systems have often limited RAM. For example,osal/src/bsp/pc-rtems/src/bsp_start.c
configuresCONFIGURE_INIT_TASK_STACK_SIZE (20 * 1024)
. Hence the recommendation is not to put large objects on the stack.I found this issue when some cFS tests unexpectedly crashed. I know, one simply needs to enlarge the stack size to circumvent this problem. Yet, I think it would be better to change the code to avoid putting 32kiB on the stack in the first place - especially given the fact that the stack
bsp_start.c
configures is too small for this object and finding the cause of the crash tasks some time.To Reproduce
Steps to reproduce the behavior:
This is some issue difficult to reproduce. In my case some
coverage-*-tests
crashed when compiled with-O2
but passed when compiled with-O0
.To see the size of the object, add the following line into the code of the function
UT_CallTaskPipe()
of filecfe/modules/core_private/ut-stubs/src/ut_support.c
and run the testcoverage-es-ALL-testrunner.exe
:printf("SBBuf size: %zd\n", sizeof(SBBuf));
You can use the RTEMS Stack Bounds Checker (https://docs.rtems.org/branches/master/c-user/stack_bounds_checker.html) but use a stack size of more then 40KiB. It looks like even the Stack Bounds Checker gets confused when the stack is way too small (apparently
UT_CallTaskPipe()
uses only a small part of the 32KiB object).Expected behavior
I suggest to avoid putting the local variable
SBBuf
of functionUT_CallTaskPipe()
on the stack and find a better solution.Code snips
See above.
System observed on:
-O2
Additional context
I will not provide a patch because I do not foresee whether you consider this a bug in the first place and what an expert for this part of the code will advise as an appropriate way to prevent this issue.
In case you think this is not a bug, just close this issue. I fully understand that setting an appropriate stack size is in the responsibility of the RTEMS developer.
Reporter Info
Frank Kuehndel, embedded brains
The text was updated successfully, but these errors were encountered: