summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2025-11-20 16:35:31 +0800
committerKhem Raj <raj.khem@gmail.com>2025-11-20 02:01:29 -0800
commit5ce1a7de82873a93c86574be06209d7452ee70c6 (patch)
tree93b19112b894f5425c2f1f220be09e3d38250871
parent20b8ac86a1d3dfffbc5700e4f53fbc3980f2b230 (diff)
downloadmeta-openembedded-5ce1a7de82873a93c86574be06209d7452ee70c6.tar.gz
rasdaemon: fix post-processing options
Some post-processing options require an argument, otherwise a segfault will occur: root@qemux86-64:~# rasdaemon -p --status --ipid Segmentation fault (core dumped) rasdaemon -p --status --ipid Backport a patch to fix this issue. Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/files/0001-rasdaemon-fix-post-processing-options.patch83
-rw-r--r--meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/rasdaemon_0.8.3.bb1
2 files changed, 84 insertions, 0 deletions
diff --git a/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/files/0001-rasdaemon-fix-post-processing-options.patch b/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/files/0001-rasdaemon-fix-post-processing-options.patch
new file mode 100644
index 0000000000..d999f288dc
--- /dev/null
+++ b/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/files/0001-rasdaemon-fix-post-processing-options.patch
@@ -0,0 +1,83 @@
1From 64bc04705ea8606eed1b1e810904cc8296e99472 Mon Sep 17 00:00:00 2001
2From: Yi Zhao <yi.zhao@windriver.com>
3Date: Sat, 2 Aug 2025 15:43:11 +0800
4Subject: [PATCH] rasdaemon: fix post-processing options
5
6Some post-processing options require an argument, otherwise a segfault
7will occur:
8
9root@qemux86-64:~# rasdaemon -p --status --ipid
10Segmentation fault (core dumped) rasdaemon -p --status --ipid
11
12According to the specification of argp, when an option requires an
13argument, we should use the 'arg' parameter, which points to the
14argument string for that option. Therefore we set char* arg for these
15options in struct argp_option and use it in parse_opt_offline function
16instead of state->argv[state->next].
17
18Fix #220
19
20Upstream-Status: Backport
21[https://github.com/mchehab/rasdaemon/commit/64bc04705ea8606eed1b1e810904cc8296e99472]
22
23Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
24Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
25---
26 rasdaemon.c | 24 ++++++++++++------------
27 1 file changed, 12 insertions(+), 12 deletions(-)
28
29diff --git a/rasdaemon.c b/rasdaemon.c
30index be5c390..9368b12 100644
31--- a/rasdaemon.c
32+++ b/rasdaemon.c
33@@ -98,22 +98,22 @@ static error_t parse_opt_offline(int key, char *arg,
34 event.smca = true;
35 break;
36 case MODEL:
37- event.model = strtoul(state->argv[state->next], NULL, 0);
38+ event.model = strtoul(arg, NULL, 0);
39 break;
40 case FAMILY:
41- event.family = strtoul(state->argv[state->next], NULL, 0);
42+ event.family = strtoul(arg, NULL, 0);
43 break;
44 case BANK_NUM:
45- event.bank = atoi(state->argv[state->next]);
46+ event.bank = atoi(arg);
47 break;
48 case IPID_REG:
49- event.ipid = strtoull(state->argv[state->next], NULL, 0);
50+ event.ipid = strtoull(arg, NULL, 0);
51 break;
52 case STATUS_REG:
53- event.status = strtoull(state->argv[state->next], NULL, 0);
54+ event.status = strtoull(arg, NULL, 0);
55 break;
56 case SYNDROME_REG:
57- event.synd = strtoull(state->argv[state->next], NULL, 0);
58+ event.synd = strtoull(arg, NULL, 0);
59 break;
60 default:
61 return ARGP_ERR_UNKNOWN;
62@@ -146,12 +146,12 @@ int main(int argc, char *argv[])
63 #ifdef HAVE_MCE
64 const struct argp_option offline_options[] = {
65 {"smca", SMCA, 0, 0, "AMD SMCA Error Decoding"},
66- {"model", MODEL, 0, 0, "CPU Model"},
67- {"family", FAMILY, 0, 0, "CPU Family"},
68- {"bank", BANK_NUM, 0, 0, "Bank Number"},
69- {"ipid", IPID_REG, 0, 0, "IPID Register (for SMCA systems only)"},
70- {"status", STATUS_REG, 0, 0, "Status Register"},
71- {"synd", SYNDROME_REG, 0, 0, "Syndrome Register"},
72+ {"model", MODEL, "MODEL", 0, "CPU Model"},
73+ {"family", FAMILY, "FAMILY", 0, "CPU Family"},
74+ {"bank", BANK_NUM, "BANK_NUM", 0, "Bank Number"},
75+ {"ipid", IPID_REG, "IPID_REG", 0, "IPID Register (for SMCA systems only)"},
76+ {"status", STATUS_REG, "STATUS_REG", 0, "Status Register"},
77+ {"synd", SYNDROME_REG, "SYNDROME_REG", 0, "Syndrome Register"},
78 {0, 0, 0, 0, 0, 0},
79 };
80
81--
822.43.0
83
diff --git a/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/rasdaemon_0.8.3.bb b/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/rasdaemon_0.8.3.bb
index 301861de38..2cc2a26acb 100644
--- a/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/rasdaemon_0.8.3.bb
+++ b/meta-oe/dynamic-layers/perl-layer/recipes-support/rasdaemon/rasdaemon_0.8.3.bb
@@ -4,6 +4,7 @@ LICENSE = "GPL-2.0-only"
4LIC_FILES_CHKSUM = "file://COPYING;md5=d3070efe0afa3dc41608bd82c00bb0dc" 4LIC_FILES_CHKSUM = "file://COPYING;md5=d3070efe0afa3dc41608bd82c00bb0dc"
5 5
6SRC_URI = "git://github.com/mchehab/rasdaemon.git;branch=master;protocol=https \ 6SRC_URI = "git://github.com/mchehab/rasdaemon.git;branch=master;protocol=https \
7 file://0001-rasdaemon-fix-post-processing-options.patch \
7 file://rasdaemon.service \ 8 file://rasdaemon.service \
8 file://init" 9 file://init"
9 10