From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [RFC PATCH] kvm: x86/vmx: Use kzalloc for cached_vmcs12 Date: Thu, 24 Jan 2019 02:18:26 +0100 Message-ID: <7abea144-772d-bb3a-bd7d-a9117305c2fb@redhat.com> References: <6f79d9be-fa76-3a06-2612-f44f3a18ece7@redhat.com> <20190114234728.49239-1-tmroeder@google.com> <20190115024304.GD5141@linux.intel.com> <20190115175111.GB68985@google.com> <20190123183322.GB160275@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Liran Alon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+ded1696f6b50b615b630@syzkaller.appspotmail.com To: Tom Roeder , Sean Christopherson Return-path: In-Reply-To: <20190123183322.GB160275@google.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 23/01/19 19:33, Tom Roeder wrote: > > Even in vmx_set_nested_state, there are about 30 lines of code in > between enter_vmx_operation and copy_from_user, and there are a couple > of cases that cause vmx_set_nested_state to return with an error. So if > we want to fix this by handling all the error paths, I think it might be > cleanest to convert vmx_set_nested_state to use goto error handling, > since that would allow us to clear the allocated memory in one place. I prefer to have kzalloc, and change vmx_get_nested_state to copy the whole page including the trailing zeroes. Paolo