mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-23 11:17:21 -08:00
app-admin/rasdaemon: fix crash in 0.8.3
Closes: https://bugs.gentoo.org/955453 Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
https://bugs.gentoo.org/955453
|
||||
https://github.com/mchehab/rasdaemon/issues/214
|
||||
https://github.com/mchehab/rasdaemon/pull/212
|
||||
|
||||
From 46bed1b6845bcb560d760b4cacea7df67cd6d1fd Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Renninger <trenn@suse.de>
|
||||
Date: Wed, 23 Apr 2025 16:40:43 +0200
|
||||
Subject: [PATCH] Fix buffer overflow in add_event_handler read
|
||||
|
||||
If the first read in ras-events.c:862 is successful, it will be tried
|
||||
to read more out of the fd, without re-allocating more memory.
|
||||
|
||||
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
||||
---
|
||||
ras-events.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/ras-events.c b/ras-events.c
|
||||
index 6692a31..c7ee801 100644
|
||||
--- a/ras-events.c
|
||||
+++ b/ras-events.c
|
||||
@@ -859,6 +859,17 @@ static int add_event_handler(struct ras_events *ras, struct tep_handle *pevent,
|
||||
}
|
||||
|
||||
do {
|
||||
+ if (size > 0) {
|
||||
+ page = realloc(page, page_size + size);
|
||||
+ if (!page) {
|
||||
+ rc = -errno;
|
||||
+ log(TERM, LOG_ERR,
|
||||
+ "Can't reallocate page to read %s:%s"
|
||||
+ " format\n", group, event);
|
||||
+ close(fd);
|
||||
+ return rc;
|
||||
+ }
|
||||
+ }
|
||||
rc = read(fd, page + size, page_size);
|
||||
if (rc < 0) {
|
||||
log(TERM, LOG_ERR, "Can't get arch page size\n");
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
https://bugs.gentoo.org/955453
|
||||
https://github.com/mchehab/rasdaemon/issues/214
|
||||
https://github.com/mchehab/rasdaemon/pull/215
|
||||
|
||||
From eb08c94a1b563c69415cb82d73d4d97f64d92d91 Mon Sep 17 00:00:00 2001
|
||||
From: Shiju Jose <shiju.jose@huawei.com>
|
||||
Date: Tue, 3 Jun 2025 16:47:39 +0100
|
||||
Subject: [PATCH 1/2] rasdaemon: Fix for return error code in
|
||||
add_event_handler()
|
||||
|
||||
Fix for return the error code in add_event_handler().
|
||||
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
---
|
||||
ras-events.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ras-events.c b/ras-events.c
|
||||
index 6692a31..3d3a4d1 100644
|
||||
--- a/ras-events.c
|
||||
+++ b/ras-events.c
|
||||
@@ -864,7 +864,7 @@ static int add_event_handler(struct ras_events *ras, struct tep_handle *pevent,
|
||||
log(TERM, LOG_ERR, "Can't get arch page size\n");
|
||||
free(page);
|
||||
close(fd);
|
||||
- return size;
|
||||
+ return rc;
|
||||
}
|
||||
size += rc;
|
||||
} while (rc > 0);
|
||||
|
||||
From 3deaaa3b3c38e594b28d696b37a64d7f79d782b4 Mon Sep 17 00:00:00 2001
|
||||
From: Shiju Jose <shiju.jose@huawei.com>
|
||||
Date: Tue, 3 Jun 2025 16:57:34 +0100
|
||||
Subject: [PATCH 2/2] rasdaemon: Revert page_size to 4096 in get_pagesize()
|
||||
|
||||
Revert page_size to 4096, which was modified in commit
|
||||
c4cee52ef7392a259cf76bc24a7aeefaf276cdfb
|
||||
("rasdaemon: Fix for parsing error when trace event's format file is
|
||||
larger than PAGE_SIZE")
|
||||
|
||||
Note:
|
||||
This will work when the event data exceed 4096, only after following
|
||||
fix is merged.
|
||||
https://github.com/mchehab/rasdaemon/pull/212
|
||||
|
||||
Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
|
||||
---
|
||||
ras-events.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ras-events.c b/ras-events.c
|
||||
index 3d3a4d1..154ec5f 100644
|
||||
--- a/ras-events.c
|
||||
+++ b/ras-events.c
|
||||
@@ -376,7 +376,7 @@ static int filter_ras_mc_event(struct ras_events *ras, char *group, char *event,
|
||||
|
||||
static int get_pagesize(struct ras_events *ras, struct tep_handle *pevent)
|
||||
{
|
||||
- int fd, len, page_size = 8192;
|
||||
+ int fd, len, page_size = 4096;
|
||||
char buf[page_size];
|
||||
|
||||
fd = open_trace(ras, "events/header_page", O_RDONLY);
|
||||
@@ -0,0 +1,75 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit flag-o-matic linux-info systemd
|
||||
|
||||
DESCRIPTION="Reliability, Availability and Serviceability logging tool"
|
||||
HOMEPAGE="https://github.com/mchehab/rasdaemon"
|
||||
SRC_URI="https://www.infradead.org/~mchehab/rasdaemon/${P}.tar.bz2"
|
||||
|
||||
LICENSE="GPL-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
|
||||
IUSE="selinux"
|
||||
|
||||
DEPEND="
|
||||
dev-db/sqlite
|
||||
dev-libs/libtraceevent
|
||||
elibc_musl? ( sys-libs/argp-standalone )
|
||||
"
|
||||
RDEPEND="
|
||||
${DEPEND}
|
||||
dev-perl/DBI
|
||||
dev-perl/DBD-SQLite
|
||||
sys-apps/dmidecode
|
||||
selinux? ( sec-policy/selinux-rasdaemon )
|
||||
"
|
||||
BDEPEND="sys-devel/gettext"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}"/${PN}-0.8.3-fortify-add_event_handler.patch
|
||||
"${FILESDIR}"/${PN}-0.8.3-fortify-followup.patch
|
||||
)
|
||||
|
||||
pkg_setup() {
|
||||
linux-info_pkg_setup
|
||||
local CONFIG_CHECK="~ACPI_EXTLOG ~DEBUG_FS"
|
||||
check_extra_config
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local myconfargs=(
|
||||
--enable-sqlite3
|
||||
--enable-abrt-report
|
||||
--enable-aer
|
||||
--enable-arm
|
||||
--enable-extlog
|
||||
--enable-hisi-ns-decode
|
||||
--enable-mce
|
||||
--enable-non-standard
|
||||
--enable-devlink
|
||||
--enable-diskerror
|
||||
--enable-memory-ce-pfa
|
||||
--includedir="${EPREFIX}/usr/include/${PN}"
|
||||
--localstatedir=/var
|
||||
)
|
||||
|
||||
use elibc_musl && append-libs -largp
|
||||
|
||||
# More bashisms snuck into 0.8.2, not yet reported upstream
|
||||
CONFIG_SHELL="${BROOT}"/bin/bash econf "${myconfargs[@]}"
|
||||
}
|
||||
|
||||
src_install() {
|
||||
default
|
||||
|
||||
keepdir "/var/lib/${PN}"
|
||||
|
||||
systemd_dounit misc/*.service
|
||||
|
||||
newinitd "${FILESDIR}/rasdaemon.openrc-r2" rasdaemon
|
||||
newinitd "${FILESDIR}/ras-mc-ctl.openrc-r1" ras-mc-ctl
|
||||
newconfd "${FILESDIR}"/rasdaemon.confd rasdaemon
|
||||
}
|
||||
Reference in New Issue
Block a user