Make xentrace hypercall a bit more sane
PATCH 1/1 Make xentrace hypercall a bit more sane
xentrace, setsize and the hypervisor don't seem to be on the same page. If tracing is not enabled, the hypercall will only allow TBUF_SET_SIZE and TBUF_ENABLE. However, set_size calls TBUF_GET_INFO, and xentrace wants to call TBUF_SET_EVT_MASK and TBUF_SET_CPU_MASK before calling TBUF_ENABLE.
I don't see any reason not to call SET_*_MASK and GET_INFO if tracing
is not enabled. If the buffer hasn't been allocated yet, GET_INFO
should just return something invalid in the mfn field. Anyone calling should check this value.
Comments?
-George
xen/common/trace.c +7 -10
@@ -178,21 +178,18 @@ int tb_control(dom0_tbufcontrol_t *tbc)spin_lock (&lock); -if ( !tb_init_done && - (tbc->op !=DOM0_TBUF_SET_SIZE ) && - (tbc->op !=DOM0_TBUF_ENABLE ) ) - { -spin_unlock (&lock); -return -EINVAL ; - } -switch ( tbc->op ) {case DOM0_TBUF_GET_INFO : tbc->cpu_mask = tb_cpu_mask; tbc->evt_mask = tb_event_mask; - tbc->buffer_mfn =__pa (t_bufs[0 ]) >>PAGE_SHIFT ; - tbc->size = opt_tbuf_size *PAGE_SIZE ; +if ( opt_tbuf_size ) { + tbc->buffer_mfn =__pa (t_bufs[0 ]) >>PAGE_SHIFT ; + tbc->size = opt_tbuf_size *PAGE_SIZE ; + }else { + tbc->buffer_mfn = (unsigned long )-1 ; + tbc->size =0 ; + }break ;case DOM0_TBUF_SET_CPU_MASK : tb_cpu_mask = tbc->cpu_mask;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 11 lines · George Dunlap
xentrace, setsize and the hypervisor don't seem to be on the same page. If tracing is not enabled, the hypercall will only allow
TBUF_SET_SIZEandTBUF_ENABLE. However,set_sizecallsTBUF_GET_INFO, and xentrace wants to callTBUF_SET_EVT_MASKandTBUF_SET_CPU_MASKbefore callingTBUF_ENABLE.I don't see any reason not to call SET_*_MASK and
GET_INFOif tracing
is not enabled. If the buffer hasn't been allocated yet,GET_INFO
should just return something invalid in the mfn field. Anyone calling should check this value.
Sounds benign enough. I never liked the behavior of disallowing the get_info call.
Rob