• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

saschagrunert / libseccomp / 36862496068
89%
main: %

Build:
Build:
LAST BUILD BRANCH: bpf-load-syscall-first-emitted
DEFAULT BRANCH: main
Ran 01 Oct 2026 12:35PM UTC
Jobs 1
Files 27
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Oct 2026 12:32PM UTC coverage: 88.673% (-0.004%) from 88.677%
36862496068

push

github

saschagrunert
bpf: load the syscall number in the first syscall that is emitted

_gen_bpf_syscalls() emits the instruction that loads the syscall number
only in the block of the head of the sorted syscall list, but the loop
omits the head when _skip_syscall() says so: an entry that only carries a
priority, which seccomp_syscall_priority() leaves for a syscall without
a rule, and since ad873bd ("bpf: do not add pseudo-syscalls to the BPF
filter", v2.5.0) a pseudo-syscall. No block loads the number then, every
rule of that architecture compares against whatever the accumulator
holds after the architecture check, and every call gets the default
action. The head-only load dates from 90882e7 ("bpf: fix a problem when
creating filters that include syscall arguments", v2.0.0).

This takes a filter whose first syscall by priority is such an entry, on
an architecture whose syscall blocks load the number, which is every one
but a lone x86_64 or x32. A pseudo-syscall heads the list when every
unconditional rule names a syscall the architecture lacks, which the
architectures with socketcall multiplexing avoid by dropping such a rule
in seccomp_rule_add; a priority-only entry heads it on any architecture.
With a permissive default action every denying rule of the architecture
is disabled. The PFC export shows the rules as intended, so it cannot
be used to find the problem. Reproducer on x86_64 with 2.5.5, 2.6.1 and
main:

	ctx = seccomp_init(SCMP_ACT_ALLOW);
	seccomp_arch_add(ctx, SCMP_ARCH_X32);
	seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(socket), 1,
			 SCMP_A0(SCMP_CMP_EQ, AF_VSOCK));
	seccomp_rule_add(ctx, SCMP_ACT_ERRNO(EPERM), SCMP_SYS(socketcall), 0);
	seccomp_load(ctx);
	socket(AF_VSOCK, SOCK_STREAM, 0);	/* succeeds, expected EPERM */

The exported BPF has no "ld [0]" after the x86_64 architecture check;
without SCMP_ARCH_X32 the call fails with EPERM. The same happens with
seccomp_syscall_priority(ctx, SCMP_SYS(getpid), 255) in place of the
socketcall rule, ... (continued)

3 of 3 new or added lines in 1 file covered. (100.0%)

66 existing lines in 1 file now uncovered.

3155 of 3558 relevant lines covered (88.67%)

256305.34 hits per line

Coverage Regressions

Lines Coverage ∆ File
66
83.08
-0.02% src/gen_bpf.c
Jobs
ID Job ID Ran Files Coverage
1 amd64 - 36862496068.1 01 Oct 2026 12:35PM UTC 27
88.67
GitHub Action Run
Source Files on build 36862496068
  • Tree
  • List 27
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • a04b816e on github
  • Prev Build on bpf-load-syscall-first-emitted (#36861025587)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc