On 11/12/2024 4:13 AM, Melody (Huibo) Wang wrote: > Hi Neeraj, > > On 9/13/2024 4:36 AM, Neeraj Upadhyay wrote: > >> +static void init_backing_page(void *backing_page) >> +{ >> + u32 val; >> + int i; >> + >> + val = read_msr_from_hv(APIC_LVR); >> + set_reg(backing_page, APIC_LVR, val); >> + > > When you read the register from hypervisor, there is certain value defined in APM Table 16-2. APIC Registers, says APIC_LVR has value 80??0010h out of reset. > > More specifically, Bit 31 is set which means the presence of extended APIC registers, and Bit 4 is set which is part of version number: "The local APIC implementation is identified with a value=1Xh (20h-FFh are > reserved)". > > I think you should verify those values instead of just reading from the hypervisor. Also, I think you probably should verify all of registers you read from the hypervisor before you use them in the guest. In other words, sanitize the inputs from the hypervisor. > Ok, I will add this verification of hv read data (wherever applicable) as incremental patches. - Neeraj > Thanks, > Melody