Author: sewardj
Date: 2007-11-19 14:54:09 +0000 (Mon, 19 Nov 2007)
New Revision: 7187
Log:
Zero out the vki_user_regs_struct before using it. Otherwise, we end
up passing uninitialised garbage on the stack to ptrace(SETREGS, ...)
for any fields in the struct which are not filled in. This does not
fix any known bugs, but seems like a good precautionary measure.
Modified:
trunk/coregrind/m_debugger.c
Modified: trunk/coregrind/m_debugger.c
===================================================================
--- trunk/coregrind/m_debugger.c 2007-11-19 02:47:16 UTC (rev 7186)
+++ trunk/coregrind/m_debugger.c 2007-11-19 14:54:09 UTC (rev 7187)
@@ -49,6 +49,7 @@
{
#if defined(VGP_x86_linux)
struct vki_user_regs_struct regs;
+ VG_(memset)(®s, 0, sizeof(regs));
regs.cs = vex->guest_CS;
regs.ss = vex->guest_SS;
regs.ds = vex->guest_DS;
@@ -69,6 +70,7 @@
#elif defined(VGP_amd64_linux)
struct vki_user_regs_struct regs;
+ VG_(memset)(®s, 0, sizeof(regs));
regs.rax = vex->guest_RAX;
regs.rbx = vex->guest_RBX;
regs.rcx = vex->guest_RCX;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Valgrind-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers