Re: [PATCH v4 2/6] x86/tdx: Add validation of userspace MMIO instructions
From: Kirill A. Shutemov
Date: Thu Aug 22 2024 - 03:23:01 EST
On Wed, Aug 21, 2024 at 04:24:34PM +0200, Alexey Gladkov wrote:
> From: "Alexey Gladkov (Intel)" <legion@xxxxxxxxxx>
>
> Instructions from kernel space are considered trusted. If the MMIO
> instruction is from userspace it must be checked.
>
> For userspace instructions, it is need to check that the INSN has not
> changed at the time of #VE and before the execution of the instruction.
>
> Once the userspace instruction parsed is enforced that the address
> points to mapped memory of current process and that address does not
> point to private memory.
>
> After parsing the userspace instruction, it is necessary to ensure that:
>
> 1. the operation direction (read/write) corresponds to #VE info;
> 2. the address still points to mapped memory of current process;
> 3. the address does not point to private memory.
>
> Signed-off-by: Alexey Gladkov (Intel) <legion@xxxxxxxxxx>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
--
Kiryl Shutsemau / Kirill A. Shutemov