bugfix:fix potential dead loop when parsing interrupts
when parsing /proc/interrupts and if a chip name start with numbers, current procedure would consider those numbers as interrupt count thus lead to miscount. Failed parsing would trigger new parsing and cause dead loop which can't be stopped by SIGINT and SIGTERM. So fix this by adding signal checks in loop. Signed-off-by: qinyu <qinyu32@huawei.com>
This commit is contained in:
parent
e7f36dd076
commit
9ba312d482
@ -0,0 +1,26 @@
|
||||
From 028082a6a1ff650d5cdf796ac55ac26a3874372a Mon Sep 17 00:00:00 2001
|
||||
From: Liu Chao <liuchao173@huawei.com>
|
||||
Date: Sat, 25 Jun 2022 14:13:10 +0800
|
||||
Subject: [PATCH] add keep_going check to prevent irqbalance from failing to
|
||||
exit after SIGTERM
|
||||
|
||||
Signed-off-by: Liu Chao <liuchao173@huawei.com>
|
||||
---
|
||||
irqbalance.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/irqbalance.c b/irqbalance.c
|
||||
index c520c11..5eae5b6 100644
|
||||
--- a/irqbalance.c
|
||||
+++ b/irqbalance.c
|
||||
@@ -290,7 +290,7 @@ gboolean scan(gpointer data __attribute__((unused)))
|
||||
|
||||
|
||||
/* cope with cpu hotplug -- detected during /proc/interrupts parsing */
|
||||
- while (need_rescan || need_rebuild) {
|
||||
+ while (keep_going && (need_rescan || need_rebuild)) {
|
||||
int try_times = 0;
|
||||
|
||||
need_rescan = 0;
|
||||
--
|
||||
2.23.0
|
||||
@ -0,0 +1,25 @@
|
||||
From 0a82dddbaf5702caded0d0d83a6eafaca743254d Mon Sep 17 00:00:00 2001
|
||||
From: Andreas Schwab <schwab@suse.de>
|
||||
Date: Mon, 27 Jun 2022 13:43:04 +0200
|
||||
Subject: [PATCH] parse_proc_interrupts: fix parsing interrupt counts
|
||||
|
||||
The name of an interrupt chip can start with a number, stop before it.
|
||||
---
|
||||
procinterrupts.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/procinterrupts.c b/procinterrupts.c
|
||||
index 57c8801..d90bf6d 100644
|
||||
--- a/procinterrupts.c
|
||||
+++ b/procinterrupts.c
|
||||
@@ -331,7 +331,7 @@ void parse_proc_interrupts(void)
|
||||
while (1) {
|
||||
uint64_t C;
|
||||
C = strtoull(c, &c2, 10);
|
||||
- if (c==c2) /* end of numbers */
|
||||
+ if (c==c2 || !strchr(" \t", *c2)) /* end of numbers */
|
||||
break;
|
||||
count += C;
|
||||
c=c2;
|
||||
--
|
||||
2.23.0
|
||||
@ -1,7 +1,7 @@
|
||||
Summary: A dynamic adaptive IRQ balancing daemon
|
||||
Name: irqbalance
|
||||
Version: 1.9.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
Epoch: 3
|
||||
License: GPLv2
|
||||
Source0: https://github.com/Irqbalance/irqbalance/archive/v%{version}.tar.gz#/irqbalance-%{version}.tar.gz
|
||||
@ -23,6 +23,9 @@ Requires: numactl-libs
|
||||
|
||||
%define _hardened_build 1
|
||||
|
||||
Patch6000: bugfix-parse_proc_interrupts-fix-parsing-interrupt-counts.patch
|
||||
Patch6001: bugfix-add-keep_going-check-to-prevent-irqbalance-from-failing-to-exit-after-SIGTERM.patch
|
||||
|
||||
Patch9000: feature-aarch64-add-the-regular-to-get-the-correct-i.patch
|
||||
Patch9001: feature-add-new-user-irq-policy-config-rule.patch
|
||||
Patch9002: feature-add-the-switch-of-printing-log.patch
|
||||
@ -119,6 +122,12 @@ fi
|
||||
/sbin/chkconfig --del %{name} >/dev/null 2>&1 || :
|
||||
|
||||
%changelog
|
||||
* Tue Jul 12 2022 qinyu <qinyu32@huawei.com> - 3:1.9.0-2
|
||||
- Type:bugfix
|
||||
- ID:NA
|
||||
- SUG:restart
|
||||
- DESC: fix potential dead loop when parsing interrupts
|
||||
|
||||
* Thu Jul 7 2022 Liu Chao <liuchao173@huawei.com> - 3:1.9.0-1
|
||||
- Type:enhanced
|
||||
- ID:NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user