When constructing a signal frame, tell the tool that the registers

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
This commit is contained in:
Julian Seward 2014-05-08 15:14:48 +00:00
parent 4aea515f54
commit c513ea3cd8

View 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. */