|
From: <sv...@va...> - 2012-10-15 18:44:33
|
bart 2012-10-15 19:44:18 +0100 (Mon, 15 Oct 2012)
New Revision: 13047
Log:
xen: Useful messages for sys/domctl interface_version mismatch
Modified files:
trunk/coregrind/m_syswrap/syswrap-xen.c
Modified: trunk/coregrind/m_syswrap/syswrap-xen.c (+45 -7)
===================================================================
--- trunk/coregrind/m_syswrap/syswrap-xen.c 2012-10-15 15:21:22 +01:00 (rev 13046)
+++ trunk/coregrind/m_syswrap/syswrap-xen.c 2012-10-15 19:44:18 +01:00 (rev 13047)
@@ -59,6 +59,7 @@
#include "priv_syswrap-xen.h"
#include <stdint.h>
+#include <inttypes.h>
#define __XEN_TOOLS__
@@ -353,10 +354,27 @@
PRE_MEM_READ("__HYPERVISOR_sysctl", ARG1,
sizeof(uint32_t) + sizeof(uint32_t));
- if (!sysctl || sysctl->interface_version != XEN_SYSCTL_INTERFACE_VERSION)
- /* BUG ? */
+ if (!sysctl)
return;
+ if (sysctl->interface_version != XEN_SYSCTL_INTERFACE_VERSION) {
+ VG_(dmsg)("WARNING: sysctl version %"PRIx32" not supported, "
+ "built for %"PRIx32"\n",
+ sysctl->interface_version,
+ XEN_SYSCTL_INTERFACE_VERSION);
+ if (VG_(clo_verbosity) > 1) {
+ VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
+ }
+ VG_(dmsg)("You may be able to write your own handler.\n");
+ VG_(dmsg)("Read the file README_MISSING_SYSCALL_OR_IOCTL.\n");
+ VG_(dmsg)("Nevertheless we consider this a bug. Please report\n");
+ VG_(dmsg)("it at http://valgrind.org/support/bug_reports.html &\n");
+ VG_(dmsg)("http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen.\n");
+
+ SET_STATUS_Failure(VKI_EINVAL);
+ return;
+ }
+
#define __PRE_XEN_SYSCTL_READ(_sysctl, _union, _field) \
PRE_MEM_READ("XEN_SYSCTL_" # _sysctl, \
(Addr)&sysctl->u._union._field, \
@@ -438,10 +456,27 @@
PRE_MEM_READ("__HYPERVISOR_domctl", ARG1,
sizeof(uint32_t) + sizeof(uint32_t) + sizeof(domid_t));
- if (!domctl || domctl->interface_version != XEN_DOMCTL_INTERFACE_VERSION)
- /* BUG ? */
+ if (!domctl)
return;
+ if (domctl->interface_version != XEN_DOMCTL_INTERFACE_VERSION) {
+ VG_(dmsg)("WARNING: domctl version %"PRIx32" not supported, "
+ "built for %"PRIx32"\n",
+ domctl->interface_version,
+ XEN_DOMCTL_INTERFACE_VERSION);
+ if (VG_(clo_verbosity) > 1) {
+ VG_(get_and_pp_StackTrace)(tid, VG_(clo_backtrace_size));
+ }
+ VG_(dmsg)("You may be able to write your own handler.\n");
+ VG_(dmsg)("Read the file README_MISSING_SYSCALL_OR_IOCTL.\n");
+ VG_(dmsg)("Nevertheless we consider this a bug. Please report\n");
+ VG_(dmsg)("it at http://valgrind.org/support/bug_reports.html &\n");
+ VG_(dmsg)("http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen.\n");
+
+ SET_STATUS_Failure(VKI_EINVAL);
+ return;
+ }
+
#define __PRE_XEN_DOMCTL_READ(_domctl, _union, _field) \
PRE_MEM_READ("XEN_DOMCTL_" # _domctl, \
(Addr)&domctl->u._union._field, \
@@ -740,11 +775,14 @@
case XEN_SYSCTL_topologyinfo:
POST_XEN_SYSCTL_WRITE(topologyinfo, max_cpu_index);
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_core.p,
+ if (sysctl->u.topologyinfo.cpu_to_core.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_core.p,
sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_socket.p,
+ if (sysctl->u.topologyinfo.cpu_to_socket.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_socket.p,
sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
- POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_node.p,
+ if (sysctl->u.topologyinfo.cpu_to_node.p)
+ POST_MEM_WRITE((Addr)sysctl->u.topologyinfo.cpu_to_node.p,
sizeof(uint32_t) * sysctl->u.topologyinfo.max_cpu_index);
break;
|