[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD
From: |
Roman Bolshakov |
Subject: |
Re: [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD |
Date: |
Wed, 6 Nov 2024 21:01:45 +0700 |
On Tue, Nov 05, 2024 at 04:57:57PM +0100, Phil Dennis-Jordan wrote:
> The handling for CPUID function 0xD (supported XSAVE features) was
> improved in a recent patch. Unfortunately, this appears to have
> introduced undefined behaviour for cases where ecx > 30, as the result
> of (1 << idx) is undefined if idx > 30.
>
> Per Intel SDM section 13.2, the behaviour for ecx values up to and
> including 62 are specified. This change therefore specifically sets
> all registers returned by the CPUID instruction to 0 for 63 and higher.
> Furthermore, the bit shift uses uint64_t, where behaviour for the entire
> range of 2..62 is safe and correct.
>
Thanks for correcting the regression.
Reviewed-by: Roman Bolshakov <rbolshakov@ddn.com>
- [PATCH 0/5] i386/hvf: x2apic support and some small fixes, Phil Dennis-Jordan, 2024/11/05
- [PATCH 1/5] i386/hvf: Integrates x2APIC support with hvf accel, Phil Dennis-Jordan, 2024/11/05
- [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD, Phil Dennis-Jordan, 2024/11/05
- Re: [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD,
Roman Bolshakov <=
- [PATCH 3/5] i386/hvf: Fixes startup memory leak (vmcs caps), Phil Dennis-Jordan, 2024/11/05
- [PATCH 4/5] i386/hvf: Raise exception on error setting APICBASE, Phil Dennis-Jordan, 2024/11/05
- [PATCH 5/5] i386/hvf: Removes duplicate/shadowed variables in hvf_vcpu_exec, Phil Dennis-Jordan, 2024/11/05
- Re: [PATCH 0/5] i386/hvf: x2apic support and some small fixes, Roman Bolshakov, 2024/11/06