import numactl-2.0.12-13.el8

This commit is contained in:
CentOS Sources 2021-10-06 10:23:22 -04:00 committed by Stepan Oksanichenko
parent 8681be674d
commit b305a9f84d
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 93867c59b0bb29470873a427dc7f06ebaf305221 Mon Sep 17 00:00:00 2001
From: Pingfan Liu <piliu@redhat.com>
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 <piliu@redhat.com>
---
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

View File

@ -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 <piliu@redhat.com> - 2.0.12-13
- libnuma: make numa_police_memory() free of race
* Sat May 9 2020 Pingfan Liu <piliu@redhat.com> - 2.0.12-11
- Update manpage description of --localalloc option