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

saschagrunert / libseccomp

Build:
Build:
LAST BUILD BRANCH: bpf-load-syscall-first-emitted
DEFAULT BRANCH: main
Repo Added 20 Aug 2021 08:50AM UTC
Token VoXed91JR5g6wHz9Ww7Buh71c8ZqNuLcD regen
Build 3 Last
Files 27
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

LAST BUILD ON BRANCH bpf-load-syscall-first-emitted
branch: SELECT
CHANGE BRANCH
x
Sync Branches
  • No branch selected
  • bpf-load-syscall-first-emitted
  • main

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

Relevant lines Covered
Build:
Build:
3558 RELEVANT LINES 3155 COVERED LINES
256305.34 HITS PER LINE
Source Files on main
  • Tree
  • List 27
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
36862496068 bpf-load-syscall-first-emitted 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() s... push 01 Oct 2026 12:35PM UTC saschagrunert github
88.67
36861025587 bpf-load-syscall-first-emitted 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, and the loop skips the head when it is a pseudo-sy... push 01 Oct 2026 12:23PM UTC saschagrunert github
88.68
See All Builds (2)

Badge your Repo: libseccomp

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

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

Refresh
  • Settings
  • Repo on GitHub
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