From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v4 0/4] KVM: enable Intel SMAP for KVM Date: Thu, 03 Apr 2014 18:46:06 +0200 Message-ID: <533D904E.30801@redhat.com> References: <1396345596-25682-1-git-send-email-feng.wu@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: Feng Wu , gleb@redhat.com, hpa@zytor.com, kvm@vger.kernel.org Return-path: Received: from mail-wg0-f49.google.com ([74.125.82.49]:49667 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbaDCQqM (ORCPT ); Thu, 3 Apr 2014 12:46:12 -0400 Received: by mail-wg0-f49.google.com with SMTP id a1so2158314wgh.8 for ; Thu, 03 Apr 2014 09:46:11 -0700 (PDT) In-Reply-To: <1396345596-25682-1-git-send-email-feng.wu@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Il 01/04/2014 11:46, Feng Wu ha scritto: > Feng Wu (4): > KVM: Remove SMAP bit from CR4_RESERVED_BITS. > KVM: Add SMAP support when setting CR4 > KVM: Disable SMAP for guests in EPT realmode and EPT unpaging mode > KVM: expose SMAP feature to guest > Hi, I prepared some testcases. You can find them in branch "smap" of git://git.kernel.org/pub/scm/virt/kvm/kvm-unit-tests.git To compile them for 32-bits: git clean -xdf ./configure --arch=i386 make ./x86-run x86/smap.flat -cpu host For 64-bits: git clean -xdf ./configure make ./x86-run x86/smap.flat -cpu host I tried them with QEMU and they all pass. The output should be something like this: enabling apic paging enabled cr0 = 80010011 cr3 = 7fff000 cr4 = 10 testing without INVLPG PASS: write to supervisor page PASS: read from user page with AC=1 PASS: read from user page with AC=0 PASS: write to user page with AC=1 PASS: read from user page with AC=0 PASS: write to user stack with AC=1 PASS: write to user stack with AC=0 PASS: executing on user page with AC=0 testing with INVLPG PASS: write to supervisor page PASS: read from user page with AC=1 PASS: read from user page with AC=0 PASS: write to user page with AC=1 PASS: read from user page with AC=0 PASS: write to user stack with AC=1 PASS: write to user stack with AC=0 PASS: executing on user page with AC=0 SUMMARY: 16 tests, 0 failures Please test them (both 32- and 64-bits) with both ept=1 and ept=0. If the tests pass, the series is okay. The only part that is not covered is the implicit kernel accesses at CPL=3, which QEMU doesn't implement that (I fixed it, but didn't have time to think about tests). Since I'm going on vacation next week, I wanted to throw this out today. I'll post the test patches when I'm back. Paolo