-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Enabling TLS detects stack overflow in a few tests #53687
Merged
fabiobaltieri
merged 4 commits into
zephyrproject-rtos:main
from
keith-packard:test-stack-size
Jan 26, 2023
Merged
Enabling TLS detects stack overflow in a few tests #53687
fabiobaltieri
merged 4 commits into
zephyrproject-rtos:main
from
keith-packard:test-stack-size
Jan 26, 2023
Conversation
This file contains 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
keith-packard
requested review from
dcpleung,
andyross and
nashif
as code owners
January 11, 2023 04:58
zephyrbot
requested review from
aasthagr,
ceolin,
nordic-krch and
peter-mitsis
January 11, 2023 04:59
keith-packard
force-pushed
the
test-stack-size
branch
3 times, most recently
from
January 11, 2023 20:44
6a31a3a
to
e324cf3
Compare
ok, as #53590 shows, this series now gets all tests passing with TLS enabled, so this series should actually be ready to merge. |
dcpleung
previously approved these changes
Jan 11, 2023
Picolibc is enough faster than the minimal C library that the zbus benchmark will likely complete in well under 10ms on qemu_nios2. As this target cannot provide a clock at higher resolution than the system tick, we need to increase that rate to get a non-zero runtime for this benchmark. Add new nios2-specific config variables that change the CONFIG_SYS_CLOCK_TICKS_PER_SEC value, leaving all other platforms using the standard value. We cannot just increase it for every platform as qemu_arc_hs6x fails with a 1kHz rate. Signed-off-by: Keith Packard <[email protected]>
60 tasks
Enabling TLS increases stack usage by a small amount as that is where any TLS variables are stored. When enabled, this sample ends up overflowing the 512-byte subscriber task stack and the IDLE_STACK_SIZE consumer stacks Replace the fixed 512-byte subscriber stack allocation with CONFIG_MAIN_STACK_SIZE so that it adopts a value controlled by the configuration in case it needs to be adjusted further. Increased CONFIG_IDLE_STACK_SIZE to 1024 to provide more space in each consumer stack. Signed-off-by: Keith Packard <[email protected]>
This test overflows when TLS is used, provide plenty of extra space to avoid that. Signed-off-by: Keith Packard <[email protected]>
When thread local storage is enabled, log_core_additional generates stack overflows in the main thread on several architectures. Increase the stack size to 4096 bytes for this thread. Signed-off-by: Keith Packard <[email protected]>
keith-packard
force-pushed
the
test-stack-size
branch
from
January 20, 2023 02:10
e324cf3
to
7a0003a
Compare
dcpleung
approved these changes
Jan 20, 2023
ceolin
approved these changes
Jan 25, 2023
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.
Because TLS stores critical thread information at the top of each stack, overflows in subsequent stacks will write over that and cause general chaos. This means that enabling thread local storage will cause some tests to fail simply because they overflow their stacks in a way which was not detected without TLS enabled.
These three patches increase stack sizes in tests (probably by way more than necessary) to make them work when thread local storage is enabled.