!70 backport patches from upstream

From: @renxichen 
Reviewed-by: @znzjugod, @gaoruoshu 
Signed-off-by: @gaoruoshu
This commit is contained in:
openeuler-ci-bot 2023-03-24 03:23:16 +00:00 committed by Gitee
commit 37421fcfaf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 134 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From ce33041e0abfa20054ff5d6874ffbd1ab592558d Mon Sep 17 00:00:00 2001
From: Aristeu Rozanski <arozansk@redhat.com>
Date: Thu, 19 Jan 2023 08:45:57 -0500
Subject: [PATCH] rasdaemon: ras-memory-failure-handler: handle localtime()
failure correctly
We could just have an empty string but keeping the format could prevent
issues if someone is actually parsing this.
Found with covscan.
v2: fixed the timestamp as pointed by Robert Elliott
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-memory-failure-handler.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ras-memory-failure-handler.c b/ras-memory-failure-handler.c
index 9941e68..1951456 100644
--- a/ras-memory-failure-handler.c
+++ b/ras-memory-failure-handler.c
@@ -148,6 +148,8 @@ int ras_memory_failure_event_handler(struct trace_seq *s,
if (tm)
strftime(ev.timestamp, sizeof(ev.timestamp),
"%Y-%m-%d %H:%M:%S %z", tm);
+ else
+ strncpy(ev.timestamp, "1970-01-01 00:00:00 +0000", sizeof(ev.timestamp));
trace_seq_printf(s, "%s ", ev.timestamp);
if (pevent_get_field_val(s, event, "pfn", record, &val, 1) < 0)
--
2.27.0

View File

@ -0,0 +1,93 @@
From 899fcc2cf21c86b5462c8f4441cd9c92b3d75f7d Mon Sep 17 00:00:00 2001
From: Aristeu Rozanski <arozansk@redhat.com>
Date: Thu, 19 Jan 2023 08:45:57 -0500
Subject: [PATCH] rasdaemon: ras-report: fix possible but unlikely file
descriptor leak
Found with covscan.
Signed-off-by: Aristeu Rozanski <arozansk@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-report.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ras-report.c b/ras-report.c
index ea3a9b6..62d5eb7 100644
--- a/ras-report.c
+++ b/ras-report.c
@@ -434,7 +434,7 @@ int ras_report_mc_event(struct ras_events *ras, struct ras_mc_event *ev){
mc_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -484,7 +484,7 @@ int ras_report_aer_event(struct ras_events *ras, struct ras_aer_event *ev){
aer_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -533,7 +533,7 @@ int ras_report_non_standard_event(struct ras_events *ras, struct ras_non_standar
non_standard_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -578,7 +578,7 @@ int ras_report_arm_event(struct ras_events *ras, struct ras_arm_event *ev){
arm_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -624,7 +624,7 @@ int ras_report_mce_event(struct ras_events *ras, struct mce_event *ev){
mce_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -674,7 +674,7 @@ int ras_report_devlink_event(struct ras_events *ras, struct devlink_event *ev){
devlink_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -723,7 +723,7 @@ int ras_report_diskerror_event(struct ras_events *ras, struct diskerror_event *e
done = 1;
diskerror_fail:
- if(sockfd > 0){
+ if(sockfd >= 0){
close(sockfd);
}
@@ -768,7 +768,7 @@ int ras_report_mf_event(struct ras_events *ras, struct ras_mf_event *ev)
done = 1;
mf_fail:
- if (sockfd > 0)
+ if (sockfd >= 0)
close(sockfd);
if (done)
--
2.27.0

View File

@ -1,6 +1,6 @@
Name: rasdaemon
Version: 0.6.8
Release: 1
Release: 2
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
@ -19,6 +19,9 @@ Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Patch6000: backport-rasdaemon-ras-memory-failure-handler-handle-localtim.patch
Patch6001: backport-rasdaemon-ras-report-fix-possible-but-unlikely-file-.patch
Patch9000: bugfix-rasdaemon-wait-for-file-access.patch
Patch9001: bugfix-fix-fd-check.patch
Patch9002: bugfix-fix-disk-error-log-storm.patch
@ -78,6 +81,9 @@ rm INSTALL %{buildroot}/usr/include/*.h
/usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || :
%changelog
* Fri Mar 24 2023 renhongxun <renhongxun@h-partners.com> - 0.6.8-2
- backport patches from upstream
* Thu Jan 19 2023 Lv Ying <lvying6@huawei.com> - 0.6.8-1
- backport bugfix patches from community:
1. Fix error print handle_ras_events.