Add Per-Thread stack guard overflow check#361
Merged
han-jiang277 merged 2 commits intovivoblueos:mainfrom Mar 16, 2026
Merged
Conversation
Contributor
Author
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22993852808. |
|
❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/22993852808. |
Contributor
Author
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/22994193994. |
|
✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/22994193994. |
han-jiang277
approved these changes
Mar 16, 2026
han-jiang277
pushed a commit
to han-jiang277/kernel
that referenced
this pull request
Mar 19, 2026
```
/// ------------------------------ <--- stack.top() == allocated buffer end
/// | optional align gap (0..A) |
/// ------------------------------
/// | Context for current thread |
/// ------------------------------ <--- saved_sp (initial SP)
/// | stack region | (stack grows down)
/// | ... |
/// ------------------------------ <--- guard upper bound (if enabled)
/// | stack guard region | (optional, usually no-access)
/// ------------------------------ <--- stack.base()
```
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.
This PR adds per-thread MPU stack-guard switching support for Cortex-M and completes the related validation/documentation.
What changed
update_thread_stack_guard(next).stack_base.kernel/src/lib.rsto verify that writing into a thread stack guard triggers MemManage.thread::initto clarify guard placement and fault behavior when SP is near/in guard on exception entry.Verification
Executed and passed:
ninja -C out/qemu_mps3_an547.debug kernel/kernel:run_unittestninja -C out/qemu_mps3_an547.debug check_allRelevant tests passing include:
test_mpu_sys_stack_guard_write_faulttest_mpu_thread_stack_guard_write_fault