Skip to content

Restrict sysroot fallback to exclude system paths#241

Merged
jserv merged 1 commit into
sysprog21:mainfrom
open-sources-port:system-path-leaks
Jul 24, 2026
Merged

Restrict sysroot fallback to exclude system paths#241
jserv merged 1 commit into
sysprog21:mainfrom
open-sources-port:system-path-leaks

Conversation

@doanbaotrung

@doanbaotrung doanbaotrung commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

When absolute paths do not exist in the guest sysroot, translation falls back to the host literal path. For standard system directories (such as /usr, /bin, /lib, /sbin, /var, /opt, and /etc), this fallback leaks guest actions to the host.

On macOS, system directories are protected by System Integrity Protection (SIP) and root ownership, causing permission failures (EPERM/EACCES) when guest tools attempt writes or backups.

Prevent fallback for system paths. Keep fallback for network configurations like /etc/resolv.conf to support DNS resolution.

Fix #238


Summary by cubic

Restricts sysroot fallback so guest paths under system directories never escape to the host, including dot/dot-dot variants. Fixes #238 and avoids SIP permission errors on macOS while keeping DNS working.

  • Bug Fixes
    • Block fallback for system dirs (/usr, /bin, /sbin, /lib, /lib64, /var, /opt, /boot, /srv, /root, /home) and /etc except /etc/resolv.conf and /etc/hosts; allow macOS /var/folders. Normalize absolute paths to catch cases like "/tmp/../usr".
    • Enforce the system-path check in both resolve and create flows; add tests for blocked /usr and dot-component paths, and allowed /etc/hosts.

Written for commit b1e4a21. Summary will update on new commits.

Review in cubic

@doanbaotrung
doanbaotrung force-pushed the system-path-leaks branch 2 times, most recently from f929172 to 5f7bd78 Compare July 23, 2026 07:39
cubic-dev-ai[bot]

This comment was marked as resolved.

@jserv jserv changed the title Draft: Restrict sysroot fallback to exclude system paths Restrict sysroot fallback to exclude system paths Jul 23, 2026
@jserv
jserv marked this pull request as draft July 23, 2026 11:15
@doanbaotrung
doanbaotrung marked this pull request as ready for review July 23, 2026 12:12
cubic-dev-ai[bot]

This comment was marked as resolved.

Comment thread src/syscall/proc-state.c Outdated
When absolute paths do not exist in the guest sysroot, translation
falls back to the host literal path. For standard system directories
(such as /usr, /bin, /lib, /sbin, /var, /opt, and /etc), this fallback
leaks guest actions to the host.

On macOS, system directories are protected by System Integrity
Protection (SIP) and root ownership, causing permission failures
(EPERM/EACCES) when guest tools attempt writes or backups.

Prevent fallback for system paths. Keep fallback for network
configurations like /etc/resolv.conf to support DNS resolution.

Fix sysprog21#238
@jserv
jserv requested a review from Max042004 July 23, 2026 13:25
@jserv
jserv merged commit aa8f769 into sysprog21:main Jul 24, 2026
10 checks passed
@jserv

jserv commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Thank @doanbaotrung for contributing!

@doanbaotrung
doanbaotrung deleted the system-path-leaks branch July 24, 2026 07:54
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.

Guest system paths leak/escape to macOS host paths when absent in the sysroot

2 participants