diff --git a/backport-check_platform_device-Check-the-length-of-path.patch b/backport-check_platform_device-Check-the-length-of-path.patch new file mode 100644 index 0000000..ed1ed62 --- /dev/null +++ b/backport-check_platform_device-Check-the-length-of-path.patch @@ -0,0 +1,35 @@ +From d602002e1982a322d19034a4a64ca5a81bace7ef Mon Sep 17 00:00:00 2001 +From: Tao Liu +Date: Tue, 25 Feb 2025 16:35:34 +1300 +Subject: [PATCH] check_platform_device: Check the length of path + +The default length of path is 512, but the strcat() is used without +check if path is overflowed, otherwise a segfault is observed on +some aarch64 machines. This patch will use snprintf instead of strcat +for the buffer length checking. + +Signed-off-by: Tao Liu + +Reference:https://github.com/Irqbalance/irqbalance/commit/d602002e1982a322d19034a4a64ca5a81bace7ef +Conflict:NA +--- + procinterrupts.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/procinterrupts.c b/procinterrupts.c +index 4d04bf2..e82fac7 100644 +--- a/procinterrupts.c ++++ b/procinterrupts.c +@@ -72,7 +72,8 @@ static int check_platform_device(char *name, struct irq_info *info) + memset(path, 0, 512); + + strcat(path, "/sys/devices/platform/"); +- strcat(path, name); ++ snprintf(path + strlen(path), sizeof(path) - strlen(path) - 1, ++ "%s", name); + strcat(path, "/"); + dirfd = opendir(path); + +-- +2.28.0.windows.1 + diff --git a/irqbalance.spec b/irqbalance.spec index f6c3d2e..39459c2 100644 --- a/irqbalance.spec +++ b/irqbalance.spec @@ -1,7 +1,7 @@ Summary: A dynamic adaptive IRQ balancing daemon Name: irqbalance Version: 1.7.0 -Release: 20 +Release: 21 Epoch: 3 License: GPLv2 Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz @@ -39,6 +39,7 @@ Patch6014: backport-Fix-add-keep_going-check-to-prevent-irqbalance-from-failing- Patch6015: backport-fix-opendir-fails-in-check_platform_device.patch Patch6016: backport-check-whether-savedptr-is-NULL-before-invoking-strle.patch Patch6017: backport-procinterrupts-Fix-IRQ-name-parsing-on-certain-arm64.patch +Patch6018: backport-check_platform_device-Check-the-length-of-path.patch %description Irqbalance is a daemon to help balance the cpu load generated by @@ -96,6 +97,12 @@ fi /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : %changelog +* Tue Mar 18 2025 langfei - 3:1.7.0-21 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC: Check the length of path + * Thu Jan 5 2023 qinyu - 3:1.7.0-20 - Type:bugfix - ID:NA