All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] valgrind: drd: fix pthread intercept test failures
@ 2020-10-09 17:44 Stacy Gaikovaia
  2020-10-09 20:14 ` [OE-core] " Randy MacLeod
  0 siblings, 1 reply; 6+ messages in thread
From: Stacy Gaikovaia @ 2020-10-09 17:44 UTC (permalink / raw)
  To: openembedded-core

From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>

After glibc uprev 2.32 -> 2.32, the following drd ptests
fail with the error "condition variable has not been initialized".

drd/tests/annotate_hb_err
drd/tests/annotate_sem
drd/tests/annotate_rwlock
drd/tests/annotate_order_2
drd/tests/annotate_smart_pointer
drd/tests/annotate_spinlock
drd/tests/monitor_example
drd/tests/pth_cond_race
drd/tests/pth_inconsistent_cond_wait

In glibc 2.32, the POSIX thread functions are in both
libc and libpthread, causing valgrind to misinterpert
test behaviour. This patch tells valgrind to intercept
the pthread functions in libc, resolving these ptest
failures. Patch can be removed once we uprev valgrind.

Upsteam-Status: Backport

Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
---
 .../valgrind/0001-drd-Port-to-Fedora-33.patch | 46 +++++++++++++++++++
 .../valgrind/valgrind_3.16.1.bb               |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
new file mode 100644
index 0000000000..bca3d9b892
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
@@ -0,0 +1,46 @@
+From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 19 Sep 2020 08:08:59 -0700
+Subject: [PATCH] drd: Port to Fedora 33
+
+Apparently on Fedora 33 the POSIX thread functions exist in both libc and
+libpthread. Hence this patch that intercepts the pthread functions in
+libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
+
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+
+This patch was imported from the valgrind sourceware server
+(https://sourceware.org/git/?p=valgrind.git), commit id
+15330adf7c2471fbaa6a0818db07078d81dbff97. It was modified to
+remove the changes to the valgrind NEWS file, as these are difficult to 
+maintain and don't impact the valgrind code itself.
+
+Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
+---
+ drd/drd_pthread_intercepts.c | 9 +++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
+index 58c45aaec..c2882e5ab 100644
+--- a/drd/drd_pthread_intercepts.c
++++ b/drd/drd_pthread_intercepts.c
+@@ -174,7 +174,16 @@ static int never_true;
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
+    { return implf argl; }
+ #else
++/*
++ * On Linux, intercept both the libc and the libpthread functions. At
++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
++ * functions in both libc and libpthread. Older glibc versions only have an
++ * implementation of the pthread functions in libpthread.
++ */
+ #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
++   { return implf argl; }                                               \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
+    { return implf argl; }
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index d4ca1a7752..7508098b55 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -40,6 +40,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
            file://s390x_vec_op_t.patch \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
+           file://0001-drd-Port-to-Fedora-33.patch \
            "
 SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
 SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
-- 
2.25.1


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

* Re: [OE-core] [PATCH] valgrind: drd: fix pthread intercept test failures
  2020-10-09 17:44 [PATCH] valgrind: drd: fix pthread intercept test failures Stacy Gaikovaia
@ 2020-10-09 20:14 ` Randy MacLeod
  2020-10-09 20:21   ` Stacy Gaikovaia
  0 siblings, 1 reply; 6+ messages in thread
From: Randy MacLeod @ 2020-10-09 20:14 UTC (permalink / raw)
  To: Stacy Gaikovaia; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 5065 bytes --]

On Fri., Oct. 9, 2020, 13:45 Stacy Gaikovaia, <Stacy.Gaikovaia@windriver.com>
wrote:

> From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
>
> After glibc uprev 2.32 -> 2.32, the


2.31 -> 2.32

following drd ptests
> fail with the error "condition variable has not been initialized".
>
> drd/tests/annotate_hb_err
> drd/tests/annotate_sem
> drd/tests/annotate_rwlock
> drd/tests/annotate_order_2
> drd/tests/annotate_smart_pointer
> drd/tests/annotate_spinlock
> drd/tests/monitor_example
> drd/tests/pth_cond_race
> drd/tests/pth_inconsistent_cond_wait
>
> In glibc 2.32, the POSIX thread functions are in both
> libc and libpthread, causing valgrind to misinterpert
> test behaviour. This patch tells valgrind to intercept
> the pthread functions in libc,



It's intercepting both as mentioned in the patch commit:

   "intercept both the libc and the libpthread functions"
so please make that clear in your commit log.


resolving these ptest
> failures. Patch can be removed once we uprev valgrind.
>

Can you add the pass, fail, skip and total counts and mention the test
system qemux86-64? This will help people track things when there is another
update.


> Upsteam-Status: Backport
>

This goes in the body of the patch. Mention the vg commit ID too please.


Thanks,

Randy


> Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
> ---
>  .../valgrind/0001-drd-Port-to-Fedora-33.patch | 46 +++++++++++++++++++
>  .../valgrind/valgrind_3.16.1.bb               |  1 +
>  2 files changed, 47 insertions(+)
>  create mode 100644
> meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
>
> diff --git
> a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> new file mode 100644
> index 0000000000..bca3d9b892
> --- /dev/null
> +++
> b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> @@ -0,0 +1,46 @@
> +From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
> +From: Bart Van Assche <bvanassche@acm.org>
> +Date: Sat, 19 Sep 2020 08:08:59 -0700
> +Subject: [PATCH] drd: Port to Fedora 33
> +
> +Apparently on Fedora 33 the POSIX thread functions exist in both libc and
> +libpthread. Hence this patch that intercepts the pthread functions in
> +libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
> +
> +Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> +
> +This patch was imported from the valgrind sourceware server
> +(https://sourceware.org/git/?p=valgrind.git), commit id
> +15330adf7c2471fbaa6a0818db07078d81dbff97. It was modified to
> +remove the changes to the valgrind NEWS file, as these are difficult to
> +maintain and don't impact the valgrind code itself.
> +
> +Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
> +---
> + drd/drd_pthread_intercepts.c | 9 +++++++++
> + 1 file changed, 10 insertions(+)
> +
> +diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
> +index 58c45aaec..c2882e5ab 100644
> +--- a/drd/drd_pthread_intercepts.c
> ++++ b/drd/drd_pthread_intercepts.c
> +@@ -174,7 +174,16 @@ static int never_true;
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
> +    { return implf argl; }
> + #else
> ++/*
> ++ * On Linux, intercept both the libc and the libpthread functions. At
> ++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
> ++ * functions in both libc and libpthread. Older glibc versions only have
> an
> ++ * implementation of the pthread functions in libpthread.
> ++ */
> + #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
> ++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
> ++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
> ++   { return implf argl; }                                               \
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
> +    { return implf argl; }
> +--
> +2.25.1
> +
> diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> index d4ca1a7752..7508098b55 100644
> --- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> +++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> @@ -40,6 +40,7 @@ SRC_URI = "
> https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
>             file://s390x_vec_op_t.patch \
>
> file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
>             file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
> +           file://0001-drd-Port-to-Fedora-33.patch \
>             "
>  SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
>  SRC_URI[sha256sum] =
> "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
> --
> 2.25.1
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 8342 bytes --]

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

* Re: [OE-core] [PATCH] valgrind: drd: fix pthread intercept test failures
  2020-10-09 20:14 ` [OE-core] " Randy MacLeod
@ 2020-10-09 20:21   ` Stacy Gaikovaia
  2020-10-09 21:22     ` Randy MacLeod
  0 siblings, 1 reply; 6+ messages in thread
From: Stacy Gaikovaia @ 2020-10-09 20:21 UTC (permalink / raw)
  To: Randy MacLeod; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 5845 bytes --]

Sure I'll do those things.


Upsteam-Status: Backport

>> This goes in the body of the patch. Mention the vg commit ID too please.

I have the vg commit ID in the body of the patch, is that ok or should both things be in both spots?

Stacy
________________________________
From: Randy MacLeod <rwmacleod@gmail.com>
Sent: Friday, October 9, 2020 4:14 PM
To: Gaikovaia, Stacy <Stacy.Gaikovaia@windriver.com>
Cc: openembedded-core@lists.openembedded.org <openembedded-core@lists.openembedded.org>
Subject: Re: [OE-core] [PATCH] valgrind: drd: fix pthread intercept test failures



On Fri., Oct. 9, 2020, 13:45 Stacy Gaikovaia, <Stacy.Gaikovaia@windriver.com<mailto:Stacy.Gaikovaia@windriver.com>> wrote:
From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com<mailto:Stacy.Gaikovaia@windriver.com>>

After glibc uprev 2.32 -> 2.32, the

2.31 -> 2.32

following drd ptests
fail with the error "condition variable has not been initialized".

drd/tests/annotate_hb_err
drd/tests/annotate_sem
drd/tests/annotate_rwlock
drd/tests/annotate_order_2
drd/tests/annotate_smart_pointer
drd/tests/annotate_spinlock
drd/tests/monitor_example
drd/tests/pth_cond_race
drd/tests/pth_inconsistent_cond_wait

In glibc 2.32, the POSIX thread functions are in both
libc and libpthread, causing valgrind to misinterpert
test behaviour. This patch tells valgrind to intercept
the pthread functions in libc,


It's intercepting both as mentioned in the patch commit:

   "intercept both the libc and the libpthread functions"
so please make that clear in your commit log.


resolving these ptest
failures. Patch can be removed once we uprev valgrind.

Can you add the pass, fail, skip and total counts and mention the test system qemux86-64? This will help people track things when there is another update.


Upsteam-Status: Backport

This goes in the body of the patch. Mention the vg commit ID too please.


Thanks,

Randy


Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com<mailto:Stacy.Gaikovaia@windriver.com>>
---
 .../valgrind/0001-drd-Port-to-Fedora-33.patch | 46 +++++++++++++++++++
 .../valgrind/valgrind_3.16.1.bb<http://valgrind_3.16.1.bb>               |  1 +
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
new file mode 100644
index 0000000000..bca3d9b892
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
@@ -0,0 +1,46 @@
+From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org<mailto:bvanassche@acm.org>>
+Date: Sat, 19 Sep 2020 08:08:59 -0700
+Subject: [PATCH] drd: Port to Fedora 33
+
+Apparently on Fedora 33 the POSIX thread functions exist in both libc and
+libpthread. Hence this patch that intercepts the pthread functions in
+libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
+
+Signed-off-by: Bart Van Assche <bvanassche@acm.org<mailto:bvanassche@acm.org>>
+
+This patch was imported from the valgrind sourceware server
+(https://sourceware.org/git/?p=valgrind.git), commit id
+15330adf7c2471fbaa6a0818db07078d81dbff97. It was modified to
+remove the changes to the valgrind NEWS file, as these are difficult to
+maintain and don't impact the valgrind code itself.
+
+Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com<mailto:stacy.gaikovaia@windriver.com>>
+---
+ drd/drd_pthread_intercepts.c | 9 +++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
+index 58c45aaec..c2882e5ab 100644
+--- a/drd/drd_pthread_intercepts.c
++++ b/drd/drd_pthread_intercepts.c
+@@ -174,7 +174,16 @@ static int never_true;
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
+    { return implf argl; }
+ #else
++/*
++ * On Linux, intercept both the libc and the libpthread functions. At
++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
++ * functions in both libc and libpthread. Older glibc versions only have an
++ * implementation of the pthread functions in libpthread.
++ */
+ #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
++   { return implf argl; }                                               \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
+    { return implf argl; }
+--
+2.25.1
+
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb<http://valgrind_3.16.1.bb> b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb<http://valgrind_3.16.1.bb>
index d4ca1a7752..7508098b55 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb<http://valgrind_3.16.1.bb>
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb<http://valgrind_3.16.1.bb>
@@ -40,6 +40,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2<https://sourceware.org/pub/valgrind/valgrind-$%7BPV%7D.tar.bz2> \
            file://s390x_vec_op_t.patch \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
+           file://0001-drd-Port-to-Fedora-33.patch \
            "
 SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
 SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
--
2.25.1





[-- Attachment #2: Type: text/html, Size: 10494 bytes --]

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

* Re: [OE-core] [PATCH] valgrind: drd: fix pthread intercept test failures
  2020-10-09 20:21   ` Stacy Gaikovaia
@ 2020-10-09 21:22     ` Randy MacLeod
  0 siblings, 0 replies; 6+ messages in thread
From: Randy MacLeod @ 2020-10-09 21:22 UTC (permalink / raw)
  To: Gaikovaia, Stacy; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 6025 bytes --]

On Fri., Oct. 9, 2020, 16:21 Gaikovaia, Stacy, <
Stacy.Gaikovaia@windriver.com> wrote:

> Sure I'll do those things.
>
>
> Upsteam-Status: Backport
>
>
> >> This goes in the body of the patch. Mention the vg commit ID too please.
>
> I have the vg commit ID in the body of the patch, is that ok or should
> both things be in both spots?
>

Both is marginally better. This just helps the person doing the next uprev:
they find the upstream status in the patch and the commit is is right
there.

Randy

>
> Stacy
> ------------------------------
> *From:* Randy MacLeod <rwmacleod@gmail.com>
> *Sent:* Friday, October 9, 2020 4:14 PM
> *To:* Gaikovaia, Stacy <Stacy.Gaikovaia@windriver.com>
> *Cc:* openembedded-core@lists.openembedded.org <
> openembedded-core@lists.openembedded.org>
> *Subject:* Re: [OE-core] [PATCH] valgrind: drd: fix pthread intercept
> test failures
>
>
>
> On Fri., Oct. 9, 2020, 13:45 Stacy Gaikovaia, <
> Stacy.Gaikovaia@windriver.com> wrote:
>
> From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
>
> After glibc uprev 2.32 -> 2.32, the
>
>
> 2.31 -> 2.32
>
> following drd ptests
> fail with the error "condition variable has not been initialized".
>
> drd/tests/annotate_hb_err
> drd/tests/annotate_sem
> drd/tests/annotate_rwlock
> drd/tests/annotate_order_2
> drd/tests/annotate_smart_pointer
> drd/tests/annotate_spinlock
> drd/tests/monitor_example
> drd/tests/pth_cond_race
> drd/tests/pth_inconsistent_cond_wait
>
> In glibc 2.32, the POSIX thread functions are in both
> libc and libpthread, causing valgrind to misinterpert
> test behaviour. This patch tells valgrind to intercept
> the pthread functions in libc,
>
>
>
> It's intercepting both as mentioned in the patch commit:
>
>    "intercept both the libc and the libpthread functions"
> so please make that clear in your commit log.
>
>
> resolving these ptest
> failures. Patch can be removed once we uprev valgrind.
>
>
> Can you add the pass, fail, skip and total counts and mention the test
> system qemux86-64? This will help people track things when there is another
> update.
>
>
> Upsteam-Status: Backport
>
>
> This goes in the body of the patch. Mention the vg commit ID too please.
>
>
> Thanks,
>
> Randy
>
>
> Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
> ---
>  .../valgrind/0001-drd-Port-to-Fedora-33.patch | 46 +++++++++++++++++++
>  .../valgrind/valgrind_3.16.1.bb               |  1 +
>  2 files changed, 47 insertions(+)
>  create mode 100644
> meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
>
> diff --git
> a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> new file mode 100644
> index 0000000000..bca3d9b892
> --- /dev/null
> +++
> b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
> @@ -0,0 +1,46 @@
> +From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
> +From: Bart Van Assche <bvanassche@acm.org>
> +Date: Sat, 19 Sep 2020 08:08:59 -0700
> +Subject: [PATCH] drd: Port to Fedora 33
> +
> +Apparently on Fedora 33 the POSIX thread functions exist in both libc and
> +libpthread. Hence this patch that intercepts the pthread functions in
> +libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
> +
> +Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> +
> +This patch was imported from the valgrind sourceware server
> +(https://sourceware.org/git/?p=valgrind.git), commit id
> +15330adf7c2471fbaa6a0818db07078d81dbff97. It was modified to
> +remove the changes to the valgrind NEWS file, as these are difficult to
> +maintain and don't impact the valgrind code itself.
> +
> +Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
> +---
> + drd/drd_pthread_intercepts.c | 9 +++++++++
> + 1 file changed, 10 insertions(+)
> +
> +diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
> +index 58c45aaec..c2882e5ab 100644
> +--- a/drd/drd_pthread_intercepts.c
> ++++ b/drd/drd_pthread_intercepts.c
> +@@ -174,7 +174,16 @@ static int never_true;
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
> +    { return implf argl; }
> + #else
> ++/*
> ++ * On Linux, intercept both the libc and the libpthread functions. At
> ++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
> ++ * functions in both libc and libpthread. Older glibc versions only have
> an
> ++ * implementation of the pthread functions in libpthread.
> ++ */
> + #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
> ++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
> ++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
> ++   { return implf argl; }                                               \
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
> +    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
> +    { return implf argl; }
> +--
> +2.25.1
> +
> diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> index d4ca1a7752..7508098b55 100644
> --- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> +++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
> @@ -40,6 +40,7 @@ SRC_URI = "
> https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
>             file://s390x_vec_op_t.patch \
>
> file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
>             file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
> +           file://0001-drd-Port-to-Fedora-33.patch \
>             "
>  SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
>  SRC_URI[sha256sum] =
> "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
> --
> 2.25.1
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 11020 bytes --]

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

* [PATCH] valgrind: drd: fix pthread intercept test failures
@ 2020-10-13 14:44 Stacy Gaikovaia
  0 siblings, 0 replies; 6+ messages in thread
From: Stacy Gaikovaia @ 2020-10-13 14:44 UTC (permalink / raw)
  To: openembedded-core

From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>

After glibc uprev 2.31 -> 2.32, the following drd ptests
fail with the error "condition variable has not been initialized".

drd/tests/annotate_hb_err
drd/tests/annotate_sem
drd/tests/annotate_rwlock
drd/tests/annotate_order_2
drd/tests/annotate_smart_pointer
drd/tests/annotate_spinlock
drd/tests/monitor_example
drd/tests/pth_cond_race
drd/tests/pth_inconsistent_cond_wait

In glibc 2.32, the POSIX thread functions are in both
libc and libpthread, causing valgrind to misinterpert
test behaviour. This patch tells valgrind to intercept
both the libc and the libpthread functions, resolving
these ptest failures.

Here are the latest test results on qemux86-64:
=== Test Summary ===
TOTAL: 728
PASSED: 688
FAILED: 1
SKIPPED: 39

The failed test is in helgrind:
FAIL: helgrind/tests/pth_destroy_cond

Patch can be removed once we uprev valgrind.
See valgrind commit 15330adf7c2471fbaa6a0818db07078d81dbff97.

Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
---
 .../valgrind/0001-drd-Port-to-Fedora-33.patch | 48 +++++++++++++++++++
 .../valgrind/valgrind_3.16.1.bb               |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
new file mode 100644
index 0000000000..37f6ea667d
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
@@ -0,0 +1,48 @@
+From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 19 Sep 2020 08:08:59 -0700
+Subject: [PATCH] drd: Port to Fedora 33
+
+Apparently on Fedora 33 the POSIX thread functions exist in both libc and
+libpthread. Hence this patch that intercepts the pthread functions in
+libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
+
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+
+This patch was imported from the valgrind sourceware server
+(https://sourceware.org/git/?p=valgrind.git;a=commit;h=15330adf7c2471fbaa6a0818db07078d81dbff97)
+It was modified to remove the changes to the valgrind NEWS file,
+as these are difficult to maintain and don't impact the valgrind 
+code itself.
+
+Upstream-Status: Backport
+
+Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
+---
+ drd/drd_pthread_intercepts.c | 9 +++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
+index 58c45aaec..c2882e5ab 100644
+--- a/drd/drd_pthread_intercepts.c
++++ b/drd/drd_pthread_intercepts.c
+@@ -174,7 +174,16 @@ static int never_true;
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
+    { return implf argl; }
+ #else
++/*
++ * On Linux, intercept both the libc and the libpthread functions. At
++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
++ * functions in both libc and libpthread. Older glibc versions only have an
++ * implementation of the pthread functions in libpthread.
++ */
+ #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
++   { return implf argl; }                                               \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
+    { return implf argl; }
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index d4ca1a7752..7508098b55 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -40,6 +40,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
            file://s390x_vec_op_t.patch \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
+           file://0001-drd-Port-to-Fedora-33.patch \
            "
 SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
 SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
-- 
2.25.1


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

* [PATCH] valgrind: drd: fix pthread intercept test failures
@ 2020-10-09 20:44 Stacy Gaikovaia
  0 siblings, 0 replies; 6+ messages in thread
From: Stacy Gaikovaia @ 2020-10-09 20:44 UTC (permalink / raw)
  To: openembedded-core

From: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>

After glibc uprev 2.31 -> 2.32, the following drd ptests
fail with the error "condition variable has not been initialized".

drd/tests/annotate_hb_err
drd/tests/annotate_sem
drd/tests/annotate_rwlock
drd/tests/annotate_order_2
drd/tests/annotate_smart_pointer
drd/tests/annotate_spinlock
drd/tests/monitor_example
drd/tests/pth_cond_race
drd/tests/pth_inconsistent_cond_wait

In glibc 2.32, the POSIX thread functions are in both
libc and libpthread, causing valgrind to misinterpert
test behaviour. This patch tells valgrind to intercept
both the libc and the libpthread functions, resolving
these ptest failures.

Here are the latest test results on qemux86-64:
=== Test Summary ===                                                                       TOTAL: 728
PASSED: 688
FAILED: 1
SKIPPED: 39

The failed test is in helgrind:
FAIL: helgrind/tests/pth_destroy_cond

Patch can be removed once we uprev valgrind.
See valgrind commit 15330adf7c2471fbaa6a0818db07078d81dbff97.

Signed-off-by: Stacy Gaikovaia <Stacy.Gaikovaia@windriver.com>
---
 .../valgrind/0001-drd-Port-to-Fedora-33.patch | 48 +++++++++++++++++++
 .../valgrind/valgrind_3.16.1.bb               |  1 +
 2 files changed, 49 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
new file mode 100644
index 0000000000..693403a29d
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-drd-Port-to-Fedora-33.patch
@@ -0,0 +1,48 @@
+From 15330adf7c2471fbaa6a0818db07078d81dbff97 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <bvanassche@acm.org>
+Date: Sat, 19 Sep 2020 08:08:59 -0700
+Subject: [PATCH] drd: Port to Fedora 33
+
+Apparently on Fedora 33 the POSIX thread functions exist in both libc and
+libpthread. Hence this patch that intercepts the pthread functions in
+libc. See also https://bugs.kde.org/show_bug.cgi?id=426144 .
+
+Signed-off-by: Bart Van Assche <bvanassche@acm.org>
+
+This patch was imported from the valgrind sourceware server
+(https://sourceware.org/git/?p=valgrind.git), commit id
+15330adf7c2471fbaa6a0818db07078d81dbff97. It was modified to
+remove the changes to the valgrind NEWS file, as these are difficult to 
+maintain and don't impact the valgrind code itself.
+
+Upstream-Status: Backport
+
+Signed-off-by: Stacy Gaikovaia <stacy.gaikovaia@windriver.com>
+---
+ drd/drd_pthread_intercepts.c | 9 +++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/drd/drd_pthread_intercepts.c b/drd/drd_pthread_intercepts.c
+index 58c45aaec..c2882e5ab 100644
+--- a/drd/drd_pthread_intercepts.c
++++ b/drd/drd_pthread_intercepts.c
+@@ -174,7 +174,16 @@ static int never_true;
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
+    { return implf argl; }
+ #else
++/*
++ * On Linux, intercept both the libc and the libpthread functions. At
++ * least glibc 2.32.9000 (Fedora 34) has an implementation of all pthread
++ * functions in both libc and libpthread. Older glibc versions only have an
++ * implementation of the pthread functions in libpthread.
++ */
+ #define PTH_FUNC(ret_ty, zf, implf, argl_decl, argl)                    \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl;           \
++   ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBC_SONAME,zf) argl_decl            \
++   { return implf argl; }                                               \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl;     \
+    ret_ty VG_WRAP_FUNCTION_ZZ(VG_Z_LIBPTHREAD_SONAME,zf) argl_decl      \
+    { return implf argl; }
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
index d4ca1a7752..7508098b55 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.16.1.bb
@@ -40,6 +40,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
            file://s390x_vec_op_t.patch \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
+           file://0001-drd-Port-to-Fedora-33.patch \
            "
 SRC_URI[md5sum] = "d1b153f1ab17cf1f311705e7a83ef589"
 SRC_URI[sha256sum] = "c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca"
-- 
2.25.1


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

end of thread, other threads:[~2020-10-13 14:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09 17:44 [PATCH] valgrind: drd: fix pthread intercept test failures Stacy Gaikovaia
2020-10-09 20:14 ` [OE-core] " Randy MacLeod
2020-10-09 20:21   ` Stacy Gaikovaia
2020-10-09 21:22     ` Randy MacLeod
2020-10-09 20:44 Stacy Gaikovaia
2020-10-13 14:44 Stacy Gaikovaia

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.