All of lore.kernel.org
 help / color / mirror / Atom feed
* [OE-core][PATCH] glibc: fix pthread_cond_destroy hang with process-shared mutex
@ 2021-03-12  3:22 Xu, Yanfei
  2021-03-12  3:57 ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Xu, Yanfei @ 2021-03-12  3:22 UTC (permalink / raw)
  To: openembedded-core

From: Yanfei Xu <yanfei.xu@windriver.com>

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>
---
 ...-private-futex-optimization-BZ-27304.patch | 49 +++++++++++++++++++
 meta/recipes-core/glibc/glibc_2.33.bb         |  3 ++
 2 files changed, 52 insertions(+)
 create mode 100644 meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch

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
index 0000000000..19f391cc84
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
@@ -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: Accepted [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
+
diff --git a/meta/recipes-core/glibc/glibc_2.33.bb b/meta/recipes-core/glibc/glibc_2.33.bb
index c47826a51e..6ba8cd9b71 100644
--- a/meta/recipes-core/glibc/glibc_2.33.bb
+++ b/meta/recipes-core/glibc/glibc_2.33.bb
@@ -45,6 +45,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
            file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
            file://0031-x86-Require-full-ISA-support-for-x86-64-level-marker.patch \
            file://0032-string-Work-around-GCC-PR-98512-in-rawmemchr.patch \
+           file://0001-nptl-Remove-private-futex-optimization-BZ-27304.patch \
            "
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build-${TARGET_SYS}"
@@ -55,6 +56,8 @@ PACKAGES_DYNAMIC = ""
 BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
 TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
 
+TARGET_CFLAGS += " ${PROFILING_OPTIMIZATION} "
+
 GLIBC_BROKEN_LOCALES = ""
 
 GLIBCPIE ??= ""
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core][PATCH] glibc: fix pthread_cond_destroy hang with process-shared mutex
  2021-03-12  3:22 [OE-core][PATCH] glibc: fix pthread_cond_destroy hang with process-shared mutex Xu, Yanfei
@ 2021-03-12  3:57 ` Khem Raj
  2021-03-12  4:31   ` Xu, Yanfei
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2021-03-12  3:57 UTC (permalink / raw)
  To: Xu, Yanfei; +Cc: Patches and discussions about the oe-core layer

On Thu, Mar 11, 2021 at 7:22 PM Xu, Yanfei <yanfei.xu@windriver.com> wrote:
>
> From: Yanfei Xu <yanfei.xu@windriver.com>
>
> 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>
> ---
>  ...-private-futex-optimization-BZ-27304.patch | 49 +++++++++++++++++++
>  meta/recipes-core/glibc/glibc_2.33.bb         |  3 ++
>  2 files changed, 52 insertions(+)
>  create mode 100644 meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
>
> 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
> index 0000000000..19f391cc84
> --- /dev/null
> +++ b/meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
> @@ -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: Accepted [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
> +
> diff --git a/meta/recipes-core/glibc/glibc_2.33.bb b/meta/recipes-core/glibc/glibc_2.33.bb
> index c47826a51e..6ba8cd9b71 100644
> --- a/meta/recipes-core/glibc/glibc_2.33.bb
> +++ b/meta/recipes-core/glibc/glibc_2.33.bb
> @@ -45,6 +45,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>             file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
>             file://0031-x86-Require-full-ISA-support-for-x86-64-level-marker.patch \
>             file://0032-string-Work-around-GCC-PR-98512-in-rawmemchr.patch \
> +           file://0001-nptl-Remove-private-futex-optimization-BZ-27304.patch \
>             "
>  S = "${WORKDIR}/git"
>  B = "${WORKDIR}/build-${TARGET_SYS}"
> @@ -55,6 +56,8 @@ PACKAGES_DYNAMIC = ""
>  BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
>  TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
>
> +TARGET_CFLAGS += " ${PROFILING_OPTIMIZATION} "

why do we need this change ?

> +
>  GLIBC_BROKEN_LOCALES = ""
>
>  GLIBCPIE ??= ""
> --
> 2.27.0
>
>
> 
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core][PATCH] glibc: fix pthread_cond_destroy hang with process-shared mutex
  2021-03-12  3:57 ` Khem Raj
@ 2021-03-12  4:31   ` Xu, Yanfei
  0 siblings, 0 replies; 3+ messages in thread
From: Xu, Yanfei @ 2021-03-12  4:31 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer



On 3/12/21 11:57 AM, Khem Raj wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> On Thu, Mar 11, 2021 at 7:22 PM Xu, Yanfei <yanfei.xu@windriver.com> wrote:
>>
>> From: Yanfei Xu <yanfei.xu@windriver.com>
>>
>> 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>
>> ---
>>   ...-private-futex-optimization-BZ-27304.patch | 49 +++++++++++++++++++
>>   meta/recipes-core/glibc/glibc_2.33.bb         |  3 ++
>>   2 files changed, 52 insertions(+)
>>   create mode 100644 meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
>>
>> 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
>> index 0000000000..19f391cc84
>> --- /dev/null
>> +++ b/meta/recipes-core/glibc/glibc/0001-nptl-Remove-private-futex-optimization-BZ-27304.patch
>> @@ -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: Accepted [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
>> +
>> diff --git a/meta/recipes-core/glibc/glibc_2.33.bb b/meta/recipes-core/glibc/glibc_2.33.bb
>> index c47826a51e..6ba8cd9b71 100644
>> --- a/meta/recipes-core/glibc/glibc_2.33.bb
>> +++ b/meta/recipes-core/glibc/glibc_2.33.bb
>> @@ -45,6 +45,7 @@ SRC_URI =  "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
>>              file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
>>              file://0031-x86-Require-full-ISA-support-for-x86-64-level-marker.patch \
>>              file://0032-string-Work-around-GCC-PR-98512-in-rawmemchr.patch \
>> +           file://0001-nptl-Remove-private-futex-optimization-BZ-27304.patch \
>>              "
>>   S = "${WORKDIR}/git"
>>   B = "${WORKDIR}/build-${TARGET_SYS}"
>> @@ -55,6 +56,8 @@ PACKAGES_DYNAMIC = ""
>>   BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
>>   TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
>>
>> +TARGET_CFLAGS += " ${PROFILING_OPTIMIZATION} "
> 
> why do we need this change ?

My fault, don't need it. It's just a debug operation during I was 
debugging this issue. Will remove it in v2.

Thanks for reviewing.

Yanfei
> 
>> +
>>   GLIBC_BROKEN_LOCALES = ""
>>
>>   GLIBCPIE ??= ""
>> --
>> 2.27.0
>>
>>
>> 
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-12  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  3:22 [OE-core][PATCH] glibc: fix pthread_cond_destroy hang with process-shared mutex Xu, Yanfei
2021-03-12  3:57 ` Khem Raj
2021-03-12  4:31   ` Xu, Yanfei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.