0.185-5 - Add elfutils-0.185-raise-pthread_kill-backtrace.patch

- Use autosetup
This commit is contained in:
Mark Wielaard 2021-08-06 16:00:48 +02:00
parent 972afdb189
commit 18d7a42230
2 changed files with 137 additions and 9 deletions

View File

@ -0,0 +1,125 @@
commit 9aee0992d6e6ec4cce2c015d8da4b61022c6f6dd
Author: Mark Wielaard <mark@klomp.org>
Date: Wed Aug 4 21:01:27 2021 +0200
tests: Allow an extra pthread_kill frame in backtrace tests
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>
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 36c8b8c4..afc12fb9 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -97,6 +97,9 @@ callback_verify (pid_t tid, unsigned frameno, Dwarf_Addr pc,
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 frameno, Dwarf_Addr pc,
&& (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 frameno, Dwarf_Addr pc,
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 frameno, Dwarf_Addr pc,
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 frameno, Dwarf_Addr pc,
// 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;
}
}

View File

@ -1,6 +1,6 @@
Name: elfutils Name: elfutils
Version: 0.185 Version: 0.185
%global baserelease 4 %global baserelease 5
Release: %{baserelease}%{?dist} Release: %{baserelease}%{?dist}
URL: http://elfutils.org/ URL: http://elfutils.org/
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/ %global source_url ftp://sourceware.org/pub/elfutils/%{version}/
@ -62,6 +62,7 @@ BuildRequires: gettext-devel
%endif %endif
# Patches # Patches
Patch1: elfutils-0.185-raise-pthread_kill-backtrace.patch
%description %description
Elfutils is a collection of utilities, including stack (to show Elfutils is a collection of utilities, including stack (to show
@ -228,9 +229,7 @@ The ELF/DWARF file searching functions in libdwfl can query
such servers to download those files on demand. such servers to download those files on demand.
%prep %prep
%setup -q %autosetup -p1
# Apply patches
autoreconf -f -v -i autoreconf -f -v -i
@ -257,12 +256,12 @@ RPM_OPT_FLAGS="${RPM_OPT_FLAGS} -Wformat"
trap 'cat config.log' EXIT trap 'cat config.log' EXIT
%configure CFLAGS="$RPM_OPT_FLAGS -fexceptions" --enable-debuginfod-urls=https://debuginfod.fedoraproject.org/ %configure CFLAGS="$RPM_OPT_FLAGS" --enable-debuginfod-urls=https://debuginfod.fedoraproject.org/
trap '' EXIT trap '' EXIT
%make_build -s %make_build
%install %install
%make_install -s %make_install
chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so* chmod +x ${RPM_BUILD_ROOT}%{_prefix}/%{_lib}/lib*.so*
# We don't want the static libraries # We don't want the static libraries
@ -285,8 +284,8 @@ uname -r; rpm -q binutils gcc glibc || true
# FIXME for 0.186 # FIXME for 0.186
# run-debuginfod-find.sh is a bad test # run-debuginfod-find.sh is a bad test
# %%make_build -s check || (cat tests/test-suite.log; false) # %%make_build check || (cat tests/test-suite.log; false)
%make_build -s check || (cat tests/test-suite.log; true) %make_build check || (cat tests/test-suite.log; true)
# Only the latest Fedora and EPEL have these scriptlets, # Only the latest Fedora and EPEL have these scriptlets,
# older Fedora and plain RHEL don't. # older Fedora and plain RHEL don't.
@ -410,6 +409,10 @@ exit 0
%systemd_postun_with_restart debuginfod.service %systemd_postun_with_restart debuginfod.service
%changelog %changelog
* Thu Aug 5 2021 Mark Wielaard <mjw@fedoraproject.org> - 0.185-5
- Use autosetup
- Add elfutils-0.185-raise-pthread_kill-backtrace.patch
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.185-4 * Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.185-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild