From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA280C4332F for ; Wed, 16 Nov 2022 17:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbiKPR2q (ORCPT ); Wed, 16 Nov 2022 12:28:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233204AbiKPR2p (ORCPT ); Wed, 16 Nov 2022 12:28:45 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7589832BA3; Wed, 16 Nov 2022 09:28:43 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 144AB229FE; Wed, 16 Nov 2022 17:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668619722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2+mwqcnu3Dk15IooPi8KuMWj/BV5uluYencW/62PbfE=; b=f9vZE3Aavb0yG3AG2jx/CdaOBJGlA5BkMJQI3Vx+g4+9MXsM8CQkW2IXN7tf4Vugy1nnpS khfILFr5Eqzyu6qFl7A5v+RWxqK5zF0W5eYqj9CVZO02osMTAd3HG57nfN3ezmRDo5p7bc cQMrbpl6a6/opvCCtNvTevEFgN5b8WA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668619722; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2+mwqcnu3Dk15IooPi8KuMWj/BV5uluYencW/62PbfE=; b=V7Mwz9U6WCW7KPIyl9RC6FbITz17YGp8j2IALJP7B6BnXf9XyzU4Bpc3WzImCYYcYVhGRq W1RFKktR1M/OGsDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 02AA613480; Wed, 16 Nov 2022 17:28:42 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id v2ecAModdWOzJAAAMHmgww (envelope-from ); Wed, 16 Nov 2022 17:28:42 +0000 Date: Wed, 16 Nov 2022 18:28:38 +0100 From: Borislav Petkov To: Peter Gonda Cc: Tom Lendacky , Dionna Glaze , Michael Roth , Haowen Bai , Yang Yingliang , Marc Orr , David Rientjes , Ashish Kalra , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH V4] virt: sev: Prevent IV reuse in SNP guest driver Message-ID: References: <20221103152318.88354-1-pgonda@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Wed, Nov 16, 2022 at 10:10:58AM -0700, Peter Gonda wrote: > I think another comment above the first snp_issue_guest_request() > could help too. Saying once we call this function we either need to > increment the sequence number or wipe the VMPCK to ensure the > encryption scheme is safe. And make that explicit pls: /* * If the extended guest request fails due to having to small of a * certificate data buffer retry the same guest request without the * extended data request... ... in order to not have to reuse the IV. I have to admit, the flow in that function is still not optimal but I haven't stared at it long enough to have a better idea... Thx. -- Regards/Gruss, Boris. SUSE Software Solutions Germany GmbH GF: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman (HRB 36809, AG Nürnberg)