…open
Classic `tracepoint/*` programs attach through tracefs and
perf_event_open, which a delegated BPF token cannot authorize: the token
only covers bpf(). Inside a token-delegated user namespace every
tracepoint attach failed on the first one, sched_process_exec, so
memtrack could not run at all there.
Move the seven classic tracepoints to BTF-typed programs that attach via
bpf() alone:
- sched_process_exec/exit -> tp_btf (same tracepoint, raw attach)
- sys_enter/exit_mmap, sys_enter_munmap, sys_enter/exit_brk ->
fentry/fexit on the arch syscall wrapper, `__x64_sys_*` or
`__arm64_sys_*` selected from `__TARGET_ARCH_*`
Hook points and observed values are unchanged: fexit receives the same
return value as sys_exit's `ret`, and the register-based args match
sys_enter's `args[]`. As a side effect the run no longer flips every
task onto the syscall tracepoint slow path, which classic `syscalls/*`
tracepoints do system-wide. fentry is now required even with allocator
tracking disabled; the x86_64 floor stays at 5.5 while aarch64 needs
6.4 for BPF trampolines.
Known limitation: `tracepoint/kmem/rss_stat` (physical mode) is still a
classic tracepoint. Its TP_fast_assign-derived fields (mm_id, curr,
size) have no tp_btf equivalent, so where perf_event_open is denied it
fails to attach and only logs a warning. Physical RSS then comes from
the folio rmap hooks alone: complete on kernels >= 6.15, missing
PUD-mapped THP on 6.8-6.14, and absent below 6.8.
Refs COD-3492
Co-Authored-By: Claude <noreply@anthropic.com>
No description provided.