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  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:   Tue, 12 Jan 2021 11:20:56 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Kunkun Jiang <jiangkunkun@...wei.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     wanghaibin.wang@...wei.com, Keqian Zhu <zhukeqian1@...wei.com>
Subject: Re: [PATCH] kvm: Fixes lack of KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
 enabled check

On 12/01/21 10:29, Kunkun Jiang wrote:
> The KVM_CLEAR_DIRTY_LOG ioctl lacks the check whether the capability
> KVM_CAP_MANUAL_DIRTY_LOG_PROTECT is enabled or not. This may cause
> some problems if userspace calls the KVM_CLEAR_DIRTY_LOG ioctl, but
> dose't enable this capability. So we'd better to add it.
> 
> Fixes: 2a31b9db15353 ("kvm: introduce manual dirty log reprotect")
> Signed-off-by: Kunkun Jiang <jiangkunkun@...wei.com>
> ---
>   virt/kvm/kvm_main.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index fa9e3614d30e..8f5633d8a0e8 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1602,6 +1602,9 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
>   	unsigned long *dirty_bitmap_buffer;
>   	bool flush;
>   
> +	if (!kvm->manual_dirty_log_protect)
> +		return -EPERM;
> +
>   	/* Dirty ring tracking is exclusive to dirty log tracking */
>   	if (kvm->dirty_ring_size)
>   		return -ENXIO;

This is not a problem, KVM_CLEAR_DIRTY_LOG can always be used even if 
KVM_CAP_MANUAL_DIRTY_LOG_PROTECT was not enabled.  The meaning is the 
same: clear the bits without returning them.

Paolo

Powered by blists - more mailing lists