diff options
| -rw-r--r-- | meta/recipes-devtools/elfutils/elfutils_0.185.bb | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/elfutils/files/glibc-2.34-fix.patch | 138 |
2 files changed, 139 insertions, 0 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.185.bb b/meta/recipes-devtools/elfutils/elfutils_0.185.bb index 3e06e7b200..5031ab97e7 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.185.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.185.bb | |||
| @@ -22,6 +22,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ | |||
| 22 | file://ptest.patch \ | 22 | file://ptest.patch \ |
| 23 | file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ | 23 | file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ |
| 24 | file://0001-debuginfod-debuginfod-client.c-correct-string-format.patch \ | 24 | file://0001-debuginfod-debuginfod-client.c-correct-string-format.patch \ |
| 25 | file://glibc-2.34-fix.patch \ | ||
| 25 | " | 26 | " |
| 26 | SRC_URI:append:libc-musl = " \ | 27 | SRC_URI:append:libc-musl = " \ |
| 27 | file://0002-musl-libs.patch \ | 28 | 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 index 0000000000..9509fb4e77 --- /dev/null +++ b/meta/recipes-devtools/elfutils/files/glibc-2.34-fix.patch | |||
| @@ -0,0 +1,138 @@ | |||
| 1 | glibc 2.34 calls pthread_kill from the raise function. Before raise | ||
| 2 | directly called the (tg)kill syscall. So allow pthread_kill to be the | ||
| 3 | first frame in a backtrace where raise is expected. Also change some | ||
| 4 | asserts to fprintf plus abort to make it more clear why the testcase | ||
| 5 | fails. | ||
| 6 | |||
| 7 | https://sourceware.org/bugzilla/show_bug.cgi?id=28190 | ||
| 8 | |||
| 9 | Signed-off-by: Mark Wielaard <mark@klomp.org> | ||
| 10 | Upstream-Status: Submitted [https://sourceware.org/pipermail/elfutils-devel/2021q3/004019.html] | ||
| 11 | --- | ||
| 12 | tests/ChangeLog | 6 +++++ | ||
| 13 | tests/backtrace.c | 62 +++++++++++++++++++++++++++++++++++++++++------ | ||
| 14 | 2 files changed, 61 insertions(+), 7 deletions(-) | ||
| 15 | |||
| 16 | Index: elfutils-0.185/tests/ChangeLog | ||
| 17 | =================================================================== | ||
| 18 | --- elfutils-0.185.orig/tests/ChangeLog | ||
| 19 | +++ elfutils-0.185/tests/ChangeLog | ||
| 20 | @@ -1,3 +1,9 @@ | ||
| 21 | +2021-08-04 Mark Wielaard <mark@klomp.org> | ||
| 22 | + | ||
| 23 | + PR28190 | ||
| 24 | + * backtrace.c (callback_verify): Check for pthread_kill as first | ||
| 25 | + frame. Change asserts to fprintf plus abort. | ||
| 26 | + | ||
| 27 | 2021-05-14 Frank Ch. Eigler <fche@redhat.com> | ||
| 28 | |||
| 29 | PR27859 | ||
| 30 | Index: elfutils-0.185/tests/backtrace.c | ||
| 31 | =================================================================== | ||
| 32 | --- elfutils-0.185.orig/tests/backtrace.c | ||
| 33 | +++ elfutils-0.185/tests/backtrace.c | ||
| 34 | @@ -97,6 +97,9 @@ callback_verify (pid_t tid, unsigned fra | ||
| 35 | static bool reduce_frameno = false; | ||
| 36 | if (reduce_frameno) | ||
| 37 | frameno--; | ||
| 38 | + static bool pthread_kill_seen = false; | ||
| 39 | + if (pthread_kill_seen) | ||
| 40 | + frameno--; | ||
| 41 | if (! use_raise_jmp_patching && frameno >= 2) | ||
| 42 | frameno += 2; | ||
| 43 | const char *symname2 = NULL; | ||
| 44 | @@ -107,11 +110,26 @@ callback_verify (pid_t tid, unsigned fra | ||
| 45 | && (strcmp (symname, "__kernel_vsyscall") == 0 | ||
| 46 | || strcmp (symname, "__libc_do_syscall") == 0)) | ||
| 47 | reduce_frameno = true; | ||
| 48 | + else if (! pthread_kill_seen && symname | ||
| 49 | + && strstr (symname, "pthread_kill") != NULL) | ||
| 50 | + pthread_kill_seen = true; | ||
| 51 | else | ||
| 52 | - assert (symname && strcmp (symname, "raise") == 0); | ||
| 53 | + { | ||
| 54 | + if (!symname || strcmp (symname, "raise") != 0) | ||
| 55 | + { | ||
| 56 | + fprintf (stderr, | ||
| 57 | + "case 0: expected symname 'raise' got '%s'\n", symname); | ||
| 58 | + abort (); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | break; | ||
| 62 | case 1: | ||
| 63 | - assert (symname != NULL && strcmp (symname, "sigusr2") == 0); | ||
| 64 | + if (symname == NULL || strcmp (symname, "sigusr2") != 0) | ||
| 65 | + { | ||
| 66 | + fprintf (stderr, | ||
| 67 | + "case 1: expected symname 'sigusr2' got '%s'\n", symname); | ||
| 68 | + abort (); | ||
| 69 | + } | ||
| 70 | break; | ||
| 71 | case 2: // x86_64 only | ||
| 72 | /* __restore_rt - glibc maybe does not have to have this symbol. */ | ||
| 73 | @@ -120,11 +138,21 @@ callback_verify (pid_t tid, unsigned fra | ||
| 74 | if (use_raise_jmp_patching) | ||
| 75 | { | ||
| 76 | /* Verify we trapped on the very first instruction of jmp. */ | ||
| 77 | - assert (symname != NULL && strcmp (symname, "jmp") == 0); | ||
| 78 | + if (symname == NULL || strcmp (symname, "jmp") != 0) | ||
| 79 | + { | ||
| 80 | + fprintf (stderr, | ||
| 81 | + "case 3: expected symname 'raise' got '%s'\n", symname); | ||
| 82 | + abort (); | ||
| 83 | + } | ||
| 84 | mod = dwfl_addrmodule (dwfl, pc - 1); | ||
| 85 | if (mod) | ||
| 86 | symname2 = dwfl_module_addrname (mod, pc - 1); | ||
| 87 | - assert (symname2 == NULL || strcmp (symname2, "jmp") != 0); | ||
| 88 | + if (symname2 == NULL || strcmp (symname2, "jmp") != 0) | ||
| 89 | + { | ||
| 90 | + fprintf (stderr, | ||
| 91 | + "case 3: expected symname2 'jmp' got '%s'\n", symname2); | ||
| 92 | + abort (); | ||
| 93 | + } | ||
| 94 | break; | ||
| 95 | } | ||
| 96 | FALLTHROUGH; | ||
| 97 | @@ -137,11 +165,22 @@ callback_verify (pid_t tid, unsigned fra | ||
| 98 | duplicate_sigusr2 = true; | ||
| 99 | break; | ||
| 100 | } | ||
| 101 | - assert (symname != NULL && strcmp (symname, "stdarg") == 0); | ||
| 102 | + if (symname == NULL || strcmp (symname, "stdarg") != 0) | ||
| 103 | + { | ||
| 104 | + fprintf (stderr, | ||
| 105 | + "case 4: expected symname 'stdarg' got '%s'\n", symname); | ||
| 106 | + abort (); | ||
| 107 | + } | ||
| 108 | break; | ||
| 109 | case 5: | ||
| 110 | /* Verify we trapped on the very last instruction of child. */ | ||
| 111 | - assert (symname != NULL && strcmp (symname, "backtracegen") == 0); | ||
| 112 | + if (symname == NULL || strcmp (symname, "backtracegen") != 0) | ||
| 113 | + { | ||
| 114 | + fprintf (stderr, | ||
| 115 | + "case 5: expected symname 'backtracegen' got '%s'\n", | ||
| 116 | + symname); | ||
| 117 | + abort (); | ||
| 118 | + } | ||
| 119 | mod = dwfl_addrmodule (dwfl, pc); | ||
| 120 | if (mod) | ||
| 121 | symname2 = dwfl_module_addrname (mod, pc); | ||
| 122 | @@ -151,7 +190,15 @@ callback_verify (pid_t tid, unsigned fra | ||
| 123 | // instructions or even inserts some padding instructions at the end | ||
| 124 | // (which apparently happens on ppc64). | ||
| 125 | if (use_raise_jmp_patching) | ||
| 126 | - assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0); | ||
| 127 | + { | ||
| 128 | + if (symname2 != NULL && strcmp (symname2, "backtracegen") == 0) | ||
| 129 | + { | ||
| 130 | + fprintf (stderr, | ||
| 131 | + "use_raise_jmp_patching didn't expect symname2 " | ||
| 132 | + "'backtracegen'\n"); | ||
| 133 | + abort (); | ||
| 134 | + } | ||
| 135 | + } | ||
| 136 | break; | ||
| 137 | } | ||
| 138 | } | ||
