-
Notifications
You must be signed in to change notification settings - Fork 217
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 #525, ensure POSIX stack size meets requirements #528
Fix #525, ensure POSIX stack size meets requirements #528
Conversation
|
The pthread_attr_setstacksize() function stipulates that it may fail if the user-supplied stack size is not at least PTHREAD_STACK_MIN and also possibly a multiple of page size. This partially reverts previous PR nasa#508 and adds back rounding up to PTHREAD_STACK_MIN and also adds rounding up to a system page size. However the check for zero stack still remains at the shared level so attempts to create a task with zero stack will still fail. This allows internal helper threads to be created with a default minimum stack size, however.
85f734d
to
43c48b2
Compare
Note I did add nasa/cFS#107 for a CI privileged run for better test coverage. |
CCB 202-07-01: APPROVED |
Describe the contribution
The
pthread_attr_setstacksize()
function stipulates that it may fail if the user-supplied stack size is not at leastPTHREAD_STACK_MIN
and also possibly a multiple of page size.This partially reverts previous PR #508 and adds back rounding up to
PTHREAD_STACK_MIN
and also adds rounding up to a system page size. However the check for zero stack still remains at the shared level so attempts to create a task with zerostack will still fail. This allows internal helper threads to be created with a default minimum stack size, however.
Fixes #525
Testing performed
Build and sanity check CFE executing as both normal user and root user.
Execute all unit tests as both normal user and root user.
Expected behavior changes
No failure due to stack size not meeting system requirements.
System(s) tested on
Ubuntu 20.04, running as normal user.
CentOS 8.1 in VM running as root user.
Additional context
This also moves the
pthread_attr_setstacksize()
call such that it is configured regardless of whether task priorities are enabled nor not (i.e. non root user). The normal user should still be able to configure the stack size even if they lack permission to set scheduling priority.Also confirmed that by moving the call to
pthread_attr_setstacksize()
that the original bug report is reproducible in a non-root environment - which is also fixed by this change.Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.