Release 1.9.4-6
Rebase to upstream commit (8e8945e509) Resolves: RHEL-114947 Resolves: RHEL-111608 Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
parent
86c1102141
commit
8e6aa8aebf
42
0001-Safer-string-handling-in-procinterrupts.c.patch
Normal file
42
0001-Safer-string-handling-in-procinterrupts.c.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 030edf9aeb7310821df76f3c2965e3d3540e5bba Mon Sep 17 00:00:00 2001
|
||||
From: Jiri BlueBear Dluhos <jiri.bluebear.dluhos@gmail.com>
|
||||
Date: Tue, 10 Jun 2025 00:26:47 +0200
|
||||
Subject: [PATCH 1/3] Safer string handling in procinterrupts.c.
|
||||
|
||||
---
|
||||
procinterrupts.c | 11 +++++------
|
||||
1 file changed, 5 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/procinterrupts.c b/procinterrupts.c
|
||||
index 8303ad3..16dcff2 100644
|
||||
--- a/procinterrupts.c
|
||||
+++ b/procinterrupts.c
|
||||
@@ -55,7 +55,7 @@ struct irq_match {
|
||||
static int check_platform_device(char *name, struct irq_info *info)
|
||||
{
|
||||
DIR *dirfd;
|
||||
- char path[512];
|
||||
+ char path[PATH_MAX];
|
||||
struct dirent *ent;
|
||||
int rc = -ENOENT, i;
|
||||
static struct pdev_irq_info {
|
||||
@@ -69,12 +69,11 @@ static int check_platform_device(char *name, struct irq_info *info)
|
||||
{NULL},
|
||||
};
|
||||
|
||||
- memset(path, 0, 512);
|
||||
+ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s", name) == PATH_MAX) {
|
||||
+ log(TO_ALL, LOG_ERROR, "Device path in /sys exceeds maximum length");
|
||||
+ return -ENAMETOOLONG;
|
||||
+ }
|
||||
|
||||
- strcat(path, "/sys/devices/platform/");
|
||||
- snprintf(path + strlen(path), sizeof(path) - strlen(path) - 1,
|
||||
- "%s", name);
|
||||
- strcat(path, "/");
|
||||
dirfd = opendir(path);
|
||||
|
||||
if (!dirfd) {
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
From 499688321313a11d32a4e0386833472da026d68a Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Renninger <trenn@suse.de>
|
||||
Date: Thu, 3 Apr 2025 17:51:23 +0200
|
||||
Subject: [PATCH 1/4] Unify meson and autoconf: Install executables to sbin
|
||||
|
||||
---
|
||||
meson.build | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index d26ef42..0441b30 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -35,6 +35,7 @@ if cdata.get('HAVE_IRQBALANCEUI')
|
||||
'ui/ui.c',
|
||||
dependencies: [glib_dep, ncurses_dep],
|
||||
install: true,
|
||||
+ install_dir : get_option('sbindir'),
|
||||
)
|
||||
|
||||
install_man('irqbalance-ui.1')
|
||||
@@ -63,6 +64,7 @@ executable(
|
||||
irqbalance_sources,
|
||||
dependencies: [glib_dep, m_dep, capng_dep, libnl_3_dep, libnl_genl_3_dep, numa_dep, systemd_dep],
|
||||
install: true,
|
||||
+ install_dir : get_option('sbindir'),
|
||||
)
|
||||
|
||||
install_man('irqbalance.1')
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
From 5fdc1d64083ab92f63cdd9d4f2f01587cf8eab28 Mon Sep 17 00:00:00 2001
|
||||
From: Jiri BlueBear Dluhos <jiri.bluebear.dluhos@gmail.com>
|
||||
Date: Tue, 10 Jun 2025 00:51:43 +0200
|
||||
Subject: [PATCH 2/3] Added missing '/' and fixed message in procinterrupts.c.
|
||||
|
||||
---
|
||||
procinterrupts.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/procinterrupts.c b/procinterrupts.c
|
||||
index 16dcff2..ab31cdb 100644
|
||||
--- a/procinterrupts.c
|
||||
+++ b/procinterrupts.c
|
||||
@@ -69,8 +69,8 @@ static int check_platform_device(char *name, struct irq_info *info)
|
||||
{NULL},
|
||||
};
|
||||
|
||||
- if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s", name) == PATH_MAX) {
|
||||
- log(TO_ALL, LOG_ERROR, "Device path in /sys exceeds maximum length");
|
||||
+ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) == PATH_MAX) {
|
||||
+ log(TO_ALL, LOG_WARNING, "WARNING: Platform device path in /sys exceeds PATH_MAX, cannot examine");
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
|
||||
--
|
||||
2.47.0
|
||||
|
||||
259
0002-Properly-embed-EnvironmentFile-sourced-systemd-confi.patch
Normal file
259
0002-Properly-embed-EnvironmentFile-sourced-systemd-confi.patch
Normal file
@ -0,0 +1,259 @@
|
||||
From 41cb97c714e6216ab7f10f8aaa51a2548da3acc7 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Renninger <trenn@suse.de>
|
||||
Date: Mon, 7 Apr 2025 09:09:31 +0200
|
||||
Subject: [PATCH 2/4] Properly embed EnvironmentFile sourced systemd configs
|
||||
into meson and autonconf
|
||||
|
||||
Commit 724243f introduced a 2nd environment file.
|
||||
|
||||
This patch fixes that both files are optional.
|
||||
There should be one mandatory EnvironmentFile provided by package install as
|
||||
before which lives in e.g. /usr/lib
|
||||
and one optional one that users/admins can place into /etc/...
|
||||
|
||||
Before the replacement of both EnvironmentFile directives was fragile, e.g.
|
||||
a spec file's sed could easily result in overwriting both EnvironmentFile
|
||||
occurences silently pointing to the same location.
|
||||
|
||||
This patch properly integrates the paths into meson and autoconf by
|
||||
introducing 2 configurable directories, defaults set to:
|
||||
/usr/etc/default
|
||||
for the mandatory, package provided config file and
|
||||
/etc/default
|
||||
for the optional admin override conf file.
|
||||
It renames misc/irqbalance.service to misc/irqbalance.service.in and replaces
|
||||
the paths via AC_SUBST/AC_CONFIG_FILES (autoconf) or configure_file (meson)
|
||||
via pkgconfdir and usrconfdir introduced configure/setup options:
|
||||
+EnvironmentFile=@pkgconfdir@/irqbalance.env
|
||||
+EnvironmentFile=-@usrconfdir@/irqbalance
|
||||
|
||||
irqbalance.service is now installed via autoconf/meson, by trying to fetch
|
||||
systemd's unitdir via pkgconfig.
|
||||
---
|
||||
Makefile.am | 5 ++++-
|
||||
configure.ac | 19 +++++++++++++++++
|
||||
meson.build | 37 +++++++++++++++++++++++++++++++++
|
||||
meson_options.txt | 8 ++++++++
|
||||
misc/irqbalance.service | 42 --------------------------------------
|
||||
misc/irqbalance.service.in | 42 ++++++++++++++++++++++++++++++++++++++
|
||||
6 files changed, 110 insertions(+), 43 deletions(-)
|
||||
delete mode 100644 misc/irqbalance.service
|
||||
create mode 100644 misc/irqbalance.service.in
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index 80d8fee..ed40628 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -22,7 +22,10 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
-EXTRA_DIST = COPYING autogen.sh misc/irqbalance.service misc/irqbalance.env
|
||||
+EXTRA_DIST = COPYING autogen.sh
|
||||
+
|
||||
+systemdsystemunit_DATA = misc/irqbalance.service
|
||||
+pkgconf_DATA = misc/irqbalance.env
|
||||
|
||||
SUBDIRS = tests
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index 678f66e..6983c4a 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -115,6 +115,24 @@ AS_IF(
|
||||
]
|
||||
)
|
||||
|
||||
+AC_ARG_WITH([pkgconfdir],
|
||||
+ [AS_HELP_STRING([--with-pkgconfdir=DIR],
|
||||
+ [Systemd Environment configs sourced by irqbalanced])],
|
||||
+ [pkgconfdir=$withval],
|
||||
+ [pkgconfdir="$prefix/etc/default"])
|
||||
+AC_SUBST([pkgconfdir])
|
||||
+
|
||||
+AC_ARG_WITH([usrconfdir],
|
||||
+ [AS_HELP_STRING([--with-usrconfdir=DIR],
|
||||
+ [Systemd Environment user configs sourced by irqbalanced])],
|
||||
+ [usrconfdir=$withval],
|
||||
+ [usrconfdir="${sysconfdir}/default"])
|
||||
+AC_SUBST([usrconfdir])
|
||||
+
|
||||
+AC_CONFIG_FILES([misc/irqbalance.service])
|
||||
+
|
||||
+PKG_CHECK_VAR([systemdsystemunitdir], [systemd], [systemdsystemunitdir])
|
||||
+
|
||||
AC_OUTPUT(Makefile tests/Makefile)
|
||||
|
||||
AC_MSG_NOTICE()
|
||||
@@ -123,3 +141,4 @@ AC_MSG_NOTICE([Target: $target])
|
||||
AC_MSG_NOTICE([Installation prefix: $prefix])
|
||||
AC_MSG_NOTICE([Compiler: $CC])
|
||||
AC_MSG_NOTICE([Compiler flags: $CFLAGS])
|
||||
+AC_MSG_NOTICE([Systemdunitdir: $systemdsystemunitdir])
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 0441b30..b69c224 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -14,6 +14,13 @@ numa_dep = cc.find_library('numa', required: get_option('numa'))
|
||||
libnl_3_dep = dependency('libnl-3.0', required: get_option('thermal'))
|
||||
libnl_genl_3_dep = dependency('libnl-genl-3.0', required: get_option('thermal'))
|
||||
systemd_dep = dependency('libsystemd', required: get_option('systemd'))
|
||||
+systemd_dir_dep = dependency('systemd', required: get_option('systemd'))
|
||||
+
|
||||
+systemdsystemunitdir = systemd_dir_dep.get_variable(
|
||||
+ pkgconfig: 'systemdsystemunitdir',
|
||||
+ default_value: get_option('prefix') / 'lib/systemd/system'
|
||||
+)
|
||||
+
|
||||
|
||||
cdata = configuration_data()
|
||||
cdata.set('HAVE_GETOPT_LONG', cc.has_function('getopt_long'))
|
||||
@@ -68,3 +75,33 @@ executable(
|
||||
)
|
||||
|
||||
install_man('irqbalance.1')
|
||||
+
|
||||
+if systemd_dep.found()
|
||||
+ pkgconfdir = get_option('pkgconfdir')
|
||||
+ usrconfdir = get_option('usrconfdir')
|
||||
+
|
||||
+# Set defaults
|
||||
+ if pkgconfdir == ''
|
||||
+ pkgconfdir = get_option('prefix') / 'etc/default'
|
||||
+ endif
|
||||
+ if usrconfdir == ''
|
||||
+ usrconfdir = get_option('sysconfdir') / 'default'
|
||||
+ endif
|
||||
+
|
||||
+ idata = configuration_data()
|
||||
+ idata.set('usrconfdir', usrconfdir)
|
||||
+ idata.set('pkgconfdir', pkgconfdir)
|
||||
+
|
||||
+ configure_file(
|
||||
+ input: 'misc/irqbalance.service.in',
|
||||
+ output: 'irqbalance.service',
|
||||
+ install_dir: systemdsystemunitdir,
|
||||
+ configuration: idata
|
||||
+ )
|
||||
+ configure_file(
|
||||
+ input: 'misc/irqbalance.env',
|
||||
+ output: 'irqbalance.env',
|
||||
+ install_dir: pkgconfdir,
|
||||
+ configuration: idata
|
||||
+ )
|
||||
+endif
|
||||
diff --git a/meson_options.txt b/meson_options.txt
|
||||
index 53cc121..c4967f7 100644
|
||||
--- a/meson_options.txt
|
||||
+++ b/meson_options.txt
|
||||
@@ -17,3 +17,11 @@ option('thermal', type : 'feature',
|
||||
option('ui', type : 'feature',
|
||||
description : 'Build the UI component',
|
||||
)
|
||||
+
|
||||
+option('usrconfdir', type: 'string',
|
||||
+ description: 'Directory to systemd environment file, optionally added by user'
|
||||
+)
|
||||
+
|
||||
+option('pkgconfdir', type: 'string',
|
||||
+ description: 'Directory to systemd environment file, provided by irqbalance'
|
||||
+)
|
||||
diff --git a/misc/irqbalance.service b/misc/irqbalance.service
|
||||
deleted file mode 100644
|
||||
index 7e0c5d8..0000000
|
||||
--- a/misc/irqbalance.service
|
||||
+++ /dev/null
|
||||
@@ -1,42 +0,0 @@
|
||||
-[Unit]
|
||||
-Description=irqbalance daemon
|
||||
-Documentation=man:irqbalance(1)
|
||||
-Documentation=https://github.com/Irqbalance/irqbalance
|
||||
-ConditionVirtualization=!container
|
||||
-ConditionCPUs=>1
|
||||
-
|
||||
-[Service]
|
||||
-EnvironmentFile=-/usr/lib/irqbalance/defaults.env
|
||||
-EnvironmentFile=-/path/to/irqbalance.env
|
||||
-ExecStart=/usr/sbin/irqbalance $IRQBALANCE_ARGS
|
||||
-CapabilityBoundingSet=CAP_SETPCAP
|
||||
-NoNewPrivileges=yes
|
||||
-ProtectSystem=strict
|
||||
-ReadOnlyPaths=/
|
||||
-ReadWritePaths=/proc/irq
|
||||
-RestrictAddressFamilies=AF_UNIX AF_NETLINK
|
||||
-RuntimeDirectory=irqbalance/
|
||||
-IPAddressDeny=any
|
||||
-ProtectHome=true
|
||||
-PrivateTmp=yes
|
||||
-PrivateNetwork=yes
|
||||
-PrivateUsers=true
|
||||
-ProtectHostname=yes
|
||||
-ProtectClock=yes
|
||||
-ProtectKernelModules=yes
|
||||
-ProtectKernelLogs=yes
|
||||
-ProtectControlGroups=yes
|
||||
-RestrictNamespaces=yes
|
||||
-LockPersonality=yes
|
||||
-MemoryDenyWriteExecute=yes
|
||||
-RestrictRealtime=yes
|
||||
-RestrictSUIDSGID=yes
|
||||
-RemoveIPC=yes
|
||||
-PrivateMounts=yes
|
||||
-SystemCallFilter=@cpu-emulation @privileged @system-service
|
||||
-SystemCallFilter=~@clock @module @mount @obsolete @raw-io @reboot @resources @swap
|
||||
-SystemCallErrorNumber=EPERM
|
||||
-SystemCallArchitectures=native
|
||||
-
|
||||
-[Install]
|
||||
-WantedBy=multi-user.target
|
||||
diff --git a/misc/irqbalance.service.in b/misc/irqbalance.service.in
|
||||
new file mode 100644
|
||||
index 0000000..bd31039
|
||||
--- /dev/null
|
||||
+++ b/misc/irqbalance.service.in
|
||||
@@ -0,0 +1,42 @@
|
||||
+[Unit]
|
||||
+Description=irqbalance daemon
|
||||
+Documentation=man:irqbalance(1)
|
||||
+Documentation=https://github.com/Irqbalance/irqbalance
|
||||
+ConditionVirtualization=!container
|
||||
+ConditionCPUs=>1
|
||||
+
|
||||
+[Service]
|
||||
+EnvironmentFile=@pkgconfdir@/irqbalance.env
|
||||
+EnvironmentFile=-@usrconfdir@/irqbalance
|
||||
+ExecStart=/usr/sbin/irqbalance $IRQBALANCE_ARGS
|
||||
+CapabilityBoundingSet=CAP_SETPCAP
|
||||
+NoNewPrivileges=yes
|
||||
+ProtectSystem=strict
|
||||
+ReadOnlyPaths=/
|
||||
+ReadWritePaths=/proc/irq
|
||||
+RestrictAddressFamilies=AF_UNIX AF_NETLINK
|
||||
+RuntimeDirectory=irqbalance/
|
||||
+IPAddressDeny=any
|
||||
+ProtectHome=true
|
||||
+PrivateTmp=yes
|
||||
+PrivateNetwork=yes
|
||||
+PrivateUsers=true
|
||||
+ProtectHostname=yes
|
||||
+ProtectClock=yes
|
||||
+ProtectKernelModules=yes
|
||||
+ProtectKernelLogs=yes
|
||||
+ProtectControlGroups=yes
|
||||
+RestrictNamespaces=yes
|
||||
+LockPersonality=yes
|
||||
+MemoryDenyWriteExecute=yes
|
||||
+RestrictRealtime=yes
|
||||
+RestrictSUIDSGID=yes
|
||||
+RemoveIPC=yes
|
||||
+PrivateMounts=yes
|
||||
+SystemCallFilter=@cpu-emulation @privileged @system-service
|
||||
+SystemCallFilter=~@clock @module @mount @obsolete @raw-io @reboot @resources @swap
|
||||
+SystemCallErrorNumber=EPERM
|
||||
+SystemCallArchitectures=native
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 14fb83896e44d1efe03963658574204696051397 Mon Sep 17 00:00:00 2001
|
||||
From: Jiri BlueBear Dluhos <jiri.bluebear.dluhos@gmail.com>
|
||||
Date: Tue, 10 Jun 2025 11:00:14 +0200
|
||||
Subject: [PATCH 3/3] Fixed incorrect comparison in snprintf() in
|
||||
procinterrupts.c.
|
||||
|
||||
---
|
||||
procinterrupts.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/procinterrupts.c b/procinterrupts.c
|
||||
index ab31cdb..ebfb762 100644
|
||||
--- a/procinterrupts.c
|
||||
+++ b/procinterrupts.c
|
||||
@@ -69,7 +69,7 @@ static int check_platform_device(char *name, struct irq_info *info)
|
||||
{NULL},
|
||||
};
|
||||
|
||||
- if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) == PATH_MAX) {
|
||||
+ if (snprintf(path, PATH_MAX, "/sys/devices/platform/%s/", name) >= PATH_MAX) {
|
||||
log(TO_ALL, LOG_WARNING, "WARNING: Platform device path in /sys exceeds PATH_MAX, cannot examine");
|
||||
return -ENAMETOOLONG;
|
||||
}
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
From 0a7ca36d99f14dcaa32cbd2e6360c382e3a9ed1a Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Renninger <trenn@suse.de>
|
||||
Date: Wed, 9 Apr 2025 09:44:19 +0200
|
||||
Subject: [PATCH 4/4] Increase file descriptor limit via systemd service file
|
||||
|
||||
Default file limit value set by systemd can be found:
|
||||
systemctl show --property DefaultLimitNOFILESoft
|
||||
DefaultLimitNOFILESoft=1024
|
||||
|
||||
This limit could easily be exceeded on larger systems resulting in:
|
||||
|
||||
Starting irqbalance Can't open class file: : Too many open files
|
||||
startproc: signal catched /usr/sbin/irqbalance: Segmentation fault
|
||||
|
||||
Adding the property to irqbalance.service.in sets a sane default
|
||||
and allows people to easily find the right place where to adjust
|
||||
the limit.
|
||||
---
|
||||
misc/irqbalance.service.in | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/misc/irqbalance.service.in b/misc/irqbalance.service.in
|
||||
index bd31039..40ff38b 100644
|
||||
--- a/misc/irqbalance.service.in
|
||||
+++ b/misc/irqbalance.service.in
|
||||
@@ -16,6 +16,7 @@ ReadOnlyPaths=/
|
||||
ReadWritePaths=/proc/irq
|
||||
RestrictAddressFamilies=AF_UNIX AF_NETLINK
|
||||
RuntimeDirectory=irqbalance/
|
||||
+LimitNOFILE=4096
|
||||
IPAddressDeny=any
|
||||
ProtectHome=true
|
||||
PrivateTmp=yes
|
||||
--
|
||||
2.47.0
|
||||
|
||||
113
0045-fix-some-GCC-fanalyzer-warnings.patch
Normal file
113
0045-fix-some-GCC-fanalyzer-warnings.patch
Normal file
@ -0,0 +1,113 @@
|
||||
From d43411406bb9f37968ea71c11863f485db824b23 Mon Sep 17 00:00:00 2001
|
||||
From: Rosen Penev <rosenp@gmail.com>
|
||||
Date: Tue, 24 Dec 2024 15:37:35 -0800
|
||||
Subject: [PATCH 1/4] fix some GCC fanalyzer warnings
|
||||
|
||||
-Wfanalyzer complains about null pointer dereferences. Check for them.
|
||||
|
||||
Signed-off-by: Rosen Penev <rosenp@gmail.com>
|
||||
---
|
||||
placement.c | 2 +-
|
||||
ui/irqbalance-ui.c | 15 ++++++++-------
|
||||
ui/ui.c | 17 +++++++++++++----
|
||||
3 files changed, 22 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/placement.c b/placement.c
|
||||
index 3276dea..0fa4af1 100644
|
||||
--- a/placement.c
|
||||
+++ b/placement.c
|
||||
@@ -67,7 +67,7 @@ static void find_best_object(struct topo_obj *d, void *data)
|
||||
best->best = d;
|
||||
best->best_cost = newload;
|
||||
} else if (newload == best->best_cost) {
|
||||
- if (g_list_length(d->interrupts) < g_list_length(best->best->interrupts)) {
|
||||
+ if (!best->best || g_list_length(d->interrupts) < g_list_length(best->best->interrupts)) {
|
||||
best->best = d;
|
||||
}
|
||||
}
|
||||
diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c
|
||||
index 4a6832a..9ed25e1 100644
|
||||
--- a/ui/irqbalance-ui.c
|
||||
+++ b/ui/irqbalance-ui.c
|
||||
@@ -214,17 +214,18 @@ out: {
|
||||
GList * concat_child_lists(cpu_node_t *node)
|
||||
{
|
||||
GList *new = NULL;
|
||||
+ GList *cpu_entry;
|
||||
GList *child_entry = g_list_first(node->children);
|
||||
- do {
|
||||
+ while (child_entry) {
|
||||
cpu_node_t *child = (cpu_node_t *)child_entry->data;
|
||||
- GList *cpu_entry = g_list_first(child->cpu_list);
|
||||
- do {
|
||||
+ cpu_entry = g_list_first(child->cpu_list);
|
||||
+ while (cpu_entry) {
|
||||
uint64_t *cpu = (uint64_t *)cpu_entry->data;
|
||||
new = g_list_append(new, cpu);
|
||||
cpu_entry = g_list_next(cpu_entry);
|
||||
- } while(cpu_entry != NULL);
|
||||
+ };
|
||||
child_entry = g_list_next(child_entry);
|
||||
- } while(child_entry != NULL);
|
||||
+ }
|
||||
|
||||
return new;
|
||||
}
|
||||
@@ -253,11 +254,11 @@ void assign_cpu_mask(cpu_node_t *node, void *data __attribute__((unused)))
|
||||
mask[0] = '\0';
|
||||
unsigned int sum = 0;
|
||||
GList *list_entry = g_list_first(node->cpu_list);
|
||||
- do {
|
||||
+ while (list_entry) {
|
||||
int *cpu = list_entry->data;
|
||||
sum += 1 << (*cpu);
|
||||
list_entry = g_list_next(list_entry);
|
||||
- } while(list_entry != NULL);
|
||||
+ };
|
||||
snprintf(mask, 15, "0x%x", sum);
|
||||
node->cpu_mask = mask;
|
||||
|
||||
diff --git a/ui/ui.c b/ui/ui.c
|
||||
index 8325bcd..b716f3b 100644
|
||||
--- a/ui/ui.c
|
||||
+++ b/ui/ui.c
|
||||
@@ -210,12 +210,16 @@ void display_banned_cpus(void)
|
||||
|
||||
int toggle_cpu(GList *cpu_list, int cpu_number)
|
||||
{
|
||||
+ cpu_ban_t *entry_data;
|
||||
+
|
||||
GList *entry = g_list_first(cpu_list);
|
||||
- cpu_ban_t *entry_data = (cpu_ban_t *)(entry->data);
|
||||
- while(entry_data->number != cpu_number) {
|
||||
- entry = g_list_next(entry);
|
||||
+ while (entry) {
|
||||
entry_data = (cpu_ban_t *)(entry->data);
|
||||
+ if (entry_data && entry_data->number == cpu_number)
|
||||
+ break;
|
||||
+ entry = g_list_next(entry);
|
||||
}
|
||||
+
|
||||
if(((cpu_ban_t *)(entry->data))->is_banned) {
|
||||
((cpu_ban_t *)(entry->data))->is_banned = 0;
|
||||
} else {
|
||||
@@ -522,10 +526,15 @@ int toggle_irq(GList *irq_list, int position)
|
||||
{
|
||||
GList *entry = g_list_first(irq_list);
|
||||
int irq_node = 0;
|
||||
- while(irq_node != position) {
|
||||
+
|
||||
+ while(entry && irq_node != position) {
|
||||
entry = g_list_next(entry);
|
||||
irq_node++;
|
||||
}
|
||||
+
|
||||
+ if (!entry)
|
||||
+ return -1;
|
||||
+
|
||||
if(((irq_t *)(entry->data))->is_banned) {
|
||||
((irq_t *)(entry->data))->is_banned = 0;
|
||||
} else {
|
||||
--
|
||||
2.47.0
|
||||
|
||||
47
0046-Check-API-command-length-allow-up-to-16384.patch
Normal file
47
0046-Check-API-command-length-allow-up-to-16384.patch
Normal file
@ -0,0 +1,47 @@
|
||||
From 105b155545e00560a55d34b160324910586ae74c Mon Sep 17 00:00:00 2001
|
||||
From: Etienne Champetier <e.champetier@ateme.com>
|
||||
Date: Thu, 30 Jan 2025 15:20:31 -0500
|
||||
Subject: [PATCH 2/4] Check API command length, allow up to 16384
|
||||
|
||||
When using the API to ban cpus or irqs, the command can easily be longer
|
||||
than 500, so increase the buffer to 16384, which fits ~3250 cpus
|
||||
or irqs, and add a check to log and exit if it is still not enough.
|
||||
|
||||
Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
|
||||
---
|
||||
irqbalance.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/irqbalance.c b/irqbalance.c
|
||||
index 6422a7b..f80244c 100644
|
||||
--- a/irqbalance.c
|
||||
+++ b/irqbalance.c
|
||||
@@ -400,12 +400,12 @@ void get_object_stat(struct topo_obj *object, void *data)
|
||||
#ifdef HAVE_IRQBALANCEUI
|
||||
gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attribute__((unused)))
|
||||
{
|
||||
- char buff[500];
|
||||
+ char buff[16384];
|
||||
int sock;
|
||||
int recv_size = 0;
|
||||
int valid_user = 0;
|
||||
|
||||
- struct iovec iov = { buff, 500 };
|
||||
+ struct iovec iov = { buff, sizeof(buff) };
|
||||
struct msghdr msg = {
|
||||
.msg_iov = &iov,
|
||||
.msg_iovlen = 1,
|
||||
@@ -426,6 +426,10 @@ gboolean sock_handle(gint fd, GIOCondition condition, gpointer user_data __attri
|
||||
log(TO_ALL, LOG_WARNING, "Error while receiving data.\n");
|
||||
goto out_close;
|
||||
}
|
||||
+ if (recv_size == sizeof(buff)) {
|
||||
+ log(TO_ALL, LOG_WARNING, "Received command too long.\n");
|
||||
+ goto out_close;
|
||||
+ }
|
||||
cmsg = CMSG_FIRSTHDR(&msg);
|
||||
if (!cmsg) {
|
||||
log(TO_ALL, LOG_WARNING, "Connection no memory.\n");
|
||||
--
|
||||
2.47.0
|
||||
|
||||
32
0047-check_platform_device-Check-the-length-of-path.patch
Normal file
32
0047-check_platform_device-Check-the-length-of-path.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From d602002e1982a322d19034a4a64ca5a81bace7ef Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Tue, 25 Feb 2025 16:35:34 +1300
|
||||
Subject: [PATCH 3/4] 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 <ltao@redhat.com>
|
||||
---
|
||||
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.47.0
|
||||
|
||||
41
0048-Fix-the-wrong-string-existence-checking-condition.patch
Normal file
41
0048-Fix-the-wrong-string-existence-checking-condition.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From ffa304a885fdafaf233510baa0017ceaa1349e96 Mon Sep 17 00:00:00 2001
|
||||
From: Tao Liu <ltao@redhat.com>
|
||||
Date: Fri, 7 Mar 2025 16:08:47 +1300
|
||||
Subject: [PATCH 4/4] Fix the wrong string existence checking condition
|
||||
|
||||
Commit da75aae4effd ("conver strncmp to g_str_has_prefix") introduced an error
|
||||
which reversed the string existence checking condition.
|
||||
|
||||
Before that commit, the check condition is:
|
||||
(strncmp(name, "Level", len) == 0 || strncmp(name, "Edge", len) == 0)
|
||||
|
||||
After that commit, the check condition is equal to:
|
||||
(strncmp(name, "Level", len) != 0 || strncmp(name, "Edge", len) != 0)
|
||||
|
||||
This is unexpected and let's fixe this error.
|
||||
|
||||
Signed-off-by: Tao Liu <ltao@redhat.com>
|
||||
---
|
||||
procinterrupts.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/procinterrupts.c b/procinterrupts.c
|
||||
index e82fac7..8303ad3 100644
|
||||
--- a/procinterrupts.c
|
||||
+++ b/procinterrupts.c
|
||||
@@ -172,9 +172,9 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
|
||||
* /proc/interrupts format defined, after of interrupt type
|
||||
* the reset string is mark the irq desc name.
|
||||
*/
|
||||
- if (!g_str_has_prefix(irq_name, "Level") ||
|
||||
- !g_str_has_prefix(irq_name, "Edge"))
|
||||
- break;
|
||||
+ if (g_str_has_prefix(irq_name, "Level") ||
|
||||
+ g_str_has_prefix(irq_name, "Edge"))
|
||||
+ break;
|
||||
#endif
|
||||
}
|
||||
|
||||
--
|
||||
2.47.0
|
||||
|
||||
@ -1,22 +1,13 @@
|
||||
From 9d3070150d151bfd5535c3da43313511659d882e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= <tim@siosm.fr>
|
||||
Date: Mon, 1 Aug 2022 15:52:24 +0200
|
||||
Subject: [PATCH] misc/irqbalance.service: Use sysconfig for EnvironmentFile
|
||||
|
||||
---
|
||||
misc/irqbalance.service | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/misc/irqbalance.service b/misc/irqbalance.service
|
||||
index 7e0c5d8..9ac430f 100644
|
||||
--- a/misc/irqbalance.service
|
||||
+++ b/misc/irqbalance.service
|
||||
diff --git a/misc/irqbalance.service.in b/misc/irqbalance.service.in
|
||||
index 40ff38b..142a9e5 100644
|
||||
--- a/misc/irqbalance.service.in
|
||||
+++ b/misc/irqbalance.service.in
|
||||
@@ -6,8 +6,7 @@ ConditionVirtualization=!container
|
||||
ConditionCPUs=>1
|
||||
|
||||
[Service]
|
||||
-EnvironmentFile=-/usr/lib/irqbalance/defaults.env
|
||||
-EnvironmentFile=-/path/to/irqbalance.env
|
||||
-EnvironmentFile=@pkgconfdir@/irqbalance.env
|
||||
-EnvironmentFile=-@usrconfdir@/irqbalance
|
||||
+EnvironmentFile=-/etc/sysconfig/irqbalance
|
||||
ExecStart=/usr/sbin/irqbalance $IRQBALANCE_ARGS
|
||||
CapabilityBoundingSet=CAP_SETPCAP
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: irqbalance
|
||||
Version: 1.9.4
|
||||
Release: 5%{?dist}
|
||||
Release: 6%{?dist}
|
||||
Epoch: 2
|
||||
Summary: IRQ balancing daemon
|
||||
License: GPL-2.0-only
|
||||
@ -52,9 +52,22 @@ Patch43: 0042-Check-info-moved-before-updating.patch
|
||||
Patch44: 0043-irqbalance.1-a-b-a-b-it-s-type-its-type.patch
|
||||
Patch45: 0044-Use-EPERM-instead-of-EIO-when-try-setting-irq-affini.patch
|
||||
|
||||
Patch46: irqbalance-1.9.0-environment-file-sysconfig.patch
|
||||
Patch47: irqbalance-manual.patch
|
||||
|
||||
Patch48: 0045-fix-some-GCC-fanalyzer-warnings.patch
|
||||
Patch49: 0046-Check-API-command-length-allow-up-to-16384.patch
|
||||
Patch50: 0047-check_platform_device-Check-the-length-of-path.patch
|
||||
Patch51: 0048-Fix-the-wrong-string-existence-checking-condition.patch
|
||||
Patch52: 0001-Unify-meson-and-autoconf-Install-executables-to-sbin.patch
|
||||
Patch53: 0002-Properly-embed-EnvironmentFile-sourced-systemd-confi.patch
|
||||
Patch54: 0004-Increase-file-descriptor-limit-via-systemd-service-f.patch
|
||||
|
||||
Patch55: irqbalance-1.9.0-environment-file-sysconfig.patch
|
||||
|
||||
Patch56: 0001-Safer-string-handling-in-procinterrupts.c.patch
|
||||
Patch57: 0002-Added-missing-and-fixed-message-in-procinterrupts.c.patch
|
||||
Patch58: 0003-Fixed-incorrect-comparison-in-snprintf-in-procinterr.patch
|
||||
|
||||
BuildRequires: autoconf automake libtool libcap-ng
|
||||
BuildRequires: glib2-devel pkgconf libcap-ng-devel
|
||||
BuildRequires: systemd ncurses-devel systemd-devel
|
||||
@ -109,6 +122,9 @@ make check
|
||||
%systemd_postun_with_restart irqbalance.service
|
||||
|
||||
%changelog
|
||||
* Tue Sep 30 2025 Tao Liu <ltao@redhat.com> - 2:1.9.4-6
|
||||
- Rebase to upstream commit (8e8945e509)
|
||||
|
||||
* Mon Aug 18 2025 Tao Liu <ltao@redhat.com> - 2:1.9.4-5
|
||||
- Release 1.9.4-5
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user