From e56b6f9337f4fb5592afe7a4bf33e011ba99cd37 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 09 2021 10:05:14 +0000 Subject: import numactl-2.0.12-13.el8 --- diff --git a/SOURCES/0013-libnuma-make-numa_police_memory-free-of-race.patch b/SOURCES/0013-libnuma-make-numa_police_memory-free-of-race.patch new file mode 100644 index 0000000..f724cda --- /dev/null +++ b/SOURCES/0013-libnuma-make-numa_police_memory-free-of-race.patch @@ -0,0 +1,35 @@ +From 93867c59b0bb29470873a427dc7f06ebaf305221 Mon Sep 17 00:00:00 2001 +From: Pingfan Liu +Date: Mon, 29 Mar 2021 17:33:06 +0800 +Subject: [PATCH] libnuma: make numa_police_memory() free of race + +When numa_police_memory() read-write to memory, it can risk the race of +another thread write to the same area. + +Using atomic function to protect the read-write operation + +Signed-off-by: Pingfan Liu +--- + libnuma.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/libnuma.c b/libnuma.c +index f073c50..7b8290c 100644 +--- a/libnuma.c ++++ b/libnuma.c +@@ -864,8 +864,10 @@ void numa_police_memory(void *mem, size_t size) + { + int pagesize = numa_pagesize_int(); + unsigned long i; +- for (i = 0; i < size; i += pagesize) +- ((volatile char*)mem)[i] = ((volatile char*)mem)[i]; ++ char *p = mem; ++ for (i = 0; i < size; i += pagesize, p += pagesize) ++ __atomic_and_fetch(p, 0xff, __ATOMIC_RELAXED); ++ + } + + make_internal_alias(numa_police_memory); +-- +2.29.2 + diff --git a/SPECS/numactl.spec b/SPECS/numactl.spec index 93be941..bbc90cb 100644 --- a/SPECS/numactl.spec +++ b/SPECS/numactl.spec @@ -1,7 +1,7 @@ Name: numactl Summary: Library for tuning for Non Uniform Memory Access machines Version: 2.0.12 -Release: 11%{?dist} +Release: 13%{?dist} # libnuma is LGPLv2 and GPLv2 # numactl binaries are GPLv2 only License: GPLv2 @@ -49,6 +49,7 @@ Patch609: 0009-numastat.8-clarify-that-information-relates-to-resid.patch Patch610: 0010-Fix-crashes-when-using-the-touch-option.patch Patch611: 0011-Added-memhog.8-to-Makefile.am.patch Patch612: 0012-Update-manpage-description-of-localalloc-option.patch +Patch613: 0013-libnuma-make-numa_police_memory-free-of-race.patch @@ -91,6 +92,7 @@ Provides development headers for numa library calls %patch610 -p1 %patch611 -p1 %patch612 -p1 +%patch613 -p1 %build @@ -136,6 +138,9 @@ make DESTDIR=$RPM_BUILD_ROOT install %{_mandir}/man3/*.3* %changelog +* Wed May 12 2021 Pingfan Liu - 2.0.12-13 +- libnuma: make numa_police_memory() free of race + * Sat May 9 2020 Pingfan Liu - 2.0.12-11 - Update manpage description of --localalloc option