diff --git a/0001-Safer-string-handling-in-procinterrupts.c.patch b/0001-Safer-string-handling-in-procinterrupts.c.patch new file mode 100644 index 0000000..45700f9 --- /dev/null +++ b/0001-Safer-string-handling-in-procinterrupts.c.patch @@ -0,0 +1,42 @@ +From 030edf9aeb7310821df76f3c2965e3d3540e5bba Mon Sep 17 00:00:00 2001 +From: Jiri BlueBear Dluhos +Date: Tue, 10 Jun 2025 00:26:47 +0200 +Subject: [PATCH 1/3] Safer string handling in procinterrupts.c. + +--- + procinterrupts.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index 8303ad3..16dcff2 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -55,7 +55,7 @@ struct irq_match { + static int check_platform_device(char *name, struct irq_info *info) + { + DIR *dirfd; +- char path[512]; ++ char path[PATH_MAX]; + struct dirent *ent; + int rc = -ENOENT, i; + static struct pdev_irq_info { +@@ -69,12 +69,11 @@ static int check_platform_device(char *name, struct irq_info *info) + {NULL}, + }; + +- memset(path, 0, 512); ++ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s", name) == PATH_MAX) { ++ log(TO_ALL, LOG_ERROR, "Device path in /sys exceeds maximum length"); ++ return -ENAMETOOLONG; ++ } + +- strcat(path, "/sys/devices/platform/"); +- snprintf(path + strlen(path), sizeof(path) - strlen(path) - 1, +- "%s", name); +- strcat(path, "/"); + dirfd = opendir(path); + + if (!dirfd) { +-- +2.47.0 + diff --git a/0002-Added-missing-and-fixed-message-in-procinterrupts.c.patch b/0002-Added-missing-and-fixed-message-in-procinterrupts.c.patch new file mode 100644 index 0000000..1995fe7 --- /dev/null +++ b/0002-Added-missing-and-fixed-message-in-procinterrupts.c.patch @@ -0,0 +1,27 @@ +From 5fdc1d64083ab92f63cdd9d4f2f01587cf8eab28 Mon Sep 17 00:00:00 2001 +From: Jiri BlueBear Dluhos +Date: Tue, 10 Jun 2025 00:51:43 +0200 +Subject: [PATCH 2/3] Added missing '/' and fixed message in procinterrupts.c. + +--- + procinterrupts.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index 16dcff2..ab31cdb 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -69,8 +69,8 @@ static int check_platform_device(char *name, struct irq_info *info) + {NULL}, + }; + +- if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s", name) == PATH_MAX) { +- log(TO_ALL, LOG_ERROR, "Device path in /sys exceeds maximum length"); ++ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) == PATH_MAX) { ++ log(TO_ALL, LOG_WARNING, "WARNING: Platform device path in /sys exceeds PATH_MAX, cannot examine"); + return -ENAMETOOLONG; + } + +-- +2.47.0 + diff --git a/0003-Fixed-incorrect-comparison-in-snprintf-in-procinterr.patch b/0003-Fixed-incorrect-comparison-in-snprintf-in-procinterr.patch new file mode 100644 index 0000000..ddc26e3 --- /dev/null +++ b/0003-Fixed-incorrect-comparison-in-snprintf-in-procinterr.patch @@ -0,0 +1,26 @@ +From 14fb83896e44d1efe03963658574204696051397 Mon Sep 17 00:00:00 2001 +From: Jiri BlueBear Dluhos +Date: Tue, 10 Jun 2025 11:00:14 +0200 +Subject: [PATCH 3/3] Fixed incorrect comparison in snprintf() in + procinterrupts.c. + +--- + procinterrupts.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index ab31cdb..ebfb762 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -69,7 +69,7 @@ static int check_platform_device(char *name, struct irq_info *info) + {NULL}, + }; + +- if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) == PATH_MAX) { ++ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) >= PATH_MAX) { + log(TO_ALL, LOG_WARNING, "WARNING: Platform device path in /sys exceeds PATH_MAX, cannot examine"); + return -ENAMETOOLONG; + } +-- +2.47.0 + diff --git a/irqbalance.spec b/irqbalance.spec index a0c5fa9..b8cbd65 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,6 +1,6 @@ Name: irqbalance Version: 1.9.4 -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 2 Summary: IRQ balancing daemon @@ -77,6 +77,10 @@ Patch54: 0004-Increase-file-descriptor-limit-via-systemd-service-f.patch Patch55: irqbalance-1.9.0-environment-file-sysconfig.patch +Patch56: 0001-Safer-string-handling-in-procinterrupts.c.patch +Patch57: 0002-Added-missing-and-fixed-message-in-procinterrupts.c.patch +Patch58: 0003-Fixed-incorrect-comparison-in-snprintf-in-procinterr.patch + %description irqbalance is a daemon that evenly distributes IRQ load across multiple CPUs for enhanced performance. @@ -120,6 +124,9 @@ make check %systemd_postun_with_restart irqbalance.service %changelog +* Tue Sep 30 2025 Tao Liu - 2:1.9.4-5 +- Rebase to upstream commit (8e8945e509) + * Wed May 14 2025 Tao Liu - 2:1.9.4-4 - Rebase to upstream commit (d913f60d84)