Re: [PATCH v8 4/4] virt: sev-guest: interpret VMM errors from guest request

From: Peter Gonda
Date: Fri Nov 04 2022 - 21:34:26 EST


On Fri, Nov 4, 2022 at 5:01 PM Dionna Glaze <dionnaglaze@xxxxxxxxxx> wrote:
>
> The GHCB specification states that the upper 32 bits of exitinfo2 are
> for the VMM's error codes. The sev-guest ABI has already locked in
> that the fw_err status of the input will be 64 bits, and that
> BIT_ULL(32) means that the extended guest request's data buffer was too
> small, so we have to keep that ABI.
>
> We can still interpret the upper 32 bits of exitinfo2 for the user
> anyway in case the request gets throttled. For safety, since the
> encryption algorithm in GHCBv2 is AES_GCM, we cannot return to user
> space without having completed the request with the current sequence
> number. If we were to return and the guest were to make another request
> but with different message contents, then that would be IV reuse.
>
> When throttled, the driver will reschedule itself and then try
> again after sleeping half its ratelimit time to avoid a big wait queue.
> The ioctl may block indefinitely, but that has always been the case
> when deferring these requests to the host.
>
> Cc: Tom Lendacky <Thomas.Lendacky@xxxxxxx>
> Cc: Peter Gonda <pgonda@xxxxxxxxxx>
> Cc: Borislav Petkov <bp@xxxxxxx>
> Cc: Tom Lendacky <thomas.lendacky@xxxxxxx>
> Cc: Liam Merwick <liam.merwick@xxxxxxxxxx>
> Cc: Yang Yingliang <yangyingliang@xxxxxxxxxx>
> Cc: Haowen Bai <baihaowen@xxxxxxxxx>
>
> Signed-off-by: Dionna Glaze <dionnaglaze@xxxxxxxxxx>

Reviewed-by: Peter Gonda <pgonda@xxxxxxxxxx>