Skip to content

Translate guest paths through the sysroot sidecar#242

Open
henrybear327 wants to merge 3 commits into
sysprog21:mainfrom
henrybear327:sysroot/consolidate
Open

Translate guest paths through the sysroot sidecar#242
henrybear327 wants to merge 3 commits into
sysprog21:mainfrom
henrybear327:sysroot/consolidate

Conversation

@henrybear327

@henrybear327 henrybear327 commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Consolidate the sysroot path-translation handlers so guest-visible paths are reconstructed and reverse-mapped consistently across syscalls.

Closes #233


Summary by cubic

Unifies sysroot path translation through the sidecar so all syscalls resolve and reverse-map guest paths consistently across fork/exec, networking, and inotify. Adds AF_UNIX pathname translation with safe over‑length handling, tighter loader fallback, /dev/shm no‑follow/non‑block opens, AT_EMPTY_PATH support, and a full test suite and docs.

  • New Features
    • Centralized resolver in path.c used by exec, fs/stat, inotify, and networking, with sysroot dispatch, containment, sidecar handling, a token‑aware AT_FDCWD fast path, an AT_EMPTY_PATH helper, and /dev/shm open flags (O_NOFOLLOW|O_NONBLOCK); inotify snapshots emit guest‑visible names and hide sidecar artifacts.
    • PT_INTERP and execveat share translation; loader falls back to /lib/<basename> only if the rewritten interpreter both differs and exists; execveat translates dirfd‑relative names and opens /dev/shm leaves with O_NOFOLLOW; getcwd, /proc/self/cwd, and /proc/self/exe are reverse‑mapped after fork/exec.
    • AF_UNIX pathname translation through the sysroot; over‑length sun_path is shortened via a symlink in a private absock dir shared across the forked tree; socket addresses round‑trip guest↔host across bind/connect/sendmsg/accept/recvmsg; the namespace cleans up without leaks on exit.
    • Docs and tests: added docs/sysroot.md; added the path‑translation matrix (casefold and case‑sensitive lanes) validated against a real kernel, the exec‑cwd regression test, /dev/shm execveat no‑follow test, absock cleanup test, and a sidecar state checker wired into make check.

Written for commit 6a7cc5a. Summary will update on new commits.

Review in cubic

@henrybear327 henrybear327 self-assigned this Jul 23, 2026
@henrybear327
henrybear327 requested a review from jserv July 23, 2026 11:32
cubic-dev-ai[bot]

This comment was marked as resolved.

@henrybear327
henrybear327 force-pushed the sysroot/consolidate branch 2 times, most recently from 8047c9c to a24adb1 Compare July 23, 2026 12:46
Comment thread docs/internals.md Outdated
Comment thread src/runtime/procemu.c Outdated
@henrybear327
henrybear327 force-pushed the sysroot/consolidate branch 2 times, most recently from c159700 to e446b7b Compare July 23, 2026 14:14
@henrybear327

Copy link
Copy Markdown
Collaborator Author

Documentation rewriting in progress.

@henrybear327
henrybear327 force-pushed the sysroot/consolidate branch 2 times, most recently from de568de to bb66e0a Compare July 23, 2026 15:01
@henrybear327
henrybear327 requested a review from jserv July 23, 2026 15:02
@jserv
jserv requested a review from Max042004 July 23, 2026 15:06
Comment thread src/syscall/proc-state.c Outdated
@henrybear327
henrybear327 force-pushed the sysroot/consolidate branch from bb66e0a to ee35b0d Compare July 23, 2026 15:57
@henrybear327
henrybear327 requested a review from jserv July 23, 2026 15:58
Consolidate the sysroot path-translation handlers so guest-visible
paths are reconstructed and reverse-mapped consistently across
syscalls.
Cover the sysroot translation model end to end:

- Add the sysroot path-translation matrix test and the exec-cwd
  regression test.
- Run the path matrix on a case-sensitive volume and validate it
  against a real kernel.
- Cover guest-private prefix classification, execveat /dev/shm
  nofollow, the absock namespace lifecycle, and PT_INTERP
  tokenized-parent fallback.
- Add the sidecar-state check helper.
Describe how guest paths are translated through the sysroot and
sidecar, including AF_UNIX socket addresses, and link it from the
internals and usage docs.
@henrybear327
henrybear327 force-pushed the sysroot/consolidate branch from ee35b0d to 6a7cc5a Compare July 23, 2026 16:13

@jserv jserv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase latest main branch and resolve conflicts.

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.

sysroot/sidecar path-translation gaps

2 participants