Skip to content

Feat/validators seccomp bpf cgroup - #555

Closed
SJrX wants to merge 7 commits into
242.xfrom
feat/validators-seccomp-bpf-cgroup
Closed

SJrX wants to merge 7 commits into
242.xfrom
feat/validators-seccomp-bpf-cgroup

Conversation

@SJrX

@SJrX SJrX commented Oct 24, 2026

Copy link
Copy Markdown
Owner

No description provided.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-seccomp-bpf-cgroup branch from 016c2a3 to 7ceb5df Compare October 24, 2026 14:40
@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine false)

1 388 tests   1 388 ✅  1m 6s ⏱️
  348 suites      0 💤
  348 files        0 ❌

Results for commit 082b48d.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Unit Test Results (grammar engine true)

1 388 tests   1 388 ✅  1m 1s ⏱️
  348 suites      0 💤
  348 files        0 ❌

Results for commit 082b48d.

♻️ This comment has been updated with latest results.

@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-seccomp-bpf-cgroup branch 3 times, most recently from 30ed2ea to 1609e3f Compare October 24, 2026 17:11
SJrX and others added 6 commits October 24, 2026 11:24
…ion options (seccomp-bpf-cgroup batch)

Adds validators, grounded on systemd 0f0682b773, for:
- SystemCallFilter= (core and nspawn): ~ deny lists, @groups, syscall:errno
- SystemCallLog=
- RestrictFileSystems=: exact file system names and @groups
- PrivateBPF=: case-insensitive parse_boolean spellings
- BPFDelegateCommands=/Maps=/Programs=/Attachments=: "any" or a comma list
  of the names generated from the bundled uapi bpf.h

Shared terminals (errno names, safe_atoi numbers, syscall/file system
groups) live in BatchSeccompBpfCgroupCombinators.kt.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…nd BindToDevice (seccomp-bpf-cgroup batch)

- NFTSet= (cgroup context): cgroup/user/group:family:table:set tuples
- BPFProgram=: cgroup attach type plus absolute, normalized path
- XAttrEntryPoint=/XAttrListen=/XAttrAccept=: user.NAME=VALUE with
  specifier checking
- BindToDevice=: "*" or an interface name, specifiers allowed

Also adds PRINTF_CHAR / printfCharExcluding, modelled on specifier_printf
(unknown non-alphanumeric "%x" stays literal).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…omp-bpf-cgroup batch)

- NFTSet=: allow a leading and trailing ':' run around a tuple, as
  extract_first_word skips/coalesces them.
- BPFProgram=: allow leading ':' before the attach type.
- SafeAtoiTerminal: allow a sign after the 0b/0o prefix (strtol sees it
  after mangle_base strips the prefix).
- RestrictFileSystems=: document ext4"" as a known over-rejection and fix
  the TEST-07 evidence anchor.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Checked against systemd's own parsers (sd-check) built at 0f0682b773.

- BindToDevice=: refuse numeric spellings that parse_ifindex() reads as an
  interface index (0x5, +5, 0b101, 0o7, 010, 0b+1), as ifname_valid() does.
  Names like -5, +0, 0x0, +0b1 and 0x80000000 stay valid.
- Expose the safe_atoi() value reader as seccompBpfCgroupSafeAtoiValue().
- Tests pin the oracle-checked values, including the deliberate leniency for
  unknown syscall names and the runtime-only RestrictFileSystems= name check.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…up validators

PrivateBPF= built its own ignore-case terminal from BOOLEAN_SPELLINGS; the
shared BOOLEAN is now case-insensitive, so use it. private_bpf_table only
holds "no"/"yes", which BOOLEAN already covers, so no names branch is needed.

ERRNO_NAME keeps ignoreCase: errno_from_name() uses a gperf table generated
with --ignore-case (src/basic/meson.build). Add mixed-case test cases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tors (#563)

Replace the branch-local SafeAtoiTerminal and seccompBpfCgroupSafeAtoiValue
with the shared SafeAtoTerminal. The SystemCallFilter errno number is a
whitespace-split word (acceptsWhitespace = false, 0..4095), and the
BindToDevice ifindex check uses SafeAtoTerminal(...).valueOf() with 1..INT_MAX.

No verdict changes; the new tests pin sd-check results for -0x0, 0o-0, 08
and 0x (errno) and 0b-0, -0x0, 0o+7, 08 (BindToDevice).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@sjrx-claude-sandbox
sjrx-claude-sandbox force-pushed the feat/validators-seccomp-bpf-cgroup branch from 1609e3f to 4b49575 Compare October 24, 2026 18:29
…cgroup validators (#565)

RestrictFileSystems= now accepts any word that does not unquote to an
@group: systemd's parser stores plain names unchecked and only rejects
unknown ones in the BPF code at unit start. Quotes and escapes are
modelled per EXTRACT_UNQUOTE, and a literal ~word after the first
position is accepted. Known names stay an exact alternative for
completion and coloring; unknown @groups and unterminated quotes are
still flagged.

SystemCallFilter= accepts a ~word after the first position: nspawn
stores it verbatim and only drops it at container start. Unit files
share the (config_parse_syscall_filter, 0) registration and cannot be
told apart, so the lenient behaviour applies to both (documented).

SYSCALL_NAME's lenient side no longer starts at @ or ~, which removes a
2^n parse blow-up on long invalid lists on the new engine.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@SJrX SJrX closed this Oct 24, 2026
@SJrX
SJrX deleted the feat/validators-seccomp-bpf-cgroup branch October 24, 2026 20:38
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