Skip to contentSkip to conversation

fix out-of-bounds memory access in linux-xen-low.c (gdbserver)

PATCH New Simon Kagstrom 1 participant 1 message May 12, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix out-of-bounds memory access in linux-xen-low.c (gdbserver)

The following patch fixes an out-of-bounds memory access in xc_ptrace.c. Currently, Xen always copies the entire 512 byte extended FPU state (fxsave) even if only the "regular" FPU state was requested.

This breaks since the memory buffer allocated in linux-xen-low.c:regsets_fetch_inferior_registers() is only large enough to hold the "plain" FPU registers.

tools/libxc/xc_ptrace.c +5 -0
diff -r 5df90f95916e tools/libxc/xc_ptrace.c
@@ -510,6 +510,11 @@ xc_ptrace(
         break;
 
     case PTRACE_GETFPREGS:
+        if (!current_isfile && fetch_regs(xc_handle, cpu, NULL)) 
+                goto out_error;
+        memcpy(data, &ctxt[cpu].fpu_ctxt, sizeof (elf_fpregset_t));
+        break;
+
     case PTRACE_GETFPXREGS:
         if (!current_isfile && fetch_regs(xc_handle, cpu, NULL)) 
                 goto out_error;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel