Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-06-12 Thread Luis Henriques
On Mon, Jun 08, 2015 at 10:14:49PM -0700, Vinson Lee wrote: > On Tue, May 26, 2015 at 7:53 PM, Xiao Guangrong > wrote: > > > > > > On 05/26/2015 10:48 PM, Paolo Bonzini wrote: > >> > >> > >> > >> On 26/05/2015 16:45, Edward Cree wrote: > > > > This breaks older compilers that can't initial

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-06-10 Thread Andrew Morton
On Wed, 10 Jun 2015 11:02:46 -0700 Davidlohr Bueso wrote: > On Wed, 2015-05-27 at 10:53 +0800, Xiao Guangrong wrote: > > > > On 05/26/2015 10:48 PM, Paolo Bonzini wrote: > > > > > > > > > On 26/05/2015 16:45, Edward Cree wrote: > > This breaks older compilers that can't initialize anon stru

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-06-10 Thread Davidlohr Bueso
On Wed, 2015-05-27 at 10:53 +0800, Xiao Guangrong wrote: > > On 05/26/2015 10:48 PM, Paolo Bonzini wrote: > > > > > > On 26/05/2015 16:45, Edward Cree wrote: > This breaks older compilers that can't initialize anon structures. > > How old ? Even gcc 3.1 says you can use unnamed stru

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-06-08 Thread Vinson Lee
On Tue, May 26, 2015 at 7:53 PM, Xiao Guangrong wrote: > > > On 05/26/2015 10:48 PM, Paolo Bonzini wrote: >> >> >> >> On 26/05/2015 16:45, Edward Cree wrote: > > This breaks older compilers that can't initialize anon structures. > > How old ? Even gcc 3.1 says you can use unnamed s

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-26 Thread Xiao Guangrong
On 05/26/2015 10:48 PM, Paolo Bonzini wrote: On 26/05/2015 16:45, Edward Cree wrote: This breaks older compilers that can't initialize anon structures. How old ? Even gcc 3.1 says you can use unnamed struct/union fields and 3.2 is the minimum version required to compile the kernel as mentio

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-26 Thread Paolo Bonzini
On 26/05/2015 16:45, Edward Cree wrote: >>> This breaks older compilers that can't initialize anon structures. >> > >> > How old ? Even gcc 3.1 says you can use unnamed struct/union fields and >> > 3.2 is the minimum version required to compile the kernel as mentioned >> > in the README. >> > >>

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-26 Thread Edward Cree
>> This breaks older compilers that can't initialize anon structures. > > How old ? Even gcc 3.1 says you can use unnamed struct/union fields and > 3.2 is the minimum version required to compile the kernel as mentioned > in the README. > > We could simply just name the structure, but I doubt this

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Boris Ostrovsky
On 05/22/2015 07:54 PM, Bandan Das wrote: Boris Ostrovsky writes: On 05/11/2015 10:55 AM, Xiao Guangrong wrote: KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is enabled so that kernel is allowe

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Bandan Das
Boris Ostrovsky writes: > On 05/11/2015 10:55 AM, Xiao Guangrong wrote: >> KVM may turn a user page to a kernel page when kernel writes a readonly >> user page if CR0.WP = 1. This shadow page entry will be reused after >> SMAP is enabled so that kernel is allowed to access this user page >> >> Fi

Re: [PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-22 Thread Boris Ostrovsky
On 05/11/2015 10:55 AM, Xiao Guangrong wrote: KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is enabled so that kernel is allowed to access this user page Fix it by setting SMAP && !CR0.WP into sha

[PATCH 1/2] KVM: MMU: fix SMAP virtualization

2015-05-11 Thread Xiao Guangrong
KVM may turn a user page to a kernel page when kernel writes a readonly user page if CR0.WP = 1. This shadow page entry will be reused after SMAP is enabled so that kernel is allowed to access this user page Fix it by setting SMAP && !CR0.WP into shadow page's role and reset mmu once CR4.SMAP is u