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]
Message-ID: <20230410183845.98304-1-itazur@amazon.com>
Date:   Mon, 10 Apr 2023 19:38:45 +0100
From:   Takahiro Itazuri <itazur@...zon.com>
To:     <seanjc@...gle.com>
CC:     <kvm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <pbonzini@...hat.com>, <zulinx86@...il.com>
Subject: Re: [PATCH] kvm: x86: Update KVM_GET_CPUID2 to return valid entry count

Date:   Mon, 10 Apr 2023 08:47:05 -0700
From:   Sean Christopherson <seanjc@...gle.com>
> Capitalize KVM please, i.e. "KVM: x86:".

Will fix. Thanks!

> I think we should break from the (IMO) somewhat funky KVM ioctl() pattern of
> 
> 	r = <errno>
> 	if (try something and it fails)
> 		goto out;
> 
> and instead set "r" in the error paths.  That avoids the need for a scratch "nent",
> and IMO makes this much more straightforward.
> 
> 	int r = 0;
> 
> 	if (cpuid->nent < vcpu->arch.cpuid_nent)
> 		r = -E2BIG;
> 	else if (copy_to_user(entries, vcpu->arch.cpuid_entries,
> 			      vcpu->arch.cpuid_nent * sizeof(struct kvm_cpuid_entry2)))
> 		r = -EFAULT;
> 
> 	/*
> 	 * Update "nent" even on failure, e.g. so that userspace can fix an
> 	 * -E2BIG issue by allocating a larger array.
> 	 */
> 	cpuid->nent = vcpu->arch.cpuid_nent;
> 	return r;

Looks better to me! Will fix this too!.

Best regards,
Takahiro Itazuri

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ