]> code.ossystems Code Review - openembedded-core.git/commitdiff
elfutils: Add patch from upstream for glibc 2.34 ptest fixes
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 4 Aug 2021 21:47:18 +0000 (22:47 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 5 Aug 2021 16:48:04 +0000 (17:48 +0100)
Add a patch being discussed upstream to fix a ptest issue with glibc 2.34.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/elfutils/elfutils_0.185.bb
meta/recipes-devtools/elfutils/files/glibc-2.34-fix.patch [new file with mode: 0644]

index 3e06e7b200e0fc09e4f2e2d5bd83f191120e03d6..5031ab97e7af89213954904cf4f9741c480ab52e 100644 (file)
@@ -22,6 +22,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
            file://ptest.patch \
            file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \
            file://0001-debuginfod-debuginfod-client.c-correct-string-format.patch \
+           file://glibc-2.34-fix.patch \
            "
 SRC_URI:append:libc-musl = " \
            file://0002-musl-libs.patch \
diff --git a/meta/recipes-devtools/elfutils/files/glibc-2.34-fix.patch b/meta/recipes-devtools/elfutils/files/glibc-2.34-fix.patch
new file mode 100644 (file)
index 0000000..9509fb4
--- /dev/null
@@ -0,0 +1,138 @@
+glibc 2.34 calls pthread_kill from the raise function. Before raise
+directly called the (tg)kill syscall. So allow pthread_kill to be the
+first frame in a backtrace where raise is expected. Also change some
+asserts to fprintf plus abort to make it more clear why the testcase
+fails.
+
+https://sourceware.org/bugzilla/show_bug.cgi?id=28190
+
+Signed-off-by: Mark Wielaard <mark@klomp.org>
+Upstream-Status: Submitted [https://sourceware.org/pipermail/elfutils-devel/2021q3/004019.html]
+---
+ tests/ChangeLog   |  6 +++++
+ tests/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++------
+ 2 files changed, 61 insertions(+), 7 deletions(-)
+
+Index: elfutils-0.185/tests/ChangeLog
+===================================================================
+--- elfutils-0.185.orig/tests/ChangeLog
++++ elfutils-0.185/tests/ChangeLog
+@@ -1,3 +1,9 @@
++2021-08-04  Mark Wielaard  <mark@klomp.org>
++
++      PR28190
++      * backtrace.c (callback_verify): Check for pthread_kill as first
++      frame. Change asserts to fprintf plus abort.
++
+ 2021-05-14  Frank Ch. Eigler <fche@redhat.com>
+       PR27859
+Index: elfutils-0.185/tests/backtrace.c
+===================================================================
+--- elfutils-0.185.orig/tests/backtrace.c
++++ elfutils-0.185/tests/backtrace.c
+@@ -97,6 +97,9 @@ callback_verify (pid_t tid, unsigned fra
+   static bool reduce_frameno = false;
+   if (reduce_frameno)
+     frameno--;
++  static bool pthread_kill_seen = false;
++  if (pthread_kill_seen)
++    frameno--;
+   if (! use_raise_jmp_patching && frameno >= 2)
+     frameno += 2;
+   const char *symname2 = NULL;
+@@ -107,11 +110,26 @@ callback_verify (pid_t tid, unsigned fra
+              && (strcmp (symname, "__kernel_vsyscall") == 0
+                  || strcmp (symname, "__libc_do_syscall") == 0))
+       reduce_frameno = true;
++      else if (! pthread_kill_seen && symname
++             && strstr (symname, "pthread_kill") != NULL)
++      pthread_kill_seen = true;
+       else
+-      assert (symname && strcmp (symname, "raise") == 0);
++      {
++        if (!symname || strcmp (symname, "raise") != 0)
++          {
++            fprintf (stderr,
++                     "case 0: expected symname 'raise' got '%s'\n", symname);
++            abort ();
++          }
++      }
+       break;
+     case 1:
+-      assert (symname != NULL && strcmp (symname, "sigusr2") == 0);
++      if (symname == NULL || strcmp (symname, "sigusr2") != 0)
++      {
++        fprintf (stderr,
++                 "case 1: expected symname 'sigusr2' got '%s'\n", symname);
++        abort ();
++      }
+       break;
+     case 2: // x86_64 only
+       /* __restore_rt - glibc maybe does not have to have this symbol.  */
+@@ -120,11 +138,21 @@ callback_verify (pid_t tid, unsigned fra
+       if (use_raise_jmp_patching)
+       {
+         /* Verify we trapped on the very first instruction of jmp.  */
+-        assert (symname != NULL && strcmp (symname, "jmp") == 0);
++        if (symname == NULL || strcmp (symname, "jmp") != 0)
++          {
++            fprintf (stderr,
++                     "case 3: expected symname 'raise' got '%s'\n", symname);
++            abort ();
++          }
+         mod = dwfl_addrmodule (dwfl, pc - 1);
+         if (mod)
+           symname2 = dwfl_module_addrname (mod, pc - 1);
+-        assert (symname2 == NULL || strcmp (symname2, "jmp") != 0);
++        if (symname2 == NULL || strcmp (symname2, "jmp") != 0)
++          {
++            fprintf (stderr,
++                     "case 3: expected symname2 'jmp' got '%s'\n", symname2);
++            abort ();
++          }
+         break;
+       }
+       FALLTHROUGH;
+@@ -137,11 +165,22 @@ callback_verify (pid_t tid, unsigned fra
+         duplicate_sigusr2 = true;
+         break;
+       }
+-      assert (symname != NULL && strcmp (symname, "stdarg") == 0);
++      if (symname == NULL || strcmp (symname, "stdarg") != 0)
++      {
++        fprintf (stderr,
++                 "case 4: expected symname 'stdarg' got '%s'\n", symname);
++        abort ();
++      }
+       break;
+     case 5:
+       /* Verify we trapped on the very last instruction of child.  */
+-      assert (symname != NULL && strcmp (symname, "backtracegen") == 0);
++      if (symname == NULL || strcmp (symname, "backtracegen") != 0)
++      {
++        fprintf (stderr,
++                 "case 5: expected symname 'backtracegen' got '%s'\n",
++                 symname);
++        abort ();
++      }
+       mod = dwfl_addrmodule (dwfl, pc);
+       if (mod)
+       symname2 = dwfl_module_addrname (mod, pc);
+@@ -151,7 +190,15 @@ callback_verify (pid_t tid, unsigned fra
+       // instructions or even inserts some padding instructions at the end
+       // (which apparently happens on ppc64).
+       if (use_raise_jmp_patching)
+-        assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
++      {
++          if (symname2 != NULL && strcmp (symname2, "backtracegen") == 0)
++          {
++            fprintf (stderr,
++                     "use_raise_jmp_patching didn't expect symname2 "
++                     "'backtracegen'\n");
++            abort ();
++          }
++      }
+       break;
+   }
+ }