[PATCH v2 0/2] perf/core: Fix kernel page size leak and espfix hang
From: JunYoung Lee
Date: Wed Dec 02 2026 - 06:59:13 EST
Patch 1 stops exclude_kernel events from getting a kernel IP, which
PERF_SAMPLE_CODE_PAGE_SIZE turned into a KASLR leak. Patch 2 fixes the
endless page table walk on a bad pmd (espfix), which events allowed to
profile the kernel can still hit.
v1: https://lore.kernel.org/all/20261202063433.279947-1-ljyoung04@xxxxxxxxx/
Changes in v2:
- Filter the kernel IP in perf_instruction_pointer(), where data->ip is
set, instead of in perf_get_page_size() (Peter).
- Split the bad pmd fix into its own patch (Peter).
- Shorter changelogs.
On data->addr: I found no way on x86 to get a kernel address into an
exclude_kernel sample. Breakpoint addresses are checked when the event
is created, and user mode faults on kernel addresses don't emit the
page-fault software event. On riscv and powerpc that event seems to be
emitted before the kernel address check, so a kernel data->addr may be
possible there. I haven't tested this. Should it be fixed in those
fault handlers, or with a generic check?
JunYoung Lee (2):
perf/core: Don't report a kernel IP for exclude_kernel events
perf/core: Don't loop forever on a bad pmd in perf_get_pgtable_size()
kernel/events/core.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
base-commit: 693c2e04e3f1d4c59af236e1211b7b8cb165a790
--
2.56.1