
Live-patching security vulnerabilities inside the Linux kernel with eBPF Linux Security Module
6/29/2022
This post introduces the use of eBPF within Linux Security Modules (LSM) as a novel approach to implementing security policies. It details the process of identifying the relevant kernel hooks (`cred_prepare` for the `unshare` syscall) and demonstrates how to write an eBPF program to intercept and deny `CLONE_NEWUSER` operations for unprivileged users. The post also covers the necessary kernel configuration options and provides example C code for the eBPF program and a libbpf loader, along with a Makefile for compilation. It highlights the benefits of LSM BPF for live-patching security vulnerabilities and enforcing granular access controls without modifying the kernel directly.