perf report as root refuses a data file a normal user owns
Symptom#
A script records with sudo perf record ... -o record.data, runs sudo chown so the user owns the file, then reduces it with sudo perf report -i record.data ... > record.txt. record.txt is empty. Run by hand, perf prints:
File /tmp/vt/r.data not owned by current user or root (use -f to override)
Run as the normal user instead, the report works but every kernel frame reads as a bare address such as [k] 0xffffc43d9c763bc0.
Cause#
perf refuses a data file whose owner is neither the current user nor root. After the chown, root is the current user and the owner is someone else. A normal user cannot read /proc/kallsyms addresses, so kernel symbols do not resolve.
Fix#
Reduce as root and add -f. Also add -g none to keep the report flat:
Evidence#
Seen in the dpucrumbs vendor observers on BlueField DPUs and x86 hosts (perf 5.15): every record.txt and sched.txt of one dry run was 0 bytes. A test on one DPU printed the "not owned" line without -f. With -f it printed resolved symbols such as swapper [kernel.kallsyms] [k] arch_cpu_idle, and the next 29 runs all wrote non-empty reports.
Also found by searching
- File perf.data not owned by current user or root (use -f to override)
- sudo perf report prints nothing
- how do I read a perf.data file as root after chown
- perf report shows kernel symbols as hex addresses