Files
numatop/common-Ignore-samples-for-exiting-tasks.patch
Vlastimil Babka d7c5886184 - common-Ignore-samples-for-exiting-tasks.patch: segfault fix
(bsc#1248317)
- 01-Fix-upper-bound-for-nodes.patch
  02-Fix-upper-bound-for-CPUs-per-node.patch
  03-Resolve-max-count-of-nodes-at-runtime.patch
  04-Resolve-max-count-of-CPUs-at-runtime.patch
  05-Resolve-max-count-of-CPUs-per-node-at-runtime.patch
  06-Remove-unused-NPROCS_NAX.patch: fix >256 CPUs per NUMA
  node (bsc#1247358)

OBS-URL: https://build.opensuse.org/package/show/Base:System/numatop?expand=0&rev=28
2025-10-16 14:54:11 +00:00

35 lines
1.3 KiB
Diff

From 636bf0ee924034d51e63a20325353f2e9384b3de Mon Sep 17 00:00:00 2001
From: Sandipan Das <sandipan.das@amd.com>
Date: Thu, 10 Jul 2025 11:57:03 +0530
Subject: [PATCH] common: Ignore samples for exiting tasks
After the inclusion of Linux commit 1d953111b648 ("perf/core: Don't
report zero PIDs for exiting tasks"), perf samples will report PID as
-1 for exiting tasks.
Such samples lead to segmentation faults during process lookup when
proc_find_nolock() is called with -1 as the PID. Process data at the
the hash table index returned by PROC_HASHTBL_INDEX() is invalid and
any dereference of the corresponding track_proc_t pointer results in
a bad access. Hence, ignore samples for exiting tasks.
Fixes: 972a9d0 ("Reconstruct code for better OS-independent.")
Signed-off-by: Sandipan Das <sandipan.das@amd.com>
---
common/os/pfwrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/os/pfwrapper.c b/common/os/pfwrapper.c
index 10042d9..780458e 100644
--- a/common/os/pfwrapper.c
+++ b/common/os/pfwrapper.c
@@ -497,7 +497,7 @@ ll_sample_read(struct perf_event_mmap_page *mhdr, int size,
* { u64 data_src; }
* };
*/
- if (mmap_buffer_read(mhdr, &id, sizeof (id)) == -1) {
+ if (mmap_buffer_read(mhdr, &id, sizeof (id)) == -1 || id.pid == -1U) {
debug_print(NULL, 2, "ll_sample_read: read pid/tid failed.\n");
goto L_EXIT;
}