virt/coco/sev-guest: Double-buffer messages
authorDionna Glaze <dionnaglaze@google.com>
Tue, 7 Mar 2023 19:24:48 +0000 (20:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:10 +0000 (23:03 +0900)
commit577a64725bfd77645986168e953d405067ee565b
treed127fdc00216a9f88c68022d428a31d21feea782
parent02891701516b24783273b4e213c59de424edee9d
virt/coco/sev-guest: Double-buffer messages

[ Upstream commit 965006103a14703cc42043bbf9b5e0cdf7a468ad ]

The encryption algorithms read and write directly to shared unencrypted
memory, which may leak information as well as permit the host to tamper
with the message integrity. Instead, copy whole messages in or out as
needed before doing any computation on them.

Fixes: d5af44dde546 ("x86/sev: Provide support for SNP guest request NAEs")
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230214164638.1189804-3-dionnaglaze@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/virt/coco/sev-guest/sev-guest.c