import irqbalance-1.4.0-4.el8

This commit is contained in:
CentOS Sources 2019-11-05 17:02:38 -05:00 committed by Andrew Lukoshko
parent 919826172a
commit e3022d66c2
2 changed files with 79 additions and 1 deletions

View File

@ -0,0 +1,73 @@
From 721460664afad79e2d96bbcb173eda68eed9743b Mon Sep 17 00:00:00 2001
From: Gerd Rausch <gerd.rausch@oracle.com>
Date: Thu, 18 Oct 2018 11:21:40 -0700
Subject: [PATCH] Fix ambiguous parsing of *node* entries in /sys.
The code used to use strstr(..., "node") while iterating over
sysfs directories such as /sys/devices/system/cpu/cpu*.
It then made an assumption that the entry would start with "node",
which is not necessarily the case (e.g. the "firmware_node" entry).
The code happened to work for as long as the node[0-9]* entry
would be processed before the "firmware_node" entry shows up.
A change to the linux kernel "end_name_hash" function resulted
in a different hash, and ultimately in a different order
by which entries were returned by readdir(3).
This led to the exposure of this bug.
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
---
cputree.c | 11 ++++++++---
numa.c | 5 ++++-
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/cputree.c b/cputree.c
index c88143f..f08ce84 100644
--- a/cputree.c
+++ b/cputree.c
@@ -368,9 +368,14 @@ static void do_one_cpu(char *path)
entry = readdir(dir);
if (!entry)
break;
- if (strstr(entry->d_name, "node")) {
- nodeid = strtoul(&entry->d_name[4], NULL, 10);
- break;
+ if (strncmp(entry->d_name, "node", 4) == 0) {
+ char *end;
+ int num;
+ num = strtol(entry->d_name + 4, &end, 10);
+ if (!*end && num >= 0) {
+ nodeid = num;
+ break;
+ }
}
} while (entry);
closedir(dir);
diff --git a/numa.c b/numa.c
index cd67ec8..f0b1a98 100644
--- a/numa.c
+++ b/numa.c
@@ -29,6 +29,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
+#include <ctype.h>
#include <sys/types.h>
#include <dirent.h>
@@ -115,7 +116,9 @@ void build_numa_node_list(void)
entry = readdir(dir);
if (!entry)
break;
- if ((entry->d_type == DT_DIR) && (strstr(entry->d_name, "node"))) {
+ if ((entry->d_type == DT_DIR) &&
+ (strncmp(entry->d_name, "node", 4) == 0) &&
+ isdigit(entry->d_name[4])) {
add_one_node(entry->d_name);
}
} while (entry);
--
2.21.0

View File

@ -1,6 +1,6 @@
Name: irqbalance Name: irqbalance
Version: 1.4.0 Version: 1.4.0
Release: 3%{?dist} Release: 4%{?dist}
Epoch: 2 Epoch: 2
Summary: IRQ balancing daemon Summary: IRQ balancing daemon
@ -29,6 +29,7 @@ Patch3: irqbalance-1.4.0-Fix-an-possible-overflow-error.patch
Patch4: irqbalance-1.5.0-Don-t-leak-socket-fd-on-connection-error.patch Patch4: irqbalance-1.5.0-Don-t-leak-socket-fd-on-connection-error.patch
Patch5: irqbalance-1.4.0-procinterrupts-check-xen-dyn-event-more-flexible.patch Patch5: irqbalance-1.4.0-procinterrupts-check-xen-dyn-event-more-flexible.patch
Patch6: irqbalance-1.5.0-Update-document-and-remove-dead-options.patch Patch6: irqbalance-1.5.0-Update-document-and-remove-dead-options.patch
Patch7: irqbalance-1.4.0-Fix-ambiguous-parsing-of-node-entries-in-sys.patch
%description %description
irqbalance is a daemon that evenly distributes IRQ load across irqbalance is a daemon that evenly distributes IRQ load across
@ -42,6 +43,7 @@ multiple CPUs for enhanced performance.
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1
%build %build
./autogen.sh ./autogen.sh
@ -82,6 +84,9 @@ fi
/sbin/chkconfig --del irqbalance >/dev/null 2>&1 || : /sbin/chkconfig --del irqbalance >/dev/null 2>&1 || :
%changelog %changelog
* Wed Jul 31 2019 Kairui Song <kasong@redhat.com> 2:1.4.0-4
- Fix ambiguous parsing of *node* entries in /sys. (bz1730546)
* Mon Mar 25 2019 Kairui Song <kasong@redhat.com> 2:1.4.0-3 * Mon Mar 25 2019 Kairui Song <kasong@redhat.com> 2:1.4.0-3
- Update document and remove dead options to fix manpage scan warning (bz1612706) - Update document and remove dead options to fix manpage scan warning (bz1612706)
- Fix gating test error (bz1680619) - Fix gating test error (bz1680619)