Fix #525, ensure POSIX stack size meets requirements#528
Merged
astrogeco merged 1 commit intonasa:integration-candidatefrom Jul 2, 2020
Merged
Conversation
skliper
reviewed
Jun 29, 2020
|
|
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
Contributor
Note I did add nasa/cFS#107 for a CI privileged run for better test coverage. |
skliper
approved these changes
Jun 30, 2020
Contributor
|
CCB 202-07-01: APPROVED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the contribution
The
pthread_attr_setstacksize()function stipulates that it may fail if the user-supplied stack size is not at leastPTHREAD_STACK_MINand also possibly a multiple of page size.This partially reverts previous PR #508 and adds back rounding up to
PTHREAD_STACK_MINand 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.