diff --git a/fix-unsigned-integer-subtraction-sign-overflow.patch b/fix-unsigned-integer-subtraction-sign-overflow.patch new file mode 100644 index 0000000..e8d3969 --- /dev/null +++ b/fix-unsigned-integer-subtraction-sign-overflow.patch @@ -0,0 +1,26 @@ +From 2a66a666d3e202dec5b1a4309447e32d5f292871 Mon Sep 17 00:00:00 2001 +From: liuchao173 <55137861+liuchao173@users.noreply.github.com> +Date: Tue, 24 Aug 2021 20:50:18 +0800 +Subject: [PATCH] fix unsigned integer subtraction sign overflow + +Min_load, adjustment_load and load are unsigned integers, so it overflows when (lb_info->min_load + info->load) < (lb_info->adjustment_load - info->load). The result will be greater than zero. Therefore the irq cannot be selected to rebalanced. +--- + irqlist.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/irqlist.c b/irqlist.c +index 9ab321a..4dd4a83 100644 +--- a/irqlist.c ++++ b/irqlist.c +@@ -97,7 +97,7 @@ static void move_candidate_irqs(struct irq_info *info, void *data) + } + + /* If we can migrate an irq without swapping the imbalance do it. */ +- if ((lb_info->min_load + info->load) - (lb_info->adjustment_load - info->load) < delta_load) { ++ if ((lb_info->min_load + info->load) < delta_load + (lb_info->adjustment_load - info->load)) { + lb_info->adjustment_load -= info->load; + lb_info->min_load += info->load; + if (lb_info->min_load > lb_info->adjustment_load) { +-- +1.8.3.1 + diff --git a/irqbalance.spec b/irqbalance.spec index 4e1e217..5ca6090 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: 3 +Release: 4 Epoch: 3 License: GPLv2 Source0: https://github.com/Irqbalance/irqbalance/archive/irqbalance-%{version}.tar.gz @@ -21,6 +21,8 @@ Requires: numactl-libs %define _hardened_build 1 +Patch6000: fix-unsigned-integer-subtraction-sign-overflow.patch + %description Irqbalance is a daemon to help balance the cpu load generated by interrupts across all of a systems cpus. Irqbalance identifies the @@ -77,6 +79,12 @@ fi /sbin/chkconfig --del %{name} >/dev/null 2>&1 || : %changelog +* Wed Aug 25 2021 Liu Chao - 3:1.7.0-4 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix unsigned integer subtraction sign overflow + * Mon May 10 2021 Liu Chao - 3:1.7.0-3 - Type:bugfix - ID:NA