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: <20100716231855.GA8946@amt.cnet>
Date:	Fri, 16 Jul 2010 20:18:55 -0300
From:	Marcelo Tosatti <mtosatti@...hat.com>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	LKML <linux-kernel@...r.kernel.org>, kvm@...r.kernel.org,
	Avi Kivity <avi@...hat.com>
Subject: Re: [PATCH 4/6] kvm: add host_writable parameter

On Fri, Jul 16, 2010 at 10:13:04AM +0800, Lai Jiangshan wrote:
> add host_writable parameter for some functions,
> no functionality changed, prepare for using RO pages.
> 
> 
> Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
> ---
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 0867ced..8ba9b0d 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -1861,7 +1861,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
>  		    unsigned pte_access, int user_fault,
>  		    int write_fault, int dirty, int level,
>  		    gfn_t gfn, pfn_t pfn, bool speculative,
> -		    bool can_unsync, bool reset_host_protection)
> +		    bool can_unsync, bool host_writable)
>  {
>  	u64 spte;
>  	int ret = 0;
> @@ -1888,8 +1888,10 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
>  		spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn,
>  			kvm_is_mmio_pfn(pfn));
>  
> -	if (reset_host_protection)
> +	if (host_writable)
>  		spte |= SPTE_HOST_WRITEABLE;
> +	else
> +		pte_access &= ~ACC_WRITE_MASK;

Two vcpus faulting the same address with different access type can 
now race:

vcpu0                               vcpu1

read fault                          write fault
gfn_to_pfn readonly
                                    gfn_to_pfn write, break COW
                                    set writable spte to COWed page
                                    vcpu writes to page
set spte to original page
vcpu reads stale content

Should not instantiate a new spte if (pfn != spte_to_pfn(*sptep)), to
cause a refault.

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