From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9JmM-0007lZ-DD for qemu-devel@nongnu.org; Wed, 16 Dec 2015 16:38:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9JmH-0007rL-AN for qemu-devel@nongnu.org; Wed, 16 Dec 2015 16:38:34 -0500 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:34339) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9JmH-0007rF-3e for qemu-devel@nongnu.org; Wed, 16 Dec 2015 16:38:29 -0500 Received: by mail-wm0-x232.google.com with SMTP id l126so59245243wml.1 for ; Wed, 16 Dec 2015 13:38:28 -0800 (PST) Sender: Paolo Bonzini References: <1450292806-30598-1-git-send-email-ehabkost@redhat.com> From: Paolo Bonzini Message-ID: <5671D9D1.5050907@redhat.com> Date: Wed, 16 Dec 2015 22:38:25 +0100 MIME-Version: 1.0 In-Reply-To: <1450292806-30598-1-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/5] target-i386: kvm: Increase MSR entry array limits, check for array overrun List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , Marcelo Tosatti Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org On 16/12/2015 20:06, Eduardo Habkost wrote: > We are dangerously close to the array limits in kvm_put_msrs() > and kvm_get_msrs(): with the default mcg_cap configuration, we > can set up to 148 MSRs in kvm_put_msrs(), and if we allow mcg_cap > to be changed, we can write up to 236 MSRs[1]. > > This series changes the code to allocate a buffer once per VCPU, > increase buffer size to 4096 bytes (that can hold up to 255 MSR > entries), and check array limits before appending new entries. Thanks, it's a good improvement. Reviewed-by: Paolo Bonzini > [1] I have checked the limits by copying and pasting the > kvm_put_msrs() code to a new file, replacing the "if" lines, > copying the macro definitions, and adding a helper macro to > keep track of the kvm_msr_entry_set() calls. The code can be > seen at: > https://gist.github.com/ehabkost/08d4177a33b8648a71ef > > Eduardo Habkost (5): > target-i386: kvm: Allocate kvm_msrs struct once per VCPU > target-i386: kvm: Increase MSR_BUF_SIZE > target-i386: kvm: Simplify MSR array construction > target-i386: kvm: Simplify MSR setting functions > target-i386: kvm: Eliminate kvm_msr_entry_set() > > target-i386/cpu-qom.h | 4 + > target-i386/kvm.c | 322 +++++++++++++++++++++++--------------------------- > 2 files changed, 149 insertions(+), 177 deletions(-) >