[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


  • To: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Dmitry Isaykin <isaikin-dmitry@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 13 Mar 2023 17:15:32 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H8ayyE/TOhRdwhKKcF4iK01e8s/A1foQtZEUI6plLkw=; b=mj1UuQfnyJADGq4iEbvUb3Rl8hrP3sMWVWXVMWePdm7lwtuHX/lHtQwW5tJC082auVdkFLmXLeTymcZYDDzEenMBKdWmLPeLwmOXtIBcY/xy0EWtvPz7H6xZ8ib4TM32ALXIMRHt3iA+1y+la36me6dU2IOXKMEn3u6P7kgRIc6wswCAqTLoE3cPKWzDKxTOwLImWC+JiWGTEFvBP3HXzyHeYOHvzNNmVgREJ6nG97K8gmPGLzvE8Tzibf91bskQbtPBt+wICDWmlAKkbiryvH/kaEjEuz/abJpGJY+pif2axBR1fj7Fc2HKuyG9jEHUhPodTSojUgzMBtf2NmKs5Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DaZqK2pvmHDUUTVH2oRib8F2qtzU2Gu0IrhGLzCna3LAZIQ4K1kJmfFtuwIbBYFEwYSTy8osHd5ikV1vlrN5clyBZAMd8d89q3vIm51vGliLXfSLRrIzoO2lWLAJAqBZgr99Wif0lddq6X43W1nQmiAlKje1AeQkUwyISXpRK7w2pDdvSwbJPr0VLXjGOQNL6FIoCU4xWaS4NGPrq+EqrFNmwxO8NgNiQeHbRzoCmxF/rtLWzjyxcoG3C8eqv+s4X7t06ljNh+LXjvLHSnnHg/FZmn34XtYx9cf4FG5Ektrc+GK02S4t3iFMkX8icNPOjy42ww13/tG8ug86Ac4InQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx>, Petre Pircalabu <ppircalabu@xxxxxxxxxxxxxxx>, Jun Nakajima <jun.nakajima@xxxxxxxxx>, Kevin Tian <kevin.tian@xxxxxxxxx>, Anton Belousov <abelousov@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 13 Mar 2023 16:16:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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).

>> +            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.

Jan



 


Rackspace

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