[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <481b6a20-2ccb-4eae-801b-ff95c7ccd09c@intel.com>
Date: Sun, 9 Mar 2025 15:06:19 -0700
From: "Chang S. Bae" <chang.seok.bae@...el.com>
To: Chao Gao <chao.gao@...el.com>
CC: <tglx@...utronix.de>, <dave.hansen@...el.com>, <x86@...nel.org>,
<seanjc@...gle.com>, <pbonzini@...hat.com>, <linux-kernel@...r.kernel.org>,
<kvm@...r.kernel.org>, <peterz@...radead.org>, <rick.p.edgecombe@...el.com>,
<weijiang.yang@...el.com>, <john.allen@....com>, <bp@...en8.de>
Subject: Re: [PATCH v3 04/10] x86/fpu/xstate: Correct guest fpstate size
calculation
On 3/7/2025 6:49 PM, Chao Gao wrote:
> On Fri, Mar 07, 2025 at 01:37:15PM -0800, Chang S. Bae wrote:
>> On 3/7/2025 8:41 AM, Chao Gao wrote:
>>>
>>> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
>>> index 6166a928d3f5..adc34914634e 100644
>>> --- a/arch/x86/kernel/fpu/core.c
>>> +++ b/arch/x86/kernel/fpu/core.c
>>> @@ -218,7 +218,7 @@ bool fpu_alloc_guest_fpstate(struct fpu_guest *gfpu)
>>> struct fpstate *fpstate;
>>> unsigned int size;
>>> - size = fpu_user_cfg.default_size + ALIGN(offsetof(struct fpstate, regs), 64);
>>> + size = fpu_kernel_cfg.default_size + ALIGN(offsetof(struct fpstate, regs), 64);
>>> fpstate = vzalloc(size);
>>> if (!fpstate)
>>> return false;
>>
>> BTW, did you ever base this series on the tip/master branch? The fix has
>> already been merged there:
>>
>> 1937e18cc3cf ("x86/fpu: Fix guest FPU state buffer allocation size")
>
> Thanks for the information. I will remove this patch.
But, I think there is a fallout that someone should follow up:
The merged patch ensures size consistency between
fpu_alloc_guest_fpstate() and fpstate_realloc(), maintaining a
consistent reference to the kernel buffer size. However, within
fpu_alloc_guest_fpstate(), fpu_guest->xfeatures should also be adjusted
accordingly for consistency. Instead of referencing fpu_user_cfg, it
should reference fpu_kernel_cfg.
Thanks,
CHang
Powered by blists - more mailing lists