Skip to content

Fix/native i386 sandox - #130

Merged
1ay1 merged 2 commits into
agentty-org:masterfrom
lukerb52:fix/native-i386-sandox
Nov 16, 2026
Merged

1ay1 merged 2 commits into
agentty-org:masterfrom
lukerb52:fix/native-i386-sandox

Conversation

@lukerb52

Copy link
Copy Markdown
Contributor

Summary

Enable ordinary 32-bit Linux executables to run under Agentty's normal sandbox configuration on x86-64 hosts with multilib support.

This fixes both default ELF interpreter resolution and i386 syscall filtering without disabling sandboxing, seccomp, or W^X protection.

Depends on the companion Claybin PR: [link to Claybin PR].

Root causes

Merged-/usr loader resolution

On Arch Linux, the standard loader resolves through:

/lib → /usr/lib
/lib/ld-linux.so.2 → ../lib32/ld-linux.so.2

Binding /lib as a real directory flattens the merged-/usr alias. The relative loader symlink then resolves beneath /lib32 instead of /usr/lib32, causing ordinary gcc -m32 executables to fail with:

cannot execute: required file not found

Seccomp architecture rejection

Using an explicit /usr/lib32/ld-linux.so.2 interpreter gets past that filesystem issue, but the previous Claybin architecture guard kills AUDIT_ARCH_I386 syscalls before consulting syscall rules, producing SIGSYS and exit 159.

Accepting i386 calls with the native syscall table would be unsafe because the two ABIs use different syscall numbers.

Changes

  • Preserve recognized merged-/usr root symlinks in the Claybin mount tree.
  • Detect optional top-level multilib library roots and expose them read-only only when present.
  • Continue using the existing read-only /usr mapping for /usr/lib32 and Debian-style multilib directories.
  • Update the managed Claybin dependency and select its independent i386 syscall policy alongside the native x86-64 policy.
  • Apply architecture-appropriate W^X checks and socket-family restrictions.
  • Keep compatibility broker operations fail-closed until broker decoding is architecture-aware.
  • Add an automated multilib regression through Agentty's real Mode::On sandbox execution path.

No new setting is required. Compatibility execution remains subject to kernel support and installed runtime libraries.

Security

  • Filesystem isolation and credential masking remain enabled.
  • No broad / or home-directory access is added.
  • Native x86-64 syscall filtering remains active.
  • Unknown syscall architectures and x32 execution remain rejected.
  • Pointer-based legacy mmap and multiplexed socketcall are denied where their arguments cannot be inspected safely.
  • The fix does not depend on Filter Off or W^X Off.

Verification

Verified on an x86-64 Linux host with multilib support:

  • Full Debug build succeeds; the executable reports agentty 0.9.56.
  • Native 64-bit execution returns 42.
  • An ordinary gcc -m32 executable using the default ELF interpreter, with no custom linker path, returns 42 inside the sandbox.
  • An i386 executable loads a shared library successfully.
  • Disallowed external filesystem writes remain blocked for both ABIs.
  • RWX mappings and RWX protection changes remain blocked for both ABIs.
  • A hard-denied unshare syscall terminates both test processes with SIGSYS, exit 159.

Commands used:

cmake --preset debug
cmake --build --preset debug --parallel 2
./build/sandbox_multilib_test --require
cmake --build --preset debug --target tests --parallel 2
ctest --preset debug --output-on-failure

Full-suite result

1,966 tests passed; one test failed: rag_eval_guard.

The held-out documentation evaluation reports MRR 0.806, below its 0.82 floor, while hit@8 is 1.000. The same score reproduces against the pre-patch documentation checkout using the same built evaluator. Neither the documentation corpus nor retrieval code is changed by this PR.

The evaluation threshold was not relaxed, and the failing test was not excluded.

@1ay1
1ay1 merged commit 6a5da7b into agentty-org:master Nov 16, 2026
1ay1 added a commit that referenced this pull request Nov 16, 2026
- 32-bit kill goes through the broker like the native one. the broker
  maps an i386 kill onto the native decision by the call's audit arch.
- the compat policy is claybin's profiles_i386 as is, plus the same W^X
  switch and add_socket_families(), instead of a second copy here.
- merged-/usr links are found in the posture (sandbox.cpp) and
  build_policy just applies them.
- sandbox_multilib_check is a by-hand target like sandbox_live_check,
  writes under ~/.cache instead of the cwd, and checks kill too.
- purity allows probe.cpp's one netns socket, documented.

claybin: native and i386 profiles now allow what git, sqlite, tar and
node need (fsync, flock, link, umask...), and x86_audit keeps the two
ABIs equal by name.
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.

2 participants