From 090cf6e9c18898d81728651fd4867933edae6051 Mon Sep 17 00:00:00 2001 From: caixiaomeng Date: Wed, 20 Dec 2023 15:09:57 +0800 Subject: [PATCH] backport upstream patches --- 0001-Check-CPUs-online-not-configured.patch | 38 +++++++++++++++++++++ rasdaemon.spec | 9 ++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 0001-Check-CPUs-online-not-configured.patch diff --git a/0001-Check-CPUs-online-not-configured.patch b/0001-Check-CPUs-online-not-configured.patch new file mode 100644 index 0000000..60f5b4e --- /dev/null +++ b/0001-Check-CPUs-online-not-configured.patch @@ -0,0 +1,38 @@ +From f1ea76375281001cdf4a048c1a4a24d86c6fbe48 Mon Sep 17 00:00:00 2001 +From: Zeph / Liz Loss-Cutler-Hull +Date: Sun, 9 Jul 2023 04:57:19 -0700 +Subject: [PATCH] Check CPUs online, not configured. + +When the number of CPUs detected is greater than the number of CPUs in +the system, rasdaemon will crash when it receives some events. + +Looking deeper, we also fail to use the poll method for similar reasons +in this case. + +All of this can be prevented by checking to see how many CPUs are +currently online (sysconf(_SC_NPROCESSORS_ONLN)) instead of how many +CPUs the current kernel was configured to support +(sysconf(_SC_NPROCESSORS_CONF)). + +For the kernel side of the discussion, see https://lore.kernel.org/lkml/CAM6Wdxft33zLeeXHhmNX5jyJtfGTLiwkQSApc=10fqf+rQh9DA@mail.gmail.com/T/ +Signed-off-by: Mauro Carvalho Chehab +--- + ras-events.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/ras-events.c b/ras-events.c +index a82dab2..5935163 100644 +--- a/ras-events.c ++++ b/ras-events.c +@@ -350,7 +350,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf, + + static int get_num_cpus(struct ras_events *ras) + { +- return sysconf(_SC_NPROCESSORS_CONF); ++ return sysconf(_SC_NPROCESSORS_ONLN); + #if 0 + char fname[MAX_PATH + 1]; + int num_cpus = 0; +-- +2.25.1 + diff --git a/rasdaemon.spec b/rasdaemon.spec index 22c6483..b2ab4ee 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.7 -Release: 15 +Release: 16 License: GPLv2 Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events URL: https://github.com/mchehab/rasdaemon.git @@ -39,6 +39,7 @@ Patch17: 0009-rasdaemon-ras-mc-ctl-Updated-HiSilicon-platform-name.patch Patch18: 0010-rasdaemon-Fix-for-a-memory-out-of-bounds-issue-and-o.patch Patch19: 0001-rasdaemon-use-standard-length-PATH_MAX-for-path-name.patch Patch20: rasdaemon-diskerror-fix-incomplete-diskerror-log.patch +Patch21: 0001-Check-CPUs-online-not-configured.patch Patch6000: backport-rasdaemon-ras-mc-ctl-Fix-script-to-parse-dimm-sizes.patch Patch6001: backport-rasdaemon-ras-memory-failure-handler-handle-localtim.patch @@ -105,6 +106,12 @@ fi /usr/bin/systemctl disable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Wed Dec 20 2023 caixiaomeng - 0.6.7-16 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:backport upstream patches + * Wed Nov 29 2023 renhongxun - 0.6.7-15 - Type:bugfix - ID:NA