diff options
| author | Hui Su <sh_def@163.com> | 2026-09-12 12:11:12 +0900 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-26 20:29:40 +0200 |
| commit | bac027175ada974b3fde9eb0690ca5d698e0a6d1 (patch) | |
| tree | bd2ccf936c1ec418e23d75600adf034f30c56485 /tools/perf/python/stackcollapse.py | |
| parent | b1d0b4093fe6055c9e534387ccdc28a5278e99ff (diff) | |
| download | linux-next-bac027175ada974b3fde9eb0690ca5d698e0a6d1.tar.gz linux-next-bac027175ada974b3fde9eb0690ca5d698e0a6d1.zip | |
perf synthetic-events: Check schedstat domain allocation failure
__synthesize_schedstat_domain() uses event after zalloc() without
checking for allocation failure, unlike __synthesize_schedstat_cpu().
If zalloc() fails and returns NULL, dereferencing ds->header.type
immediately crashes with a segmentation fault:
Program received signal SIGSEGV, Segmentation fault.
0x00005555558aed8a in __synthesize_schedstat_domain ()
#0 0x00005555558aed8a in __synthesize_schedstat_domain ()
#1 0x00005555558b889a in perf_event__synthesize_schedstat ()
#2 0x000055555563c397 in cmd_sched ()
#3 0x00005555556583a1 in handle_internal_command ()
#4 0x00005555555bf739 in main ()
perf_event__synthesize_schedstat() already treats a NULL event as an
error and cleans up, so return NULL when the allocation fails.
After this fix, an allocation failure returns NULL safely, allowing the
caller to exit gracefully without crashing:
[ perf sched stats: Failed !! ]
Fixes: c3030995f23b3d35 ("perf sched stats: Add record and rawdump support")
Signed-off-by: Hui Su <sh_def@163.com>
Cc: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
