Skip to content

feat(#43): per-job tmp isolation β€” sandbox binds only the job's own directory - #103

Merged
MicBur merged 1 commit into
mainfrom
feat/43-per-job-tmp-isolation
Aug 4, 2026
Merged

MicBur merged 1 commit into
mainfrom
feat/43-per-job-tmp-isolation

Conversation

@MicBur

@MicBur MicBur commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Closes the remaining #43 item. The sandbox previously had to expose all of /tmp read-write, because the object file lived beside the job dir and the compiler wrote its intermediates (cc*.s) there β€” so two concurrent jobs on one worker could see and clobber each other's scratch files.

Now: the object lives at <job_dir>/suco_out.o and TMPDIR points at the job dir, so the sandbox binds only that one directory (bwrap --bind <job_dir>, unshare equivalent).

Verified on node3 (g++ 15.2), with the exact command the code now generates:

Check Result
Compile with only job_dir writable βœ… rc=0, object produced
Object vs unsandboxed reference βœ… byte-identical (138 640 B)
Writing to /tmp (negative control) βœ… "Read-only file system" β€” isolation holds

Moving the object is byte-safe: the -o path is not embedded in the output (verified separately for -O2 and -g), which is also why grid objects were already deterministic despite randomised temp names.

Linux build clean (0 errors); the non-sandboxed path is unchanged apart from where the object is written, and remove_all(job_dir) already cleans it up.

πŸ€– Generated with Claude Code

…irectory

The sandbox had to expose all of /tmp read-write because the object file lived
beside the job dir and the compiler wrote its intermediates there. Both now live
INSIDE the job dir (object at <job_dir>/suco_out.o, TMPDIR set to the job dir), so
the sandbox binds only that one directory. Concurrent jobs on a worker can no
longer see or clobber each other's scratch files.

The -o path is not embedded in the object (verified on g++ 15.2 for -O2 and -g), so
this moves no output bytes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@MicBur
MicBur merged commit 9dee7ad into main Aug 4, 2026
8 checks passed
@MicBur
MicBur deleted the feat/43-per-job-tmp-isolation branch August 4, 2026 07:02
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.

1 participant