On 11/3/22 10:23, Peter Gonda wrote:
The ASP and an SNP guest use a series of AES-GCM keys called VMPCKs to communicate securely with each other. The IV to this scheme is a sequence number that both the ASP and the guest track. Currently this sequence number in a guest request must exactly match the sequence number tracked by the ASP. This means that if the guest sees an error from the host during a request it can only retry that exact request or disable the VMPCK to prevent an IV reuse. AES-GCM cannot tolerate IV reuse see: https://csrc.nist.gov/csrc/media/projects/block-cipher-techniques/documents/bcm/comments/800-38-series-drafts/gcm/joux_comments.pdf To handle userspace querying the cert_data length handle_guest_request() now: saves the number of pages required by the host, retries the request without requesting the extended data, then returns the number of pages required. Fixes: fce96cf044308 ("virt: Add SEV-SNP guest driver") Signed-off-by: Peter Gonda <pgonda@xxxxxxxxxx> Reported-by: Peter Gonda <pgonda@xxxxxxxxxx> Cc: Dionna Glaze <dionnaglaze@xxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: Tom Lendacky <thomas.lendacky@xxxxxxx> Cc: Michael Roth <michael.roth@xxxxxxx> Cc: Haowen Bai <baihaowen@xxxxxxxxx> Cc: Yang Yingliang <yangyingliang@xxxxxxxxxx> Cc: Marc Orr <marcorr@xxxxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Ashish Kalra <Ashish.Kalra@xxxxxxx> Cc: linux-kernel@xxxxxxxxxxxxxxx Cc: kvm@xxxxxxxxxxxxxxx
Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx>
--- Tested by placing each of the guest requests: attestation quote, extended attestation quote, and get key. Then tested the extended attestation quote certificate length querying. V4 * As suggested by Dionna moved the extended request retry logic into the driver. * Due to big change in patch dropped any reviewed-by tags. ---