debuggers.hg
changeset 918:0d9e340b7374
bitkeeper revision 1.551 (3fa639b1Ozv5gqMWisVgyFIergU8DQ)
hypervisor.h, dom0_ops.h, dom0_ops.c, dom0_defs.h:
Add a version number to the dom0_op interface, to prevent crashes and hangs with out-of-date user tools.
hypervisor.h, dom0_ops.h, dom0_ops.c, dom0_defs.h:
Add a version number to the dom0_op interface, to prevent crashes and hangs with out-of-date user tools.
author | kaf24@scramble.cl.cam.ac.uk |
---|---|
date | Mon Nov 03 11:19:13 2003 +0000 (2003-11-03) |
parents | 18d30acdfb3e |
children | e6d36e3e7847 |
files | tools/internal/dom0_defs.h xen/common/dom0_ops.c xen/include/hypervisor-ifs/dom0_ops.h xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h |
line diff
1.1 --- a/tools/internal/dom0_defs.h Mon Nov 03 10:25:35 2003 +0000 1.2 +++ b/tools/internal/dom0_defs.h Mon Nov 03 11:19:13 2003 +0000 1.3 @@ -85,6 +85,8 @@ static inline int do_dom0_op(dom0_op_t * 1.4 int ret = -1; 1.5 privcmd_hypercall_t hypercall; 1.6 1.7 + op->interface_version = DOM0_INTERFACE_VERSION; 1.8 + 1.9 hypercall.op = __HYPERVISOR_dom0_op; 1.10 hypercall.arg[0] = (unsigned long)op; 1.11 1.12 @@ -95,7 +97,12 @@ static inline int do_dom0_op(dom0_op_t * 1.13 } 1.14 1.15 if ( do_xen_hypercall(&hypercall) < 0 ) 1.16 + { 1.17 + if ( errno == EINVAL ) 1.18 + fprintf(stderr, "Dom0 operation failed -- need to" 1.19 + " rebuild the user-space tool set?\n"); 1.20 goto out2; 1.21 + } 1.22 1.23 ret = 0; 1.24
2.1 --- a/xen/common/dom0_ops.c Mon Nov 03 10:25:35 2003 +0000 2.2 +++ b/xen/common/dom0_ops.c Mon Nov 03 11:19:13 2003 +0000 2.3 @@ -92,6 +92,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op) 2.4 if ( copy_from_user(&op, u_dom0_op, sizeof(op)) ) 2.5 return -EFAULT; 2.6 2.7 + if ( op.interface_version != DOM0_INTERFACE_VERSION ) 2.8 + return -EINVAL; 2.9 + 2.10 switch ( op.cmd ) 2.11 { 2.12
3.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h Mon Nov 03 10:25:35 2003 +0000 3.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h Mon Nov 03 11:19:13 2003 +0000 3.3 @@ -12,6 +12,13 @@ 3.4 3.5 #include "hypervisor-if.h" 3.6 3.7 +/* 3.8 + * Make sure you increment the interface version whenever you modify this file! 3.9 + * This makes sure that old versions of dom0 tools will stop working in a 3.10 + * well-defined way (rather than crashing the machine, for instance). 3.11 + */ 3.12 +#define DOM0_INTERFACE_VERSION 0xAAAA0001 3.13 + 3.14 3.15 /* 3.16 * The following is all CPU context. Note that the i387_ctxt block is filled 3.17 @@ -178,6 +185,7 @@ typedef struct dom0_settime_st 3.18 typedef struct dom0_op_st 3.19 { 3.20 unsigned long cmd; 3.21 + unsigned long interface_version; /* DOM0_INTERFACE_VERSION */ 3.22 union 3.23 { 3.24 dom0_createdomain_t createdomain;
4.1 --- a/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h Mon Nov 03 10:25:35 2003 +0000 4.2 +++ b/xenolinux-2.4.22-sparse/include/asm-xeno/hypervisor.h Mon Nov 03 11:19:13 2003 +0000 4.3 @@ -265,6 +265,7 @@ static inline int HYPERVISOR_exit(void) 4.4 static inline int HYPERVISOR_dom0_op(void *dom0_op) 4.5 { 4.6 int ret; 4.7 + op->interface_version = DOM0_INTERFACE_VERSION; 4.8 __asm__ __volatile__ ( 4.9 TRAP_INSTR 4.10 : "=a" (ret) : "0" (__HYPERVISOR_dom0_op),