]> code.ossystems Code Review - openembedded-core.git/commitdiff
glibc: fix pthread_cond_destroy hangs with process-shared mutex
authorYanfei Xu <yanfei.xu@windriver.com>
Fri, 12 Mar 2021 04:54:08 +0000 (12:54 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 14 Mar 2021 16:33:03 +0000 (16:33 +0000)
This bug can cause pthread_cond_destroy hang with process-shared
mutex. And it is since glibc-2.32, will be fixed in glibc-2.34.

Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch [new file with mode: 0644]
meta/recipes-core/glibc/glibc_2.33.bb

diff --git a/meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch b/meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
new file mode 100644 (file)
index 0000000..39fde5b
--- /dev/null
@@ -0,0 +1,49 @@
+From c4ad832276f4dadfa40904109b26a521468f66bc Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Thu, 4 Feb 2021 15:00:20 +0100
+Subject: [PATCH] nptl: Remove private futex optimization [BZ #27304]
+
+It is effectively used, unexcept for pthread_cond_destroy, where we do
+not want it; see bug 27304.  The internal locks do not support a
+process-shared mode.
+
+This fixes commit dc6cfdc934db9997c33728082d63552b9eee4563 ("nptl:
+Move pthread_cond_destroy implementation into libc").
+
+Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+Upstream-Status: Backport [https://sourceware.org/bugzilla/show_bug.cgi?id=27304]
+Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
+---
+ sysdeps/nptl/lowlevellock-futex.h | 14 +-------------
+ 1 file changed, 1 insertion(+), 13 deletions(-)
+
+diff --git a/sysdeps/nptl/lowlevellock-futex.h b/sysdeps/nptl/lowlevellock-futex.h
+index ecb729da6b..ca96397a4a 100644
+--- a/sysdeps/nptl/lowlevellock-futex.h
++++ b/sysdeps/nptl/lowlevellock-futex.h
+@@ -50,20 +50,8 @@
+ #define LLL_SHARED    FUTEX_PRIVATE_FLAG
+ #ifndef __ASSEMBLER__
+-
+-# if IS_IN (libc) || IS_IN (rtld)
+-/* In libc.so or ld.so all futexes are private.  */
+-#  define __lll_private_flag(fl, private)                     \
+-  ({                                                          \
+-    /* Prevent warnings in callers of this macro.  */         \
+-    int __lll_private_flag_priv __attribute__ ((unused));     \
+-    __lll_private_flag_priv = (private);                      \
+-    ((fl) | FUTEX_PRIVATE_FLAG);                              \
+-  })
+-# else
+-#  define __lll_private_flag(fl, private) \
++# define __lll_private_flag(fl, private) \
+   (((fl) | FUTEX_PRIVATE_FLAG) ^ (private))
+-# endif
+ # define lll_futex_syscall(nargs, futexp, op, ...)                      \
+   ({                                                                    \
+-- 
+2.27.0
+
index bb4b8758002149ad6bcbd51a9ddb7de2e20dc054..5e0baa53e8d80d066994315a6f80c2c193fb08fe 100644 (file)
@@ -47,6 +47,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0032-string-Work-around-GCC-PR-98512-in-rawmemchr.patch \
            file://0033-x86-Handle-_SC_LEVEL1_ICACHE_LINESIZE-BZ-27444.patch \
            file://CVE-2021-27645.patch \
+           file://0001-nptl-Remove-private-futex-optimization-BZ-27304.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"