From b040594bab4ee83cff9e95c72303282f22426cba Mon Sep 17 00:00:00 2001 From: Abhi Das Date: Fri, 11 Feb 2022 08:02:17 -0600 Subject: [PATCH] squashfs-tools: limit CPUs on large machines to avoid running out of resources * Wed Jan 12 2022 Abhi Das - 4.4-8.git1 - limit CPUs on large machines to avoid running out of resources rhbz#2023218 Resolves: rhbz#2023218 Signed-off-by: Abhi Das --- bz2023218.patch | 22 ++++++++++++++++++++++ squashfs-tools.spec | 9 ++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 bz2023218.patch diff --git a/bz2023218.patch b/bz2023218.patch new file mode 100644 index 0000000..d4c9598 --- /dev/null +++ b/bz2023218.patch @@ -0,0 +1,22 @@ +diff -Nupr a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c +--- a/squashfs-tools/mksquashfs.c 2020-10-30 06:13:56.000000000 -0500 ++++ b/squashfs-tools/mksquashfs.c 2022-01-12 10:58:37.704782953 -0600 +@@ -290,6 +290,7 @@ int all_time_opt = FALSE; + int clamping = TRUE; + + /* user options that control parallelisation */ ++#define MAX_CPUS 256 + int processors = -1; + int bwriter_size; + +@@ -4385,6 +4386,10 @@ void initialise_threads(int readq, int f + #endif + } + ++ /* Limit the number of processors we're going to use */ ++ if(processors > MAX_CPUS) ++ processors = MAX_CPUS; ++ + if(multiply_overflow(processors, 3) || + multiply_overflow(processors * 3, sizeof(pthread_t))) + BAD_ERROR("Processors too large\n"); diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 83718d6..a816b16 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -2,7 +2,7 @@ Summary: Utility for the creation of squashfs filesystems %global forgeurl https://github.com/plougher/squashfs-tools Version: 4.4 Name: squashfs-tools -Release: 7.git1%{?dist} +Release: 8.git1%{?dist} License: GPLv2+ URL: %{forgeurl}/archive/4.4-git.1.tar.gz Source: 4.4-git.1.tar.gz @@ -11,6 +11,8 @@ Source: 4.4-git.1.tar.gz Source1: mksquashfs.1 Source2: unsquashfs.1 +Patch0: bz2023218.patch + BuildRequires: make BuildRequires: gcc BuildRequires: zlib-devel @@ -26,6 +28,7 @@ contains the utilities for manipulating squashfs filesystems. %prep %setup -n %{name}-4.4-git.1 +%patch0 -p1 %build %set_build_flags @@ -49,6 +52,10 @@ install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %{_sbindir}/unsquashfs %changelog +* Wed Jan 12 2022 Abhi Das - 4.4-8.git1 +- limit CPUs on large machines to avoid running out of resources + rhbz#2023218 + * Tue Aug 10 2021 Mohan Boddu - 4.4-7.git1 - Rebuilt for IMA sigs, glibc 2.34, aarch64 flags Related: rhbz#1991688