Re: [PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD

2024-11-06 Thread Roman Bolshakov
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 unde

[PATCH 2/5] i386/hvf: Fix for UB in handling CPUID function 0xD

2024-11-05 Thread Phil Dennis-Jordan
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