[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <176055123341.1529540.17733052766097672792.b4-ty@google.com>
Date: Wed, 15 Oct 2025 11:02:56 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Sean Christopherson <seanjc@...gle.com>, Paolo Bonzini <pbonzini@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, "Kirill A. Shutemov" <kas@...nel.org>,
Rick Edgecombe <rick.p.edgecombe@...el.com>, Thorsten Blum <thorsten.blum@...ux.dev>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-coco@...ts.linux.dev
Subject: Re: [PATCH] KVM: TDX: Replace kmalloc + copy_from_user with
memdup_user in tdx_td_init
On Tue, 16 Sep 2025 23:31:29 +0200, Thorsten Blum wrote:
> Use get_user() to retrieve the number of entries instead of allocating
> memory for 'init_vm' with the maximum size, copying 'cmd->data' to it,
> only to then read the actual entry count 'cpuid.nent' from the copy.
>
> Return -E2BIG early if 'nr_user_entries' exceeds KVM_MAX_CPUID_ENTRIES.
>
> Use memdup_user() to allocate just enough memory to fit all entries and
> to copy 'cmd->data' from userspace. Use struct_size() instead of
> manually calculating the number of bytes to allocate and copy.
>
> [...]
Applied to kvm-x86 vmx, with the aforementioned tweaks. Thanks!
[1/1] KVM: TDX: Replace kmalloc + copy_from_user with memdup_user in tdx_td_init
https://github.com/kvm-x86/linux/commit/0bd0a4a1428b
--
https://github.com/kvm-x86/linux/tree/next
Powered by blists - more mailing lists