lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4753C59A.4030206@qumranet.com>
Date:	Mon, 03 Dec 2007 11:00:10 +0200
From:	Avi Kivity <avi@...ranet.com>
To:	Amit Shah <amit.shah@...ranet.com>
CC:	kvm-devel@...ts.sourceforge.net,
	Anthony Liguori <aliguori@...ibm.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [kvm-devel] [PATCH] Refactor hypercall infrastructure (v2)

Amit Shah wrote:
> * Anthony Liguori wrote:
>   
>> Amit Shah wrote:
>>     
>>> * Anthony Liguori wrote:
>>>  
>>>
>>>       
>>>> This patch refactors the current hypercall infrastructure to better
>>>> support live migration and SMP.  It eliminates the hypercall page by
>>>> trapping the UD exception that would occur if you used the wrong
>>>> hypercall instruction for the underlying architecture and replacing it
>>>> with the right one lazily. 
>>>>         
>>> This doesn't work right for SVM. It keeps looping indefinitely; on a
>>> kvm_stat run, I get about 230,000 light vm exits per second, with the
>>> hypercall never returning to the guest.
>>>
>>> ...
>>>  
>>>       
>> What are you using to issue the hypercall?
>>     
>
> +       r = kvm_hypercall1(KVM_PV_PCI_DEVICE, page_gfn);
>
> Setup is done by:
>
> +       if (!kvm_para_available()) {
> +               printk(KERN_ERR "KVM paravirt support not available\n");
> +               r = -ENODEV;
> +               goto out_dereg;
> +       }
>   

There was a bug where instructions with a modrm byte specifying a 
register would try to access memory.  In the memory was not mapped,  
emulation would fail. vmcall is one such instruction.  This was fixed by

commit f83562246921d6a8a7de8b76853a6835ace3699d
Author: Aurelien Jarno <aurelien@...el32.net>
Date:   Wed Oct 17 19:30:41 2007 +0200

    KVM: x86 emulator: fix access registers for instructions with ModR/M 
byte and Mod = 3

    The patch belows changes the access type to register from memory for
    instructions that are declared as SrcMem or DstMem, but have a
    ModR/M byte with Mod = 3.

    It fixes (at least) the lmsw and smsw instructions on an AMD64 CPU,
    which are needed for FreeBSD.

    Signed-off-by: Aurelien Jarno <aurelien@...el32.net>
    Signed-off-by: Avi Kivity <avi@...ranet.com>

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 7c95ae5..8c50496 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -835,6 +835,14 @@ modrm_done:
                if (c->twobyte && c->b == 0x01
                                    && c->modrm_reg == 7)
                        break;
+               /*
+                * For instructions with a ModR/M byte, switch to register
+                * access if Mod = 3.
+                */
+               if ((c->d & ModRM) && c->modrm_mod == 3) {
+                       c->src.type = OP_REG;
+                       break;
+               }
 srcmem_common:
                c->src.type = OP_MEM;
                break;
@@ -897,7 +905,14 @@ srcmem_common:
                }
                break;
        case DstMem:
-               c->dst.type = OP_MEM;
+               /*
+                * For instructions with a ModR/M byte, switch to register
+                * access if Mod = 3.
+                */
+               if ((c->d & ModRM) && c->modrm_mod == 3)
+                       c->dst.type = OP_REG;
+               else
+                       c->dst.type = OP_MEM;
                break;
        }




-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ