Skip to content

Commit

Permalink
Patch irqbalance to fix incorrect balancing behavior (microsoft#6359)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbeberman committed Oct 9, 2023
1 parent 34d82e4 commit e81ed2e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
25 changes: 25 additions & 0 deletions SPECS/irqbalance/fix-load-unsigned-overflow.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 2a66a666d3e202dec5b1a4309447e32d5f292871 Mon Sep 17 00:00:00 2001
From: liuchao173 <[email protected]>
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.

Signed-off-by: Henry Beberman <[email protected]>
---
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) {
6 changes: 5 additions & 1 deletion SPECS/irqbalance/irqbalance.spec
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Summary: Irqbalance daemon
Name: irqbalance
Version: 1.8.0
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
URL: https://github.com/Irqbalance/irqbalance
Group: System Environment/Services
Vendor: Microsoft Corporation
Distribution: Mariner
Source0: https://github.com/Irqbalance/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: fix-format-security.patch
Patch1: fix-load-unsigned-overflow.patch
BuildRequires: systemd-devel
BuildRequires: glib-devel
Requires: systemd
Expand Down Expand Up @@ -57,6 +58,9 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
%{_datadir}/*

%changelog
* Fri Oct 06 2023 Henry Beberman <[email protected]> - 1.8.0-4
- Apply upstream fix for unsigned subtraction overflow in load calculation

* Wed Sep 20 2023 Jon Slobodzian <[email protected]> - 1.8.0-3
- Recompile with stack-protection fixed gcc version (CVE-2023-4039)

Expand Down

0 comments on commit e81ed2e

Please sign in to comment.