Skip to contentSkip to conversation

Fix gdbserver-xen support on older kernels.

PATCH New Justin T. Gibbs 1 participant 1 message Mar 24, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix gdbserver-xen support on older kernels.

The xc_ptrace API relies on errno for passing success/failure indication back to callers. However, mapping operations that fall back on legacy APIs may leave errno set to a non-zero result even thought the operation is successful. This patch resets errno after successful map operations so that xc_ptrace doesn't inadvertently return a failure.

tools/libxc/xc_ptrace.c +7 -0
Index: xen-4.0.0-testing/tools/libxc/xc_ptrace.c
===================================================================
@@ -193,6 +193,13 @@
     if (map == NULL)
         return NULL;
 
+    /*
+     * Due to the use of API fallback code in libxc, errno may
+     * be clobberred during successful operations.  Since the caller
+     * of xc_ptrace is depending on errno for return status, clear
+     * errno here.
+     */
+    errno = 0;
     return map + (va & ~PAGE_MASK);
 }
 

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