Skip to content

Handle permission denied errors when reading mmap_min_addr#13285

Draft
anishesg wants to merge 1 commit into
google:masterfrom
proudhare:fix/ph-issue-12544
Draft

Handle permission denied errors when reading mmap_min_addr#13285
anishesg wants to merge 1 commit into
google:masterfrom
proudhare:fix/ph-issue-12544

Conversation

@anishesg
Copy link
Copy Markdown

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.

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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Doesn't work in Termux on Android

1 participant