Skip to content

sandbox: allow restrictive nested seccomp filters without BPF JIT - #43

Open
zbarsky-openai wants to merge 1 commit into
hermeticbuild:mainfrom
zbarsky-openai:zbarsky/actiond-nested-seccomp-filters
Open

zbarsky-openai wants to merge 1 commit into
hermeticbuild:mainfrom
zbarsky-openai:zbarsky/actiond-nested-seccomp-filters

Conversation

@zbarsky-openai

Copy link
Copy Markdown

Sandboxed programs that install their own restrictive seccomp policy currently fail
inside actiond even though the worker already sets no_new_privs:

NoNewPrivs: 1
Seccomp: 2
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, ...): EPERM

Permit both supported nested-filter entry points (seccomp(SECCOMP_SET_MODE_FILTER)
and prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER)). Disable the ARM64 kernel's BPF
JIT first so these additional restrictive filters cannot expose a classic-BPF JIT
surface; the x86_64 kernel already has its JIT disabled. Keep the existing
denials for bpf(), io_uring_setup, AF_VSOCK, and socket BPF attachment.

Add focused policy coverage and an end-to-end action-tool assertion that installs
an additional filter after verifying the original restrictions.

Validation:

  • Resolved both ARM64 and x86_64 Linux configurations with the actual kernel
    Kconfig parser: CONFIG_SECCOMP_FILTER=y, CONFIG_BPF_JIT unset.
  • Rebuilt the ARM64 kernel through actiond: 3,601 actions, 962 actually executed
    remotely (3d5ca79e-06b2-4409-ae92-cfcefef3551f).
  • Rebuilt the ARM64 guest initramfs and booted the real macOS-hosted VM without
    adding packages or replacing its existing CAS.
  • A freshly executed guest probe changed nested-filter installation from EPERM
    to success (ba4a5aae-c440-4247-9fa1-3f802dba9b23).
  • Five seccomp policy checks and five sandbox-tool checks passed inside the new
    VM, including the retained BPF, socket, io_uring, and audit-architecture
    restrictions (47cc7191-684d-4c5d-b17a-31ee7c44088c).
  • //src:unit_tests and //tools:e2e_action_tool_tests both executed and passed
    with test caching disabled (ae8fe693-bbc5-4c24-9d38-5a425f5358d0).

Sandboxed programs that install their own restrictive seccomp policy currently fail
inside actiond even though the worker already sets `no_new_privs`:

```text
NoNewPrivs: 1
Seccomp: 2
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, ...): EPERM
```

Permit both supported nested-filter entry points (`seccomp(SECCOMP_SET_MODE_FILTER)`
and `prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER)`). Disable the ARM64 kernel's BPF
JIT first so these additional restrictive filters cannot expose a classic-BPF JIT
surface; the x86_64 kernel already has its JIT disabled. Keep the existing
denials for `bpf()`, `io_uring_setup`, `AF_VSOCK`, and socket BPF attachment.

Add focused policy coverage and an end-to-end action-tool assertion that installs
an additional filter after verifying the original restrictions.

Validation:

- Resolved both ARM64 and x86_64 Linux configurations with the actual kernel
  Kconfig parser: `CONFIG_SECCOMP_FILTER=y`, `CONFIG_BPF_JIT` unset.
- Rebuilt the ARM64 kernel through actiond: 3,601 actions, 962 actually executed
  remotely (`3d5ca79e-06b2-4409-ae92-cfcefef3551f`).
- Rebuilt the ARM64 guest initramfs and booted the real macOS-hosted VM without
  adding packages or replacing its existing CAS.
- A freshly executed guest probe changed nested-filter installation from `EPERM`
  to success (`ba4a5aae-c440-4247-9fa1-3f802dba9b23`).
- Five seccomp policy checks and five sandbox-tool checks passed inside the new
  VM, including the retained BPF, socket, io_uring, and audit-architecture
  restrictions (`47cc7191-684d-4c5d-b17a-31ee7c44088c`).
- `//src:unit_tests` and `//tools:e2e_action_tool_tests` both executed and passed
  with test caching disabled (`ae8fe693-bbc5-4c24-9d38-5a425f5358d0`).
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.

1 participant