Re: [PATCH v11 44/45] virt: sevguest: Add support to get extended report
From: Borislav Petkov
Date: Fri Mar 04 2022 - 09:07:10 EST
On Thu, Mar 03, 2022 at 10:47:20AM -0600, Brijesh Singh wrote:
> I did not fail on !req.cert_len, because my read of the GHCB spec says that
> additional data (certificate blob) is optional. A user could call
> SNP_GET_EXT_REPORT without asking for the extended certificate. In this
> case, SNP_GET_EXT_REPORT == SNP_GET_REPORT.
>
> Text from the GHCB spec section 4.1.8
> ---------------
> https://developer.amd.com/wp-content/resources/56421.pdf
>
> The SNP Extended Guest Request NAE event is very similar to the SNP Guest
> Request NAE event. The difference is related to the additional data that can
> be returned based on the guest request. Any SNP Guest Request that does not
> support returning additional data must execute as if invoked as an SNP Guest
> Request.
> --------------
Sorry, it is still not clear to me how
"without asking for the extended certificate" == !req.certs_len
That's not explained in the help text either. And ->certs_len is part of
the input structure but nowhere does it say that when that thing is 0,
the request will be downgraded to a SNP_GET_REPORT.
How is the user of this supposed to know?
And regardless, you can still streamline the code as in the example I
gave so that it is clear which values are checked and for which does the
request get failed...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette