Kernel maintainer rejects tracing-side fix for perf KASLR leak
An unprivileged user can map the kernel image through a perf filter that has existed since Linux 6.3; Steven Rostedt says the permission check belongs in perf, not tracing.
An unprivileged local user can recover the bounds of the kernel image, defeating KASLR, by asking perf whether candidate addresses fall inside kernel text. JunYoung Lee reported the leak on the Linux kernel mailing list and proposed a fix; tracing maintainer Steven Rostedt rejected that approach.
At the default perf_event_paranoid setting of 2, any user may open a tracepoint event for counting and install a filter with PERF_EVENT_IOC_SET_FILTER. One filter form, a field marked .function compared with an address, is accepted only when that address resolves as a kernel symbol. Success or failure of the ioctl is therefore an oracle: the caller learns whether an address lies in the kernel image or a module. Lee reproduced it as an unprivileged user with KASLR enabled, on current mainline and on the 6.12 stable series. The behavior dates to Linux 6.3. No access to tracefs and no extra capabilities are required. The same user sees zeros in the kernel symbol table, which is supposed to hide those addresses. Systems that raise perf_event_paranoid above 2, or that block perf_event_open, are not affected.
Lee's patch would refuse the .function modifier unless the caller already has permission to read kernel symbols, matching the restriction applied when kernel pointers are hidden. In his testing, unprivileged use of every .function form then failed, while ordinary filters still worked, and root kept the feature except under the stricter pointer-hiding setting.
Rostedt turned the patch down. Tracing commands are privileged, he wrote, and "if perf is the one allowing unprivileged users access to these commands then the checks need to be done in the perf code." The fix, he said, should not change the tracing subsystem at all.
While testing, Lee also hit a separate crash: as root, a .function filter on the function tracepoint dereferences a null pointer. That path requires a performance-monitoring capability, so it is not the same unprivileged leak.