Fix data race of proc_file_chain in _IO_new_proc_open()

Signed-off-by: Su Lifan <su-lifan@linux.alibaba.com>
This commit is contained in:
Su Lifan 2022-04-11 11:06:12 +08:00
parent 16d0cc6441
commit d5f5268585
2 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,25 @@
This patch provides a workaround of data race inside _IO_new_proc_open()
(upstream BZ#22834)
Signed-off-by: Su Lifan <su-lifan@linux.alibaba.com>
diff -aurN glibc-2.28.orig/libio/iopopen.c glibc-2.28/libio/iopopen.c
--- glibc-2.28.orig/libio/iopopen.c 2018-08-01 05:10:47.000000000 +0000
+++ glibc-2.28/libio/iopopen.c 2022-04-08 11:33:15.487864923 +0000
@@ -35,6 +35,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <kernel-features.h>
+#include <atomic.h>
struct _IO_proc_file
{
@@ -168,6 +169,7 @@
_IO_lock_lock (proc_file_chain_lock);
#endif
((_IO_proc_file *) fp)->next = proc_file_chain;
+ atomic_write_barrier();
proc_file_chain = (_IO_proc_file *) fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_unlock (proc_file_chain_lock);

View file

@ -1,4 +1,4 @@
%define anolis_release .0.1 %define anolis_release .0.2
%define glibcsrcdir glibc-2.28 %define glibcsrcdir glibc-2.28
%define glibcversion 2.28 %define glibcversion 2.28
%define glibcrelease 164%{anolis_release}%{?dist}.3 %define glibcrelease 164%{anolis_release}%{?dist}.3
@ -740,6 +740,8 @@ Patch1003: glibc-elf-Align-argument-of-__munmap-to-page-size-BZ-28676-3.patch
Patch1004: glibc-Support-target-specific-ALIGN-for-variable-alignment-4.patch Patch1004: glibc-Support-target-specific-ALIGN-for-variable-alignment-4.patch
Patch1005: glibc-elf-Fix-tst-align3.patch Patch1005: glibc-elf-Fix-tst-align3.patch
Patch10001: 10001-glibc-fix-race-popen.patch
############################################################################## ##############################################################################
# Continued list of core "glibc" package information: # Continued list of core "glibc" package information:
############################################################################## ##############################################################################
@ -2651,6 +2653,9 @@ fi
%files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared %files -f compat-libpthread-nonshared.filelist -n compat-libpthread-nonshared
%changelog %changelog
* Fri Apr 8 2022 Su Lifan <su-lifan@linux.alibaba.com> - 2.28-164.0.2.3
- Fix data race of proc_file_chain in _IO_new_proc_open()
* Mon Mar 21 2022 Rongwei Wang <rongwei.wang@linux.alibaba.com> - 2.28-164.0.1.3 * Mon Mar 21 2022 Rongwei Wang <rongwei.wang@linux.alibaba.com> - 2.28-164.0.1.3
- elf: Properly align PT_LOAD segments - elf: Properly align PT_LOAD segments