Repository navigation
Fix/native i386 sandbox - #6
Merged
Merged
Conversation
lukerb52
marked this pull request as ready for review
November 16, 2026 02:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add architecture-specific i386 seccomp support on x86-64 Linux
Summary
Add explicit support for filtering both native x86-64 and compatibility i386 syscalls within one Claybin sandbox, without disabling seccomp or applying native syscall numbers to the compatibility ABI.
This enables a companion Agentty change to run ordinary dynamically linked
gcc -m32executables while retaining filesystem isolation and syscall restrictions.Problem
Claybin's existing seccomp architecture guard accepts only the configured native architecture. On x86-64 Linux, an i386 process encounters
SECCOMP_RET_KILL_PROCESSbefore reaching the syscall rules, producingSIGSYS.Simply accepting
AUDIT_ARCH_I386in that guard would be unsafe: x86-64 and i386 assign different operations to the same syscall numbers.Changes
SyscallPolicyand policy-builder API.AUDIT_ARCH_X86_64uses the native policy.AUDIT_ARCH_I386uses the explicitly supplied compatibility policy.mmap2,mprotect, andpkey_mprotect.nr == -1) after architecture validation.Security considerations
mmap, whose protection flags cannot be inspected safely by seccomp.socketcallrather than allowing its pointer arguments to bypass socket-family checks.Testing
The following focused suites pass after rebasing onto
19a6c27:bpf_emit_testplan_testsyscall_table_testlattice_laws_testpolicy_typestate_testcompile_fuzz_testCoverage includes architecture dispatch, syscall-number collisions, unknown architectures, x32 rejection, protection arguments, compatibility-policy composition, broker rejection, and tracer cancellation for both supported ABIs. The i386 table is checked against host kernel syscall definitions.
Before this rebase, the companion Agentty integration also passed real-host sandbox tests for:
Related work
The companion Agentty PR supplies the filesystem-mapping changes needed to preserve merged-
/usrloader resolution and selects this compatibility policy. Those Agentty-specific changes are outside this PR.