squashfs-tools: limit CPUs on large machines to avoid running out of resources

* Wed Jan 12 2022 Abhi Das <adas@redhat.com> - 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 <adas@redhat.com>
This commit is contained in:
Abhi Das 2022-02-11 08:02:17 -06:00
parent e63e618d0f
commit b040594bab
2 changed files with 30 additions and 1 deletions

22
bz2023218.patch Normal file
View File

@ -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");

View File

@ -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 <adas@redhat.com> - 4.4-8.git1
- limit CPUs on large machines to avoid running out of resources
rhbz#2023218
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 4.4-7.git1
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688