Repository navigation
Commit c99a45a
committed
fix(vm): make sandbox process startup fork-safe
Prepare executable paths, named identities, supplementary groups,
Landlock handles, and runtime seccomp programs in the supervisor before
fork. Entrypoint and SSH pre-exec hooks now consume prepared numeric
state and keep their successful path to the required namespace,
credential, hardening, Landlock, seccomp-install, and exec syscalls.
Direct Linux setgroups/setresgid/setresuid calls avoid libc setxid
coordination, while static error markers avoid tracing and formatting in
the child.
This removes NSS, initgroups, PATH search, filter compilation, and
allocator-backed seccomp cleanup from the multithreaded post-fork child.
It fixes the supervisor spawn deadlock that left VM clients waiting
indefinitely before a process PID could be published.
Also mirror the selected lower root filesystem owner and mode onto the
VM overlay upper root before mounting it. The overlay upper directory
had inherited the host umask and UID, exposing the merged guest root as
mode 0700 and causing the named sandbox identity to fail exec with
EACCES after the original deadlock was removed.
Add regressions for parent-side executable and identity resolution,
supplementary-group preservation, SSH hook preparation, and overlay root
metadata ordering. Update the sandbox architecture and security
enforcement-order documentation.
Validated with workspace pre-commit, complete process-supervisor and
VM-driver unit suites, VM smoke/host-gateway/resume E2E, and a
named-identity interactive PTY relay held open for more than 45 seconds.
This was debugged and tested on a Ubuntu 26.04 AMD64 box.
Config:
```
$ cat ~/.config/openshell/gateway.toml
[openshell.gateway]
compute_drivers = ["vm"]
log_level = "debug"
[openshell.drivers.vm]
mem_mib = 4096
vcpus = 2
```
Before:
```
$ openshell sandbox create --name demo-fixed
✓ Sandbox allocated (0s) ✓ Sandbox allocated (0s) ✓ Sandbox allocated (0s) ✓ Sandbox allocated (0s)
✓ Sandbox allocated (0s)
⠚ Starting sandbox... Waiting for VM supervisor (2m) # gets stuck
✗ sandbox provisioning timed out after 300s. Last reported status: Starting: VM is starting
```
After:
```
$ time openshell sandbox create --name demo-fixed
Created sandbox: demo-fixed ✓ Sandbox allocated (0s)
✓ Sandbox allocated (0s) ✓ Sandbox allocated (0s) ✓ Sandbox allocated (0s) sandbox@demo-fixed:~$
exit
real 0m1.832s
```
Fixes NVIDIA#2587
Signed-off-by: Dhiru Kholia <[email protected]>1 parent 4cb77a9 commit c99a45a
8 files changed
Lines changed: 629 additions & 183 deletions
File tree
- architecture
- crates
- openshell-driver-vm
- scripts
- src
- openshell-supervisor-process/src
- sandbox/linux
- docs/security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
24 | 38 | | |
25 | 39 | | |
26 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
273 | 281 | | |
274 | 282 | | |
275 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
362 | 363 | | |
363 | 364 | | |
364 | 365 | | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 366 | + | |
| 367 | + | |
370 | 368 | | |
371 | 369 | | |
372 | 370 | | |
| |||
948 | 946 | | |
949 | 947 | | |
950 | 948 | | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
951 | 968 | | |
952 | 969 | | |
953 | 970 | | |
| |||
0 commit comments