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]
Date:	Sun, 11 Jul 2010 15:52:32 +0300
From:	Avi Kivity <avi@...hat.com>
To:	Xiao Guangrong <xiaoguangrong@...fujitsu.com>
CC:	Marcelo Tosatti <mtosatti@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	KVM list <kvm@...r.kernel.org>
Subject: Re: [PATCH v5 2/9] KVM: MMU: fix race between 'walk_addr' and 'fetch'

On 07/06/2010 01:45 PM, Xiao Guangrong wrote:
> 'walk_addr' is out of mmu_lock's protection, so while we handle 'fetch',
> then guest's mapping has modifited by other vcpu's write path, such as
> invlpg, pte_write and other fetch path
>
> Fixed by checking all level's mapping
>
>
> @@ -319,22 +319,23 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
>   		direct_access&= ~ACC_WRITE_MASK;
>
>   	for_each_shadow_entry(vcpu, addr, iterator) {
> +		bool nonpresent = false, last_mapping = false;
> +
>    

I don't like these two new variables, but no suggestion at the moment.  
I'll try to simplify this loop later.

One idea may be:

    while (level > walker.level) {
          handle indirect pages
    }
    while (level > hlevel) {
          handle direct pages
    }
    handle last spte

I'm worried that this change is too big for backporting, but no 
suggestions on how to make it smaller, so we'll have to accept it.

> -		spte = __pa(sp->spt)
> -			| PT_PRESENT_MASK | PT_ACCESSED_MASK
> -			| PT_WRITABLE_MASK | PT_USER_MASK;
> -		*sptep = spte;
> +		if (nonpresent) {
> +			spte = __pa(sp->spt)
> +				| PT_PRESENT_MASK | PT_ACCESSED_MASK
> +				| PT_WRITABLE_MASK | PT_USER_MASK;
> +			*sptep = spte;
> +			continue;
> +		}
>    

Should be __set_spte(), but this already exists, so can be in a later patch.

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