[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] x86/monitor: Add new monitor event to catch I/O instructions



 
 
13.03.2023, 19:15, "Jan Beulich" <jbeulich@xxxxxxxx>:

On 11.03.2023 15:50, Tamas K Lengyel wrote:

 On Fri, Mar 10, 2023 at 10:57 PM Dmitry Isaykin <isaikin-dmitry@xxxxxxxxx>
 --- a/xen/arch/x86/hvm/vmx/vmx.c
 +++ b/xen/arch/x86/hvm/vmx/vmx.c
 @@ -4579,6 +4579,8 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
              uint16_t port = (exit_qualification >> 16) & 0xFFFF;
              int bytes = (exit_qualification & 0x07) + 1;
              int dir = (exit_qualification & 0x08) ? IOREQ_READ :
 IOREQ_WRITE;
 + int str_ins = (exit_qualification & 0x10) ? 1 : 0;
 
 You are already in a branch here where str_ins is checked and known to be 1.


0 that is, i.e. only non-string insns would presently be reported.

Dmitry, you also want to make this variable and the corresponding function
parameters "bool". Unless of course they need changing anyway to e.g.
communicate the address of the data (as also indicated by Andrew).

OK.

 

 + hvm_io_instruction_intercept(port, dir, bytes, str_ins);
 
 IMHO you should have this intercept be called outside the if-else. The
 function already kind-of indicates str_ins is an input yet right now only
 called when it's 1.


I agree. Question is, as above, what further data may need supplying to
the monitor agent to make the intercept useful. Merely %rsi / %rdi as
Andrew suggested may not suffice, as especially outside of 64-bit mode
the involved segment base may be non-zero.

I think that in synchronous mode all necessary register information is already available.


Jan


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.