Re: [PATCH] x86/tdx: Handle load_unaligned_zeropad() page-cross to a shared page

From: Dave Hansen
Date: Thu May 19 2022 - 14:35:43 EST


On 5/19/22 11:19, Kirill A. Shutemov wrote:
>>>> The SDM has a breakdown:
>>>>
>>>> 27.2.5 Information for VM Exits Due to Instruction Execution
>>>>
>>>> I didn't realize it came from VMREAD. I guess I assumed it came from
>>>> some TDX module magic. Silly me.
>>>>
>>>> The SDM makes it sound like we should be more judicious about using
>>>> 've->instr_len' though. "All VM exits other than those listed in the
>>>> above items leave this field undefined." Looking over
>>>> virt_exception_kernel(), we've got five cases from CPU instructions that
>>>> cause unconditional VMEXITs:
>> Ideally, what the SDM says wouldn't matter at all. The TDX module spec really
>> should be the authorative source in this case, but it just punts to the SDM:
>>
>> The 32-bit value that would have been saved into the VMCS as VM-exit instruction
>> length if a legacy VM exit had occurred instead of the virtualization exception.
>>
>> Even if the TDX spec wants to punt to the SDM, it would save a lot of headache and
>> SDM reading if it also said something to the effect of:
>>
>> The INSTRUCTION_LENGTH and INSTRUCTION_INFORMATION fields are valid for all
>> #VEs injected by the Intel TDX Module. The fields are undefined for #VEs
>> injected by the CPU due to EPT Violations.
> I initiated update to the spec, but it will take time.

Understood, and thanks for doing that.

For now, let's just declare what we *expect* the spec will say and show
it to the folks doing the spec itself. They will then have a chance to
balk at our interpretation if we got something wrong.