Skip to contentSkip to conversation

adding KASAN support to JIted programs

LSF/MM/BPF TOPIC Alexis Lothoré 1 participant 1 message Feb 16 BPF

lore
Share & tools
lore
#0 lore raw

Hi all,
I'd like to submit a topic for LSF/MM/BPF 2026, about the on-going work to implement KASAN support for eBPF JITed programs.

The verifier gives strong guarantees that any inserted eBPF program is safe for the rest of the system. However, this safety relies on the assumption that any kernel interface on which ebpf programs rely is sane as well. If a bug exists in the kernel (at different possible levels:
JIT compiler, bpf helpers, kfuncs...), a valid program can still perform invalid memory accesses, triggering a wide variety of bugs. To help kernel developers detect and fix those bugs as early as possible, KASAN support is being added to the eBPF subsystem to instrument JITed programs.

KASAN is an in-kernel memory error detector. By tracking each "granule" of allocated memory thanks to a dedicated shadow area, it is able to check any memory address being accessed (load or store), and to emit a report of any invalid access (mostly use-after-free and out-of-bounds). This instrumentation relies on both compiler instrumentation and shadow memory updates on any block of (de)allocated memory. The goal of this KASAN-for-eBPF work is to replicate the build time instrumentation but for the instructions that are JITed at program load time.

The work on this feature has started at the beginning of 2026. A RFC is being discussed on eBPF ML (see [1]) to validate the general approach. The goal is to at least get a working prototype for LSF/MM/BPF, and then to:
- showcase the prototype and its architecture
- discuss the kind of bugs covered by this implementation, and those missing
- discuss the design and any potential roadblock
- the possible interactions, overlaps or gaps to bridge with other memory sanityzing solutions being implemented in the kernel (see [2], [3])

Thanks,

Alexis

[1] https://lore.kernel.org/bpf/[email protected]/
[2] https://lore.kernel.org/bpf/[email protected]/
[3] https://lore.kernel.org/bpf/[email protected]/

Signature · 3 lines
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com