diff --git a/valgrind-3.14.0-final_tidyup.patch b/valgrind-3.14.0-final_tidyup.patch new file mode 100644 index 0000000..f4e7698 --- /dev/null +++ b/valgrind-3.14.0-final_tidyup.patch @@ -0,0 +1,59 @@ +commit be7a73004583aab5d4c97cf55276ca58d5b3090b +Author: Mark Wielaard +Date: Wed Dec 12 14:15:28 2018 +0100 + + Mark helper regs defined in final_tidyup before freeres_wrapper call. + + In final_tidyup we setup the guest to call the freeres_wrapper, which + will (possibly) call __gnu_cxx::__freeres() and/or __libc_freeres(). + + In a couple of cases (ppc64be, ppc64le and mips32) this involves setting + up one or more helper registers. Since we setup these guest registers + we should make sure to mark them as fully defined. Otherwise we might + see spurious warnings about undefined value usage if the guest register + happened to not be fully defined before. + + This fixes PR402006. + +diff --git a/coregrind/m_main.c b/coregrind/m_main.c +index 00702fc..22872a2 100644 +--- a/coregrind/m_main.c ++++ b/coregrind/m_main.c +@@ -2304,22 +2304,35 @@ static void final_tidyup(ThreadId tid) + "Caught __NR_exit; running %s wrapper\n", msgs[to_run - 1]); + } + +- /* set thread context to point to freeres_wrapper */ +- /* ppc64be-linux note: freeres_wrapper gives us the real ++ /* Set thread context to point to freeres_wrapper. ++ ppc64be-linux note: freeres_wrapper gives us the real + function entry point, not a fn descriptor, so can use it + directly. However, we need to set R2 (the toc pointer) + appropriately. */ + VG_(set_IP)(tid, freeres_wrapper); ++ + # if defined(VGP_ppc64be_linux) + VG_(threads)[tid].arch.vex.guest_GPR2 = r2; ++ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid, ++ offsetof(VexGuestPPC64State, guest_GPR2), ++ sizeof(VG_(threads)[tid].arch.vex.guest_GPR2)); + # elif defined(VGP_ppc64le_linux) + /* setting GPR2 but not really needed, GPR12 is needed */ + VG_(threads)[tid].arch.vex.guest_GPR2 = freeres_wrapper; ++ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid, ++ offsetof(VexGuestPPC64State, guest_GPR2), ++ sizeof(VG_(threads)[tid].arch.vex.guest_GPR2)); + VG_(threads)[tid].arch.vex.guest_GPR12 = freeres_wrapper; ++ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid, ++ offsetof(VexGuestPPC64State, guest_GPR12), ++ sizeof(VG_(threads)[tid].arch.vex.guest_GPR12)); + # endif + /* mips-linux note: we need to set t9 */ + # if defined(VGP_mips32_linux) || defined(VGP_mips64_linux) + VG_(threads)[tid].arch.vex.guest_r25 = freeres_wrapper; ++ VG_TRACK(post_reg_write, Vg_CoreClientReq, tid, ++ offsetof(VexGuestMIPS32State, guest_r25), ++ sizeof(VG_(threads)[tid].arch.vex.guest_r25)); + # endif + + /* Pass a parameter to freeres_wrapper(). */ diff --git a/valgrind.spec b/valgrind.spec index 593f97a..caf7447 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -131,6 +131,10 @@ Patch16: valgrind-3.14.0-enable-ppc-Iop_Sar_Shr8.patch # KDE#401627 memcheck errors with glibc avx2 optimized wcsncmp Patch17: valgrind-3.14.0-wcsncmp.patch +# KDE#402006 mark helper regs defined in final_tidyup before freeres_wrapper +# Prereq for KDE#386945 +Patch18: valgrind-3.14.0-final_tidyup.patch + %if %{build_multilib} # Ensure glibc{,-devel} is installed for both multilib arches BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so @@ -280,6 +284,7 @@ Valgrind User Manual for details. %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 %build CC=gcc @@ -514,6 +519,9 @@ fi %endif %changelog +* Wed Dec 12 2018 Mark Wielaard +- Add valgrind-3.14.0-final_tidyup.patch + * Sat Dec 1 2018 Mark Wielaard - 3.14.0.5 - Add valgrind-3.14.0-wcsncmp.patch (#1645971) - Replace valgrind-3.14.0-s390x-vec-float-point-{code,test}.patch