diff --git a/Fix-crashes-when-using-the-touch-option.patch b/Fix-crashes-when-using-the-touch-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2aa1e045bdad4dfe9d5fb4973c441575e9ada1e --- /dev/null +++ b/Fix-crashes-when-using-the-touch-option.patch @@ -0,0 +1,43 @@ +From a47463a72864a76b0557468daf83741632ea4d72 Mon Sep 17 00:00:00 2001 +From: Patrick Mansfield +Date: Mon, 30 Sep 2019 15:59:53 -0700 +Subject: [PATCH] Fix crashes when using the "--touch" option. + +Fix memory to be mapped read/write, so that the "touch" option can write to it. + +Signed-off-by: Patrick Mansfield +--- + shm.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/shm.c b/shm.c +index 260eeff..fb592ed 100644 +--- a/shm.c ++++ b/shm.c +@@ -119,7 +119,7 @@ void attach_sysvshm(char *name, char *opt) + shmlen = s.shm_segsz; + } + +- shmptr = shmat(shmfd, NULL, SHM_RDONLY); ++ shmptr = shmat(shmfd, NULL, 0); + if (shmptr == (void*)-1) + err("shmat"); + shmptr += shmoffset; +@@ -134,7 +134,7 @@ void attach_shared(char *name, char *opt) + { + struct stat64 st; + +- shmfd = open(name, O_RDONLY); ++ shmfd = open(name, O_RDWR); + if (shmfd < 0) { + errno = 0; + if (shmlen == 0) +@@ -160,7 +160,7 @@ void attach_shared(char *name, char *opt) + + /* RED-PEN For shmlen > address space may need to map in pieces. + Left for some poor 32bit soul. */ +- shmptr = mmap64(NULL, shmlen, PROT_READ, MAP_SHARED, shmfd, shmoffset); ++ shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); + if (shmptr == (char*)-1) + err("shm mmap"); + diff --git a/fix-use-after-free.patch b/fix-use-after-free.patch new file mode 100644 index 0000000000000000000000000000000000000000..216577401800b07fcd32cb51c99a3f9477c11c95 --- /dev/null +++ b/fix-use-after-free.patch @@ -0,0 +1,30 @@ +From 498385e3aaf265d6e9786e0a391196cd82ab3260 Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Fri, 18 Jun 2021 18:14:20 +0800 +Subject: [PATCH] numactl.c: fix use after free + +The following command can trigger the bug + numactl --length 65536 --shm xxx -p0 -V > /dev/null + +So reset mask to block any new access inside this loop. + +Signed-off-by: Pingfan Liu +--- + numactl.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/numactl.c b/numactl.c +index 76a1cca..a39d220 100644 +--- a/numactl.c ++++ b/numactl.c +@@ -534,6 +534,7 @@ int main(int ac, char **av) + if (nnodes != 1) + usage(); + numa_bitmask_free(mask); ++ mask = NULL; + errno = 0; + did_node_cpu_parse = 1; + numa_set_bind_policy(0); +-- +2.27.0 + diff --git a/numactl.spec b/numactl.spec index 856fe87e0c2871d3a50c09e3e1bb5eb5355e98c5..c554ae90001eaa528cb4ddc8898dbeb08355f6e8 100644 --- a/numactl.spec +++ b/numactl.spec @@ -1,12 +1,15 @@ Name: numactl Version: 2.0.13 -Release: 4 +Release: 5 Summary: Library for tuning for Non Uniform Memory Access machines License: GPLv2 URL: https://github.com/numactl/numactl Source0: https://github.com/numactl/numactl/releases/download/v%{version}/numactl-%{version}.tar.gz BuildRequires: libtool automake autoconf git +Patch0001: Fix-crashes-when-using-the-touch-option.patch +Patch0002: fix-use-after-free.patch + %description Simple NUMA policy support. It consists of a numactl program to run other programs with a specific NUMA policy and a libnuma shared library to set @@ -69,6 +72,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/*.3* %changelog +* Sat May 07 2022 zhouwenpei - 2.0.13-5 +- fix crashes when using the "--touch" option + * Fri Jan 10 2020 yuxiangyang - 2.0.13-4 - upgrade version to 2.0.13