public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	qemu-devel@nongnu.org, Stefan Weil <sw@weilnetz.de>
Subject: Re: [PATCH] i386/tdx: Fix the UAF issue in tdx_fetch_cpuid()
Date: Tue, 24 Mar 2026 13:47:47 +0800	[thread overview]
Message-ID: <0991e811-0ad3-4d96-9a4b-deee9c77ef20@intel.com> (raw)
In-Reply-To: <186c9ed2-5e41-42d5-8d07-f90654cf35a9@linaro.org>

On 3/24/2026 1:35 PM, Philippe Mathieu-Daudé wrote:
> On 24/3/26 02:23, Xiaoyao Li wrote:
>> Fix the UAF issue by reading the returned size before freeing the
>> fetch_cpuid structure.
>>
>> Link: https://lore.kernel.org/ 
>> r/758d7f2c-938f-49cb-89fc-980fc8e020b2@weilnetz.de
> 
> Fixes: e3d1a4a6d1d ("i386/tdx: Fetch and validate CPUID of TD guest")

Oh, I missed this.

Thanks for providing it!

>> Reported-by: Stefan Weil <sw@weilnetz.de>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>>   target/i386/kvm/tdx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
>> index 4cae99c281ac..e578110df4da 100644
>> --- a/target/i386/kvm/tdx.c
>> +++ b/target/i386/kvm/tdx.c
>> @@ -847,8 +847,8 @@ static struct kvm_cpuid2 *tdx_fetch_cpuid(CPUState 
>> *cpu, int *ret)
>>           fetch_cpuid->nent = size;
>>           r = tdx_vcpu_ioctl(cpu, KVM_TDX_GET_CPUID, 0, fetch_cpuid, 
>> &local_err);
>>           if (r == -E2BIG) {
>> -            g_free(fetch_cpuid);
>>               size = fetch_cpuid->nent;
>> +            g_free(fetch_cpuid);
>>           }
>>       } while (r == -E2BIG);
> 



      reply	other threads:[~2026-03-24  5:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  1:23 [PATCH] i386/tdx: Fix the UAF issue in tdx_fetch_cpuid() Xiaoyao Li
2026-03-24  5:35 ` Philippe Mathieu-Daudé
2026-03-24  5:47   ` Xiaoyao Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0991e811-0ad3-4d96-9a4b-deee9c77ef20@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox