Add Linux arm64 sandbox runtime support#19
Conversation
Introduce architecture-specific syscall numbers, audit arch values, and optional legacy path syscall constants so the seccomp filters and dispatch tables build on arm64 while preserving x86_64 behavior. Signed-off-by: gokwok <531504879@qq.com>
Make the rootfs helper compile on architectures that do not expose the legacy non-*at path syscall ABI. Signed-off-by: gokwok <531504879@qq.com>
Allow tests to reflect arm64 syscall availability and vDSO symbol naming without changing x86_64 expectations. Signed-off-by: gokwok <531504879@qq.com>
Use libc flag values, architecture-specific memfd syscall numbers, page-safe child string reads, and host-path checks needed for arm64 runtime behavior. Signed-off-by: gokwok <531504879@qq.com>
Adjust integration fixtures and Python tests so arm64 runs the supported coverage instead of inheriting x86_64-only assumptions. Signed-off-by: gokwok <531504879@qq.com>
Capture arm64 registers through PTRACE_GETREGSET, patch arm64 vDSO time helpers, and stabilize deterministic getdents caching for parity tests. Signed-off-by: gokwok <531504879@qq.com>
Use native stat layouts, normalize virtual COW paths, virtualize getcwd after COW-only chdir, and merge directory reads for upper-layer fds. Signed-off-by: gokwok <531504879@qq.com>
Run the chroot raw path syscall coverage on arm64 by mapping legacy helper commands to equivalent *at syscalls where the legacy ABI is absent. Signed-off-by: gokwok <531504879@qq.com>
Replace deprecated asyncio loop usage, close test files explicitly, and avoid an extra shell fork in the gather pipeline test. Signed-off-by: gokwok <531504879@qq.com>
|
Thanks for the PR!
Low probability (short-lived sandboxes, fresh PID namespace, would need to wrap the PID space), but the failure mode is silent and hard to debug if it ever hits. BTW, the Rust tests job failed on this PR: https://github.com/multikernel/sandlock/actions/runs/24758554033/job/72484409985 — please take a look and get it green before this merges. |
Signed-off-by: gokwok <531504879@qq.com>
Signed-off-by: gokwok <531504879@qq.com>
Thanks for the detailed review! I've pushed the fixes to this PR branch. I fixed both issues in the latest update:
|
Summary
This PR adds Linux arm64/aarch64 support for sandlock's seccomp-based sandbox
runtime.
The existing implementation assumed the x86_64 Linux syscall ABI in several
places:
syscall numbers, seccomp audit architecture, raw syscall argument registers,
legacy non-*at path syscalls, struct stat layout, ptrace register capture, and
vDSO symbol/stub handling. Those assumptions prevented the runtime and test
suite from working correctly on arm64.
This series makes those paths architecture-aware while preserving the existing
x86_64 behavior.
What Changed
syscalls such as SYS_open/SYS_stat/SYS_access.
syscalls.
skipped for x86_64-only assumptions.
Compatibility
The x86_64 behavior is intended to remain unchanged. The arm64 implementation
uses architecture-specific constants and optional syscall registration rather
than hard-coding x86_64-only syscall numbers.
One important ABI difference is that Linux arm64 does not provide several
legacy non-*at path syscalls. For those cases, this PR tests the equivalent raw
*at ABI, for example openat(AT_FDCWD, ...), instead of pretending SYS_open
exists on arm64.
Test Plan
Verified on arm64(macos apple container / orb linux machine):
The final patch series keeps the x86_64 assumptions isolated behind the new
architecture layer and keeps the existing x86_64 syscall paths intact.