-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #2516, propagate stack pointer for child tasks #2517
Conversation
Related OSAL issue is fixed in nasa/osal#1450 (dependency) |
CFE_ES_ExitChildTask(); | ||
} | ||
|
||
void TestCreateChildWithStack(void) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion Note test
#define UT_LOCAL_STACK_SIZE 4096 | ||
static unsigned long UT_LOCAL_STACK[UT_LOCAL_STACK_SIZE]; | ||
|
||
void TestCheckStackPointer(void) |
Check notice
Code scanning / CodeQL-coding-standard
Long function without assertion Note test
Checked the failure reported in the workflows -- confirmed that it is the newly added test, and it should be fixed by the linked OSAL PR. |
* NOTE: The custom stack does not work on RTEMS, test is disabled on that platform | ||
* for the time being (custom stack may be deprecated in future CFE release). | ||
*/ | ||
#ifndef _RTEMS_OS_ |
Check notice
Code scanning / CodeQL-coding-standard
Conditional compilation Note test
50eb286
to
0eaba4d
Compare
Update CFE_ES_CreateChildTask to propagate the user-supplied stack pointer to the underlying OS_TaskCreate call. Also adds a functional test to check that the memory address of a local variable within a child task resides within the expected stack buffer. NOTE: this requires an additional fix to POSIX OSAL to make it work on that platform.
0eaba4d
to
5dc12a7
Compare
Pushed the same content in new commit, in order to re-run workflows. |
*Combines:* cFE equuleus-rc1+dev104 to_lab equuleus-rc1+dev48 ci_lab equuleus-rc1+dev61 sample_app equuleus-rc1+dev40 **Includes:** *cFE* - nasa/cFE#2517 *to_lab* - nasa/to_lab#194 *ci_lab* - nasa/ci_lab#177 *sample_app* - nasa/sample_app#229 Co-authored by: Joseph Hickey <[email protected]>
*Combines:* cFE equuleus-rc1+dev107 to_lab equuleus-rc1+dev48 ci_lab equuleus-rc1+dev61 sample_app equuleus-rc1+dev40 **Includes:** *cFE* - nasa/cFE#2517 - nasa/cFE#2527 *to_lab* - nasa/to_lab#194 *ci_lab* - nasa/ci_lab#177 *sample_app* - nasa/sample_app#229 Co-authored by: Joseph Hickey <[email protected]>
*Combines:* cFE equuleus-rc1+dev107 to_lab equuleus-rc1+dev48 ci_lab equuleus-rc1+dev61 sample_app equuleus-rc1+dev40 **Includes:** *cFE* - nasa/cFE#2517 - nasa/cFE#2527 *to_lab* - nasa/to_lab#194 *ci_lab* - nasa/ci_lab#177 *sample_app* - nasa/sample_app#229 Co-authored by: Joseph Hickey <[email protected]>
Checklist (Please check before submitting)
Describe the contribution
Update CFE_ES_CreateChildTask to propagate the user-supplied stack pointer to the underlying OS_TaskCreate call. Also adds a functional test to check that the memory address of a local variable within a child task resides within the expected stack buffer.
NOTE: this requires an additional fix to POSIX OSAL to make it work on that platform.
Fixes #2516
Testing performed
Build and run all tests
Expected behavior changes
CFE Child tasks created will adhere to passed-in stack pointer.
System(s) tested on
Debian, RTEMS
Additional context
The newly added functional test will fail on POSIX due to a similar bug in the OS_TaskCreate() implementation. This didn't propagate the stack pointer, either.
The biggest risk with "fixing" this is that it might expose stack size problems that were otherwise hidden. Many apps use very small stack sizes for child tasks, and on POSIX (at least Linux/Glibc) it puts TLS storage in the stack buffer. This TLS takes about 10kB off the top of the stack. If the entire stack was only 4kB, this is now a problem. It was hidden because POSIX created a stack anyway, and when it created the stack it was at least 16kB. But by fixing that problem, the stack size really will be only 4kB, and thus not be big enough, and memory corruption will result.
Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.