From 79f64c67c936875b32b0ef90935008a20bf1ab4e Mon Sep 17 00:00:00 2001 From: zhangjian Date: Tue, 20 May 2025 12:28:11 +0000 Subject: [PATCH] fix ps error when mm_struct.rss_stat is lazy initialized Signed-off-by: zhangjian (cherry picked from commit e58743b05c41a3335d644e85865c86ad593b4bcb) --- crash.spec | 6 +++- ...n-mm_struct.rss_stat-is-lazy-initial.patch | 29 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch diff --git a/crash.spec b/crash.spec index a3cab0e..9713006 100644 --- a/crash.spec +++ b/crash.spec @@ -1,6 +1,6 @@ Name: crash Version: 8.0.4 -Release: 12 +Release: 13 Summary: Linux kernel crash utility. License: GPLv3 URL: https://crash-utility.github.io @@ -21,6 +21,7 @@ Patch6: 0006-arm64-fix-a-potential-segfault-when-unwind-frame.patch Patch7: 0007-arm64-fix-SDEI-stack-frame-unwind-while-UNW_4_14-is-.patch Patch8: 0008-Fix-segmentation-fault-in-value_search_module_6_4.patch %endif +Patch9001: huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch BuildRequires: ncurses-devel zlib-devel lzo-devel snappy-devel texinfo libzstd-devel BuildRequires: gcc gcc-c++ bison m4 @@ -100,6 +101,9 @@ install -D -m 0644 defs.h %{buildroot}%{_includedir}/%{name}/defs.h %{_mandir}/man8/crash.8* %changelog +* Tue May 20 2025 zhangjian - 8.0.4-13 +- fix ps error when mm_struct.rss_stat is lazy initialized + * Mon Apr 28 2025 wangxiao - 8.0.4-12 - fix segmentation fault in value_search_module_6_4() diff --git a/huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch b/huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch new file mode 100644 index 0000000..329744a --- /dev/null +++ b/huawei-fix-ps-error-when-mm_struct.rss_stat-is-lazy-initial.patch @@ -0,0 +1,29 @@ +From f006dd143f59d5b8dab1f7c39ef308ca206d5a35 Mon Sep 17 00:00:00 2001 +From: zhangjian +Date: Tue, 20 May 2025 12:23:37 +0000 +Subject: [PATCH] fix ps error when mm_struct.rss_stat is lazy initialized + +Signed-off-by: zhangjian +--- + tools.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/tools.c b/tools.c +index 0f2db10..07e8f97 100644 +--- a/tools.c ++++ b/tools.c +@@ -6954,6 +6954,11 @@ percpu_counter_sum_positive(ulong fbc) + + readmem(fbc + OFFSET(percpu_counter_counters), KVADDR, &addr, + sizeof(void *), "percpu_counter.counters", FAULT_ON_ERROR); ++ ++ /* maybe rss_stat is not initialized */ ++ if (!addr) { ++ return ret; ++ } + + for (i = 0; i < kt->cpus; i++) { + readmem(addr + kt->__per_cpu_offset[i], KVADDR, &count, +-- +2.33.0 + -- Gitee