Author: sewardj
Date: 2007-11-19 00:58:18 +0000 (Mon, 19 Nov 2007)
New Revision: 7183

Log:
When doing ptrace on amd64-linux, provide values which don't fail the
kernel's sanity checks for kernel >= 2.6.21.  Fixes #145622.

Modified:
   trunk/coregrind/m_debugger.c


Modified: trunk/coregrind/m_debugger.c
===================================================================
--- trunk/coregrind/m_debugger.c        2007-11-18 18:22:50 UTC (rev 7182)
+++ trunk/coregrind/m_debugger.c        2007-11-19 00:58:18 UTC (rev 7183)
@@ -87,6 +87,21 @@
    regs.r15    = vex->guest_R15;
    regs.eflags = LibVEX_GuestAMD64_get_rflags(vex);
    regs.rip    = vex->guest_RIP;
+   /* Set %{c,d,e,f,s,g}s and %{fs,gs}_base (whatever those are) to
+      values which don't fail the kernel's sanity checks.  I have no
+      idea what these should really be set to.  Anyway, mostly it
+      seems that zero is an allowable value, except for %cs and %ss
+      which have to have their lowest 2 bits be 11.  See putreg() in
+      linux-2.6.23/arch/x86_64/kernel/ptrace.c for the apparently
+      relevant sanity checks.  This fixes #145622. */
+   regs.cs      = 3;
+   regs.ds      = 0;
+   regs.es      = 0;
+   regs.fs      = 0;
+   regs.ss      = 3;
+   regs.gs      = 0;
+   regs.fs_base = 0;
+   regs.gs_base = 0;
    return VG_(ptrace)(VKI_PTRACE_SETREGS, pid, NULL, &regs);
 
 #elif defined(VGP_ppc32_linux)


-------------------------------------------------------------------------
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
Valgrind-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-developers

Reply via email to