]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
When constructing a signal frame, tell the tool that the registers
authorJulian Seward <jseward@acm.org>
Thu, 8 May 2014 15:14:48 +0000 (15:14 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 8 May 2014 15:14:48 +0000 (15:14 +0000)
that carry the arguments (signo, siginfo, mcontext) for the handler,
have been written.  In particular this makes Memcheck think
(correctly) they are defined and so removes a bunch of false positives
that can happen in the signal handler, should the registers have been
marked undefined before the signal.

The same fix needs to be applied to various other of these
sigframe-*.c files.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13943

coregrind/m_sigframe/sigframe-amd64-linux.c

index 7d03f0336aa8b19a53abdc75d84a21b18cfd92e0..7473fa744d7ac74a1ac2affb25c53e74546d40b6 100644 (file)
@@ -521,6 +521,16 @@ void VG_(sigframe_create)( ThreadId tid,
    tst->arch.vex.guest_RDI = (ULong) siginfo->si_signo;
    tst->arch.vex.guest_RSI = (Addr) &frame->sigInfo;
    tst->arch.vex.guest_RDX = (Addr) &frame->uContext;
+   /* And tell the tool that these registers have been written. */
+   VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+             offsetof(VexGuestAMD64State,guest_RIP), sizeof(UWord) );
+   VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+             offsetof(VexGuestAMD64State,guest_RDI), sizeof(UWord) );
+   VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+             offsetof(VexGuestAMD64State,guest_RSI), sizeof(UWord) );
+   VG_TRACK( post_reg_write, Vg_CoreSignal, tst->tid,
+             offsetof(VexGuestAMD64State,guest_RDX), sizeof(UWord) );
+
    /* This thread needs to be marked runnable, but we leave that the
       caller to do. */