feat(arje-incarnate): A5 — pivot_root + OverlayFS

Dos ChildPreExec nuevos en el hook declarativo pre-execve:
- MountOverlay { target, options } — monta OverlayFS (capa base RO +
  capa de sesión RW + workdir).
- PivotRoot { new_root, put_old, old_root_after } — bind-mount de
  new_root sobre sí mismo + pivot_root + chdir("/") + umount2 lazy
  (MNT_DETACH) del root viejo.

Builders ergonómicos en ChildSetup:
- with_overlay(lower, upper, work, merged)
- with_pivot_root(new_root, put_old_name)

Ambas ops corren en el hijo post-clone, dentro del mount namespace,
async-signal-safe (solo libc, sin allocator). Las consumirán mirada
(compositor Wayland) y matilda Ghost para rootfs aislados.

19 tests arje-incarnate verdes (3 nuevos: builders overlay/pivot).
cargo check --workspace verde. Pendiente: integration test en entorno
con namespaces reales.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
sergio
2026-05-20 00:35:31 +00:00
parent 545dd59c72
commit f8a2547b45
3 changed files with 194 additions and 3 deletions
+17 -3
View File
@@ -12,7 +12,8 @@ cgroups, y snapshot/restore del grafo.
| `arje-zero` | binario | PID 1: reap + handshake server + bus dispatcher |
| `arje-kernel` | lib | `bootstrap_kernel_surface`, subreaper, SIGCHLD/uevent |
| `arje-soma` | lib | Wrapper 44 LOC sobre `arje-incarnate` (compat API) |
| `arje-incarnate` | lib | `clone(2) + namespaces + cgroup + rlimits + cpu` |
| `arje-incarnate` | lib | `clone(2) + namespaces + cgroup + rlimits + cpu` |
| | | + `pivot_root` + OverlayFS (capa base RO + sesión RW)|
| `arje-snapshot` | lib | `FractalSnapshot` JSON: checkpoint del grafo Cards |
## Dependencias
@@ -29,8 +30,21 @@ cgroups, y snapshot/restore del grafo.
4. Para cada `genesis` child Card: `incarnate(card)` → spawn aislado.
5. Reap loop atiende SIGCHLD; bus loop atiende anuncios/invokes.
## Encarnación de rootfs aislado
`arje-incarnate` expone vía `ChildSetup` (hook pre-execve declarativo):
- `with_overlay(lower, upper, work, merged)` → monta OverlayFS:
capa base RO + capa de sesión RW + workdir.
- `with_pivot_root(new_root, put_old_name)``pivot_root` + chdir +
desmontaje lazy (`MNT_DETACH`) del root viejo.
Ambas corren en el hijo, post-clone, dentro del mount namespace,
async-signal-safe. Las consumen `mirada` (compositor) y `matilda` Ghost.
## Estado
Funciona bare metal + QEMU + initramfs (ver `docs/arje-boot.md`). LOC
~2.2K en init core. Pendiente: cobertura de tests sobre snapshot
restore en escenarios con stale fds.
~2.2K en init core. `arje-incarnate`: 19 tests verdes (incluye builders
de overlay/pivot_root). Pendiente: integration testing de pivot_root +
OverlayFS en entorno con namespaces reales; cobertura de snapshot
restore con stale fds.