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: <20120312163916.66bfd660.yoshikawa.takuya@oss.ntt.co.jp>
Date:	Mon, 12 Mar 2012 16:39:16 +0900
From:	Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>
To:	Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>
Cc:	avi@...hat.com, mtosatti@...hat.com, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] KVM: MMU: Split the main body of
 rmap_write_protect() off from others

Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp> wrote:

> -int kvm_mmu_rmap_write_protect(struct kvm *kvm, u64 gfn,
> -			       struct kvm_memory_slot *slot)
> +static int __rmap_write_protect(struct kvm *kvm, unsigned long *rmapp, int level)
>  {
> -	unsigned long *rmapp;
> -	u64 *spte;
> -	int i, write_protected = 0;
> +	u64 *spte = NULL;
> +	int write_protected = 0;
>  
> -	rmapp = __gfn_to_rmap(gfn, PT_PAGE_TABLE_LEVEL, slot);
> -	spte = rmap_next(rmapp, NULL);
> -	while (spte) {
> +	while ((spte = rmap_next(rmapp, spte))) {
>  		BUG_ON(!(*spte & PT_PRESENT_MASK));
>  		rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
> -		if (is_writable_pte(*spte)) {
> +
> +		if (!is_writable_pte(*spte))
> +			continue;
> +
> +		if (level == PT_PAGE_TABLE_LEVEL) {
>  			mmu_spte_update(spte, *spte & ~PT_WRITABLE_MASK);
> -			write_protected = 1;
> +		} else {
> +			BUG_ON(!is_large_pte(*spte));
> +			drop_spte(kvm, spte);
> +			--kvm->stat.lpages;
> +			spte = NULL;
>  		}
> -		spte = rmap_next(rmapp, spte);
> +
> +		write_protected = 1;
>  	}

Something may change here: when level > PT_PAGE_TABLE_LEVEL, this loop
does not handle lower level mappings after dropping large-ptes.

This may be incorrect.

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