xentrace: fix bug in t_info size
PATCH 1/1 xentrace: fix bug in t_info size
t_info size should be in bytes, not pages. This fixes a bug that crashes the hypervisor if the total number of all pages is more than 1024 but less than 2048.
xen/common/trace.c +1 -1
@@ -340,7 +340,7 @@case XEN_SYSCTL_TBUFOP_get_info: tbc->evt_mask = tb_event_mask; tbc->buffer_mfn = t_info ?virt_to_mfn (t_info) :0 ; - tbc->size =T_INFO_PAGES ; + tbc->size =T_INFO_PAGES *PAGE_SIZE ;break ;case XEN_SYSCTL_TBUFOP_set_cpu_mask:xenctl_cpumap_to_cpumask (&tb_cpu_mask, &tbc->cpu_mask);
Quoted 4 lines · George Dunlap
t_infosize should be in bytes, not pages. This fixes a bug that crashes the hypervisor if the total number of all pages is more than 1024 but less than 2048.
Could this be causing other memory corruption too?
J
Quoted 21 lines
Signed-off-by George Dunlap <[email protected]>diff -r
caea94988515-re633befe28ecxen/common/trace.cxen/common/trace.c +1
-1@@ -340,7 +340,7 @@case XEN_SYSCTL_TBUFOP_get_info: tbc->evt_mask = tb_event_mask; tbc->buffer_mfn = t_info ?virt_to_mfn (t_info) :0 ; - tbc->size =T_INFO_PAGES ; + tbc->size =T_INFO_PAGES *PAGE_SIZE ;break ;case XEN_SYSCTL_TBUFOP_set_cpu_mask:xenctl_cpumap_to_cpumask (&tb_cpu_mask, &tbc->cpu_mask);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
I don't think so... The entire xen structure actually is allocated, and the bounds checking makes sure nothing goes off the end of it. It's just that (before this patch) xentrace only maps one of the two pages when it maps t_info. It then happily passes who knows what into xc_map_foreign_range().
Arguably, passing junk into xc_map_foreign_range() shouldn't crash Xen; but that's a slightly different issue.
-George
Quoted 37 lines · Jeremy Fitzhardinge
Quoted 5 lines · George Dunlap
t_infosize should be in bytes, not pages. This fixes a bug that crashes the hypervisor if the total number of all pages is more than 1024 but less than 2048.Could this be causing other memory corruption too?
J
Quoted 22 lines
Signed-off-by George Dunlap <[email protected]>diff -r
caea94988515-re633befe28ecxen/common/trace.cxen/common/trace.c +1
-1@@ -340,7 +340,7 @@case XEN_SYSCTL_TBUFOP_get_info: tbc->evt_mask = tb_event_mask; tbc->buffer_mfn = t_info ?virt_to_mfn (t_info) :0 ; - tbc->size =T_INFO_PAGES ; + tbc->size =T_INFO_PAGES *PAGE_SIZE ;break ;case XEN_SYSCTL_TBUFOP_set_cpu_mask:xenctl_cpumap_to_cpumask (&tb_cpu_mask, &tbc->cpu_mask);_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel