Skip to main content
QUICK REVIEW

[Paper Review] Programmable System Call Security with eBPF

Jinghao Jia, Zhu Yi-fei|arXiv (Cornell University)|Feb 20, 2023
Security and Verification in ComputingComputer Science14 citations
TL;DR

The paper introduces Seccomp-eBPF, a programmable system call filtering approach that extends Seccomp with eBPF to enable stateful, expressive, synchronized, and safe user-memory-access policies, improving security and performance over traditional Seccomp-cBPF and Notifier.

ABSTRACT

System call filtering is a widely used security mechanism for protecting a shared OS kernel against untrusted user applications. However, existing system call filtering techniques either are too expensive due to the context switch overhead imposed by userspace agents, or lack sufficient programmability to express advanced policies. Seccomp, Linux's system call filtering module, is widely used by modern container technologies, mobile apps, and system management services. Despite the adoption of the classic BPF language (cBPF), security policies in Seccomp are mostly limited to static allow lists, primarily because cBPF does not support stateful policies. Consequently, many essential security features cannot be expressed precisely and/or require kernel modifications. In this paper, we present a programmable system call filtering mechanism, which enables more advanced security policies to be expressed by leveraging the extended BPF language (eBPF). More specifically, we create a new Seccomp eBPF program type, exposing, modifying or creating new eBPF helper functions to safely manage filter state, access kernel and user state, and utilize synchronization primitives. Importantly, our system integrates with existing kernel privilege and capability mechanisms, enabling unprivileged users to install advanced filters safely. Our evaluation shows that our eBPF-based filtering can enhance existing policies (e.g., reducing the attack surface of early execution phase by up to 55.4% for temporal specialization), mitigate real-world vulnerabilities, and accelerate filters.

Motivation & Objective

  • Address limitations of Seccomp-cBPF which is mostly stateless and offers limited expressiveness.
  • Enable advanced system call security policies via an eBPF-based Seccomp program type.
  • Maintain existing Seccomp interfaces while enabling unprivileged users to install advanced filters safely.
  • Provide safe mechanisms for state management, synchronization, and user memory access within filters.
  • Demonstrate real-world use cases and performance/security improvements over prior approaches.

Proposed method

  • Introduce Seccomp-eBPF as a new Seccomp program type (BPF_PROG_TYPE_SECCOMP) built on top of Seccomp and extended BPF tooling.
  • Expose and modify eBPF helpers to support stateful filtering, safe user-memory access, synchronization, and kernel interactions.
  • Redefine secure task storage helpers to be usable by unprivileged filters without exposing privileged task structures.
  • Implement safe DPI (deep packet-like) memory access to user-space pointers while mitigating TOCTTOU risks.
  • Add system-call serialization primitives to prevent races by introducing per-call atomic counters and an API (bpf_wait_syscall).
  • Provide two-step filter loading (bpf_prog_load) and Seccomp installation with tamper protection considerations.
Figure 1 . Features, helper interfaces, and their implementation of the Seccomp eBPF program type.
Figure 1 . Features, helper interfaces, and their implementation of the Seccomp eBPF program type.

Experimental results

Research questions

  • RQ1How can Seccomp filtering be made stateful to support policies like system call count limiting, sequence checking, and temporal specialization?
  • RQ2Can eBPF-based Seccomp filters provide safe, unprivileged installation of advanced policies without elevating privileges?
  • RQ3What new eBPF helpers are needed to enable state management, synchronization, and safe user-memory access in Seccomp-eBPF?
  • RQ4How effective is Seccomp-eBPF at reducing attack surfaces or mitigating real-world vulnerabilities compared to Seccomp-cBPF?
  • RQ5What is the performance impact of Seccomp-eBPF versus traditional Seccomp approaches?

Key findings

  • eBPF-based Seccomp filtering can reduce early-execution phase system-call surface by up to 55.4% compared to cBPF-based policies.
  • Seccomp-eBPF enables features such as system call count limiting, flow-integrity protection, and serialization that are not feasible with cBPF.
  • Safe user-memory access helpers and task storage redesign allow unprivileged filters to operate without elevating privileges.
  • Serialization helpers (bpf_wait_syscall) allow safe mitigation of race conditions by coordinating conflicting system calls.
  • The approach preserves Seccomp usage models and interfaces while integrating with kernel privilege mechanisms to prevent privilege escalation.
  • Application of Seccomp-eBPF-based filters can improve performance, including up to 10% gains via validation caching.
Figure 2 . Workflow of a Seccomp-eBPF filter
Figure 2 . Workflow of a Seccomp-eBPF filter

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.