Handle permission denied errors when reading mmap_min_addr#13285
Draft
anishesg wants to merge 1 commit into
Draft
Handle permission denied errors when reading mmap_min_addr#13285anishesg wants to merge 1 commit into
anishesg wants to merge 1 commit into
Conversation
The platform initialization code in `pkg/sentry/platform/mmap_min_addr.go` unconditionally panicked when unable to read `/proc/sys/vm/mmap_min_addr`, which occurs in restricted environments like Termux on Android where the file exists but is not readable by unprivileged processes. Signed-off-by: anish <anishesg@users.noreply.github.com>
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.
The platform initialization code in
pkg/sentry/platform/mmap_min_addr.gounconditionally panicked when unable to read/proc/sys/vm/mmap_min_addr, which occurs in restricted environments like Termux on Android where the file exists but is not readable by unprivileged processes.The fix handles permission denied and file-not-found errors gracefully by falling back to a default value of 65536 (64KB), which is the standard default on most modern Linux systems. Other unexpected errors still panic as before to maintain robustness on properly configured systems.
This change allows runsc to run in restricted environments without compromising behavior on standard Linux systems where the file is readable.
resolves #12544
Fixes #12544