Harden ARCH_SET_FS against invalid FS base#994
Open
sangho2 wants to merge 4 commits into
Open
Conversation
added 2 commits
July 1, 2026 20:01
wdcui
approved these changes
Jul 2, 2026
wdcui
left a comment
Member
There was a problem hiding this comment.
LGTM. GPT-5.5 found the following two potential issues:
- High — invalid clone(CLONE_SETTLS) can still panic
litebox_shim_linux/src/syscalls/process.rs:1635 calls sys_arch_prctl(...).unwrap() for clone TLS setup. With this PR, invalid user-controlled TLS
now returns RegisterUnpermittedValue , so clone can panic after thread creation instead of returning EPERM . Validate tls in do_clone before
spawning, or propagate the error instead of unwrapping. - Medium — FS base limit rejects valid Linux values
litebox_common_linux/src/lib.rs:3218 uses USER_ADDR_END , which excludes the final low-canonical guard page for RIP/RSP. Linux ARCH_SET_FS
rejects addr >= TASK_SIZE_MAX ; FS base does not need to be an executable/stack address. This over-rejects values in the final canonical user page.
Use a dedicated FS-base/task-size limit instead of USER_ADDR_END .
Member
|
@jaybosamiya-ms you should probably take a look at this PR as well since you worked on this part of the code. |
Contributor
Author
|
|
🤖 SemverChecks 🤖 No breaking API changes detected Note: this does not mean API is unchanged, or even that there are no breaking changes; simply, none of the detections triggered. |
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 hardens
ARCH_SET_FSagainst invalid FS base values including kernel addresses and non-canonical values. Non-canonical values are particularly dangerous because they can result in a GP fault. This PR checks the value before writing it to the register.