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] [day] [month] [year] [list]
Date:   Fri, 18 Nov 2022 17:21:02 +0000
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        dmatlack@...gle.com
Subject: Re: [PATCH v2] KVM: x86: avoid memslot check in NX hugepage recovery
 if it cannot succeed

On Fri, Nov 18, 2022, Paolo Bonzini wrote:
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 43bbe4fde078..5d85f1a61793 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1603,6 +1603,8 @@ static int kvm_prepare_memory_region(struct kvm *kvm,
>  				     struct kvm_memory_slot *new,
>  				     enum kvm_mr_change change)
>  {
> +	int old_flags = old ? old->flags : 0;
> +	int new_flags = new ? new->flags : 0;
>  	int r;
>  
>  	/*
> @@ -1627,6 +1629,11 @@ static int kvm_prepare_memory_region(struct kvm *kvm,
>  		}
>  	}
>  
> +	if ((old_flags ^ new_flags) & KVM_MEM_LOG_DIRTY_PAGES) {
> +		int change = (new_flags & KVM_MEM_LOG_DIRTY_PAGES) ? 1 : -1;
> +		atomic_set(&kvm->nr_memslots_dirty_logging,
> +			   atomic_read(&kvm->nr_memslots_dirty_logging) + change);

Again, this needs to be done in the "commit" stage, and IMO should be x86-only.

https://lore.kernel.org/all/Y3bTu4%2FnUfpX+Enm@google.com

> +	}
>  	r = kvm_arch_prepare_memory_region(kvm, old, new, change);
>  
>  	/* Free the bitmap on failure if it was allocated above. */
> -- 
> 2.31.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ