Repository navigation
Linux Security Summit 26 Presentation notes
Hi, my name is Yunseong Kim, and I work at Ericsson Software Technology and contribute to Debian kernel. Today I will introduce vock. The question behind this project is simple: when a userspace program runs, which kernel functions, branches, and source lines does it actually exercise?
We begin with one concrete command, ip addr show, and ask what happens beyond the syscall boundary. Then I will explain exact KCOV collection, including fork, threads, and remote kernel work.
The third section removes the requirement for a KCOV-enabled kernel by using CPU instruction buffer hardware. After that, I will briefly compare 3 syscall tracing backends. The final section covers the built-in DWARF reader and the ongoing works.
Let's start with the question that motivated the project. If I run ip a,t I want the internal path: netlink socket setup, message construction, security checks, routing and address management, copy-to-user paths, and cleanup. For security analysis, naming the syscall is only naming the entrance. The attack surface is on the kernel behind that entrance. The goal is to turn this question into a reproducible command and a source-level report.
Existing tools answer neighboring questions. strace tells us which syscall crossed the boundary, but not which internal branch was taken. ftrace can show functions, but attribution to one task is polluted by unrelated interrupts and its granularity is normally not edasy to cheking for code paths. perf can operate Intel PT, AMD IBS, or CoreSight, but its standard model is profiling: samples and weights, not a set of kernel code reached by one program. JTAG-class debuggers can provide complete traces, but require dedicated hardware and often specialized licenses. vock focuses specifically on per-program kernel reachability.
This is the basic command for hardware mode. In fact, hardware mode is now the default in vock. The target command begins after the vock options, so here vock runs ip a.
The kernel source directory is used to show source info and normalize DWARF paths.
The vmlinux file must match the running kernel and supplies symbols, DWARF, and, for Intel PT, the exact instruction bytes used during branch reconstruction. Mode hw chooses the vendor-appropriate backend automatically. Hardware is the default, but I show the flag explicitly because it makes clear. Zero configuration means no custom kernel build; matching debug information is still required for a source-level report.
This example demonstrates the startup process., vock prepares the selected collector before exec, releases the target, gathers raw kernel program counters, corrects KASLR, symbolizes against vmlinux, and produces human-readable artifacts.
The important architectural decision is the narrow interface in the middle: every coverage engine emits a list of kernel PCs. Intel PT, AMD sampling, and KCOV are very different collectors, but the reporting pipeline does not need to know which collector produced the addresses. That common format is what makes comparison and downstream tooling practical.
Here is a real hardware-mode invocation on a Debian trixie. you can see the concrete source lines reached by ip a. The source tree and debug vmlinux come from the exact same kernel package version. On Intel, vock opens the Intel PT perf event before the child execs, captures the AUX trace stream, and decodes it against the .text bytes in vmlinux. The report then maps runtime addresses back to functions and lines. I described this process in my vock wiki.
The purpose is not merely to count PCs. The useful result is a path that a reviewer can read: syscall entry, netlink and networking helpers, policy checks, and the concrete source lines reached by ip a. Covered lines are presented with nearby context so the output reads like a kernel patch. Hardware mode also observes assembly entry code, which is split into asmcov.log so that entry stubs and retpolines do not dominate the C-source report. The same renderer is used for KCOV output later.
Now we move to the exact software-instrumented mode. The name vock is an exact anagram of KCOV, and that signals the data model. KCOV records a sequence of program counters for instrumented kernel basic blocks. vock wraps KCOV for real userspace workloads and can also produce KCOV-shaped data from hardware sources. When we control the kernel, KCOV is normally the preferred engine because coverage is exact, per task, and has no statistical ambiguity.
KCOV is enabled with CONFIG_KCOV, commonly together with CONFIG_KCOV_INSTRUMENT_ALL. During compilation, the sanitizer-coverage trace-pc callback is inserted into instrumented basic blocks. A task opens /sys/kernel/debug/kcov, initializes a shared buffer, mmaps it, and enables tracing. The key property is per-task isolation: unrelated system activity does not normally enter the buffer.
The raw result is intentionally simple: one kernel address per line. In this example, addr2line resolves the PCs to __netlink_create and __netlink_insert in af_netlink.c. vock automates this transformation and preserves the underlying raw log. One detail is important for correctness: KCOV captures the return address after the compiler-inserted callback. vock applies the same PreviousInstructionPC convention used by syzkaller, subtracting one byte on x86-64 or four bytes on arm64, before writing the log. Without that shift, line attribution can be subtly one statement late even though the function name looks correct.
objdump -drS interleaves source, disassembly, and relocations, letting us verify where the sanitizer callback was inserted and why a given PC maps to a particular basic block.
How does KCOV obtain the address without a callback argument? The kernel exports __sanitizer_cov_trace_pc. The compiler inserts a call at an instrumented basic block, and the callback derives the caller location from the return address, conceptually using RET_IP. The callback appends that PC to the current task's KCOV buffer. This design keeps the ABI small and makes the runtime collector independent of individual functions. It also explains why coverage is basic-block oriented rather than a conventional function profiler.
A basic block is a straight-line sequence with one entry and no internal branch. In this small function, block A evaluates the condition. If it is true, block B writes zero. Both paths join at block C. Instrumenting block entries lets us distinguish A-to-B-to-C from A-to-C, which a function-only trace cannot. KCOV therefore gives control-flow information at a useful granularity for fuzzing and security review, although it still does not instrument hand-written assembly or code explicitly excluded with noinstr.
vock turns the raw PC sequence into a human-readable report. The command selects KCOV, supplies vmlinux and the source tree, and runs ip a. The output includes kerncov.log for raw evidence, srccov.log for address-function-file-line tuples, coverage.html, and asmcov.log. Under KCOV, asmcov.log
User space and kernel space workloads may involve multiple execution contexts. Per-task KCOV is exact, but real world user space applications are not one task. They fork helpers, create pthreads, exec another image, and queue work that completes in softirq or workqueue context. A collector that only enables KCOV in the initial thread gives a precise answer to the wrong scope. This is especially important for programs such as shells, network clients, and smbclient, where the interesting kernel work may happen in descendants or deferred contexts.
There are two aspects to consider here. First, every forked process and pthread needs its own KCOV instance because KCOV is bound to current. vock injects an LD_PRELOAD shim that runs before main and interposes task lifecycle operations so each task can enable, drain, and write its own log.
Second, deferred kernel work uses KCOV remote coverage. Annotated subsystems call kcov_remote_start_common and stop around work executed on behalf of the originating task. vock's parent drives the workload and coordinates the resulting local and remote files. The goal is causal attribution, not collecting all activity in a subsystem.
This diagram shows the process lifecycle. vock starts as the parent and enables its coordination state. The target loads kcov.so through LD_PRELOAD. Its constructor opens local and remote KCOV instances for target process.
For remote coverage. The direct syscall path is written to local-TID.log. If the syscall queues work, the completion may run in a workqueue, softirq, or another annotated context. When the kernel associates that work with the registered common handle, those PCs are delivered to remote-TID.log. The two logs answer different parts of one causal story. Without the remote half, storage, networking, crypto, and device workloads can look artificially thin even when the operation definitely occurred. Remote coverage is therefore not background noise collection; it is kernel-supported attribution of deferred work.
Here is a concrete smbclient example. The target forks and performs network, VFS, SMB protocol, and deferred I/O work while uploading a file. The command itself does not need to be modified. vock injects the KCOV shim, records each task separately, adds remote coverage where the kernel supplies attribution, and then produces the common report. This was one of the original motivating workloads: a single-task KCOV harness is not a good model for a real command-line client with libraries, threads, subprocesses, and asynchronous kernel completion.
On fork scenario, the child closes inherited instance descriptors without dumping the parent's data, then creates fresh instances under its own TID.
pthread_create wraps the start routine so the new thread enables KCOV before user code runs. Before exec, the old image drains and detaches; the new image loads the shim again. At exit, per-task files are written for later reporting.
As you can see, vock currently includes a forked VFS write scenario in its CI tests. The coverage of each forked process is collected independently and correctly.
Now we return to the second motivation: users who cannot rebuild or reboot the kernel. Hardware mode uses perf_event_open and whatever tracing facility the CPU and kernel expose.
As I've mentiond on getting started, This is the zero-configuration half of vock. It is important to state the boundary correctly: the kernel does not need CONFIG_KCOV, but source-level reporting still benefits from a matching debug vmlinux. Also, hardware mechanisms have different semantics. Intel PT is a trace stream; AMD LBR and IBS are sampling mechanisms.
This is a practical summary of mode selection before we dive deeper into the details. Use hardware mode when the running kernel cannot be replaced, or when you need visibility into assembly and non-instrumented code. Intel PT can support branch-complete reasoning within a healthy trace window. AMD hardware mode provides confirmed sampled points, but absence does not prove non-execution.
KCOV is the better choice in a VM or CI kernel you control: it follows the instrumented basic blocks exactly and vock extends it across forks and threads. For normal hardware-mode access, perf_event_paranoid and capabilities must permit kernel tracing.
vock currently recognizes Intel Processor Trace and AMD IBS-based hardware collection. The Intel PMU type is discovered from the intel_pt sysfs node. AMD uses the ibs_op PMU together with branch context where supported. For arm64 supporting, KCOV is the reliable production path.
This comparison is fundamental. Intel PT records compressed control-flow information. TNT packets encode taken or not-taken conditional branches, and TIP-family packets provide targets that cannot be derived. With matching instruction bytes, vock walks the stream and reconstructs a dense branch path.
AMD IBS Op samples precise retired operations, and LBR supplies a small window of recent branches around sampling interrupts. Those sampled records are exact observations, but the spaces between them are unknown. So Intel supports the sentence: this path ran, and absent paths did not run within the captured window'; AMD supports at least these paths ran.
These links show three runs of the same cat /proc/zoneinfo reading proc filesystem workload through KCOV, Intel PT, and AMD hardware collection. The purpose is not to rank engines by raw PC count. The kernels, CPUs, run lengths, and collection semantics differ. Instead, compare what each mechanism reveals and the confidence model attached to it. KCOV gives exact instrumented C basic blocks.
Intel PT gives a dense control-flow reconstruction including assembly-visible paths. AMD gives a sparse but low-overhead lower bound. Repeated AMD runs can be concatenated and re-reported to raise the observed floor.
Kernel coverage tells us what code was reached. Syscall tracing tells us what userspace requested. Combining the two supports workflows such as narrowing fuzzing inputs and explaining why a subsystem became reachable. vock provides syscall tracing as an additional feature.
The three backends produce the same trace.log format. ptrace is the default. Syscall User Dispatch and eBPF attaches using raw_syscalls tracepoints.
ptrace uses the classic two-stop model: one stop at syscall entry and one at exit. vock reads the architecture registers to capture the number, six arguments, and return value. On x86-64, the fourth argument is in r10, not rcx, and the syscall number is in orig_rax. The main advantages are portability, accurate argument reads while the tracee is stopped, and surviving execve. The costs are high context-switch overhead, tracing only the initial thread in the current implementation, and exclusive ownership of the ptrace relationship.
This diagram shows why ptrace cannot coexist with gdb, strace, rr, or another debugger on the same process. Linux permits one ptracer relationship. If vock owns it, another debugger gets EPERM or EBUSY; if a debugger owns it first, vock cannot also attach. This is not a policy choice in vock. It is the ptrace model. Another caveat is signal transparency: a tracer must reinject delivery signals correctly. If the target depends on alarms, SIGCHLD, or job control, prefer the eBPF backend. For simple commands, ptrace remains the practical default.
Syscall User Dispatch is an in-process mechanism available on supported x86-64 kernels from Linux 5.11. A selector byte tells the kernel whether syscalls are allowed or should trap to SIGSYS. The handler temporarily switches to allow mode, reads the saved registers, reissues the syscall, logs the result, writes the return value back, restores block mode, and returns through a custom rt_sigreturn trampoline inside an allowed address window. The design avoids a ptracer and provides excellent pointer argument fidelity. However, the current implementation stops at exec because SUD state and the signal handler are reset, and arm64 does not provide this facility.
The eBPF backend watches raw_syscalls:sys_enter and sys_exit tracepoints. vock assembles BPF instructions directly instead of using libbpf or clang. A map stores the target TGID, and a BPF ring buffer carries fixed-size records to userspace. This backend does not stop the target and can coexist with gdb or rr. The trade-offs are setup and fidelity: loading and attaching typically needs CAP_BPF and CAP_PERFMON or root, unprivileged BPF policy must allow it, and tracefs IDs must be readable.
This table is the practical backend guide. Choose ptrace when you want the option that works almost everywhere and follows exec, and you do not need another debugger. Choose SUD when exact in-process arguments before exec are the priority on supported x86-64 kernels. Choose eBPF when debugger coexistence, signal transparency, and low disruption matter, and the required privileges are available. No backend is universally best. The point of the shared Syscall record and formatter is that scripts can consume trace.log without caring which mechanism produced it.
The final technical section covers two features that make the collected data usable for security research. First, vock contains its own DWARF reader and streaming symbolization pipeline, avoiding a heavy external addr2line dependency.
Second, vock execprog is an ongoing syzlang interpreter that can replay syzkaller programs and associate kernel coverage with individual calls. These features connect observation to analysis and reproduction: raw PCs become source, and captured or published syscall programs become executable experiments.
Why not simply call addr2line? Traditional addr2line processes tend to build indexes and caches for far more compilation units than a particular coverage log touches. A debug vmlinux can be larger than a gigabyte, and GNU addr2line can approach a gigabyte of resident memory or be killed in a KCOV enabled small VM.
VM shared filesystems make cold random page faults especially expensive. The performance problem is not parsing one address; it is reading and indexing unnecessary debug information. vock's solution is to parse only the units reached by the PC set.
vock mmaps vmlinux read-only and treats ELF and DWARF sections as slices of one mapping. It builds a small address-to-compilation-unit index, preferring .debug_aranges when useful, and lazily parses a unit's line and function tables only when a PC lands there. KASLR correction happens before lookup; whenever possible, the exact offset is computed from runtime and link-time _stext.
This design reduces memory, improves cold-start behavior, and keeps symbolization in the same process. External llvm-addr2line or GNU addr2line remains available as a fallback for unsupported compressed or big-endian debug data.
The report path is a streaming pipeline. A reader thread consumes per-task logs in four-megabyte, line-aligned blocks. The main thread parses PCs, deduplicates only the new addresses, corrects KASLR, and symbolizes them. A writer thread streams srccov.log while the main thread continues.
Pre-warming starts the DWARF load while the target is still running, and parallel page population reduces VM round trips. On the measured 8.4K-unique-PC log, the in-process path took about 0.3 seconds, with the index ready at roughly 80 milliseconds, compared with 0.6 seconds for llvm-addr2line and around 9 seconds for GNU addr2line on the same input.
The ongoing execprog work aims at compatibility with syzlang log format and workflows. The desired round trip is: capture a syscall-shaped program, replay it without modifying the original target, and request per-call KCOV so each call has its own coverage file.
The interpreter handles the syzkaller memory arena, resources such as file descriptors, AUTO allocations, checksums, selected pseudo-syscalls, and call properties. It has passed one selftest case and has reproduced a real KASAN use-after-free. I call this ongoing work because the syscall description database and pseudo-syscalls are not yet complete, and fuzzing feedback is not yet wired into the execution loop.
The next ongoing work is to extend kernel coverage from control-flow information to data-flow information.
Today, KCOV tells us which kernel basic blocks were executed. However, for security analysis, knowing that a function was reached is often not enough. We also want to know which argument values entered the function and what value the function returned.
The goal is to capture all function arguments and return values together with kernel coverage generated by the target userspace process. This would allow us to connect three pieces of information: which userspace workload triggered the execution, which kernel path was taken, and what data flowed through the kernel functions on that path.
To support this, I proposed an LLVM SanitizerCoverage extension with two new coverage options: trace-args and trace-ret. The compiler would insert callbacks for function arguments and return values, in a way similar to the existing SanitizerCoverage tracing callbacks.
This requires work on both sides. The LLVM RFC discusses the compiler instrumentation and callback interface. On the Linux kernel side, KCOV needs a representation and transport mechanism for the additional data-flow records.
I also introduced this topic at the Linux Plumbers Conference 2026 KCOV data-flow session. The broader question is how to extend KCOV without breaking its current lightweight PC-based model or creating excessive runtime and storage overhead.
This work is still under discussion. The intended result is not only to report that a kernel function was executed, but also to explain how the target process interacted with that function through concrete argument and return values.
The LLVM RFC and the Linux Plumbers Conference proposal are linked on this slide for further discussion and feedback.
To conclude: vock treats a program's kernel attack surface as an observable runtime property. Use KCOV when you control the kernel and need exact per-task coverage across realistic workloads. Use Intel PT on bare metal when you need a trace stream from a stock kernel, and read AMD LBR plus IBS as a statistical lower bound. Always use a matching vmlinux and source tree, and keep the provenance and KASLR offset verifiable.
The same PC-based reporting pipeline makes these mechanisms comparable and turns raw machine evidence into source-level material for security review and targeted fuzzing.
I sincerely hope this tool will be used for good purposes, not to make other people's lives difficult. Thank you again for attending. I am happy to take questions.