Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7554550rwb; Tue, 15 Nov 2022 14:14:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Kuxz+WIrfAIlxB9zpYiVWM8amg0/lQt0bB+4Otyi+bNIZijYEZwCnVRgJANWC/YJi2FOS X-Received: by 2002:a17:903:492:b0:188:758f:f45e with SMTP id jj18-20020a170903049200b00188758ff45emr6078744plb.12.1668550442080; Tue, 15 Nov 2022 14:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668550442; cv=none; d=google.com; s=arc-20160816; b=K5AlYSWQCjIpC6tHz99mPCi5wb52oO17gqzUId6bVAz9zexrlWRJQVIIFR/ClOydmK 5+orEZikUyEn3VCtXDtqjnXMBB+f4GOFAMHy7yq4EYNT6e0NW5vyW1YSB1fxAckTKVbD 2YVXh0tzHqskL4M2nAToebW0RqJy7BR8DI91nPauYv33JaQC0iIqhlma/pQ+9QQAFT0h fHRNfwx3dxJ1wDUPSJ1rQKSILnwdzCaVKwSdeFHa451HdW88KtQq+l0mIP3M5umz+Ahw nmuCjyTvp7iex9KvCeY7ZZ11/xQlkbMOJQZByKYBcdIBlXNxUb05O2JN81LWjjPM47bt hQPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature; bh=dlenJjpDzLcxo3DWLnYtaPtdkt0KhciARPTv6BR7Ky0=; b=vM62NlS5S3PEpOSDTXR+TyIyEmeDmajl7FeEgUc5+a+SdDaH9iq+mJRrgb6itpwWCD mUMUDlLcaGKQRS1t8m3D/9IBw1H+RI2rIN+pjANq+Nwt2lgs8bpN/VhKHowij8R0BdXX J+B9dME8aConSlUf4OOfb1yyVG+U06hWUf3yHvuQtNcKBsGi9uIZjdTq506R1LBgjYGD 9pfKC5lhe7HsjBjPo/kcJ96G6p2tDEElWzNLZSmPklk67C3H78IK0i55NBve1O9+d8nL cshB7IYz0fbgLncF9QgvDPuPe6xCpUU+1EErjA0ZyQCbzQWmyYRpEJOFeuR5G6/xswHJ 7iag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=uyz9uSIK; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu16-20020a17090b1b1000b0020b304225b4si129997pjb.104.2022.11.15.14.13.50; Tue, 15 Nov 2022 14:14:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=uyz9uSIK; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238744AbiKOVg1 (ORCPT + 91 others); Tue, 15 Nov 2022 16:36:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238570AbiKOVgY (ORCPT ); Tue, 15 Nov 2022 16:36:24 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B7E424F3D; Tue, 15 Nov 2022 13:36:23 -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 E1381336D8; Tue, 15 Nov 2022 21:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1668548181; 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=dlenJjpDzLcxo3DWLnYtaPtdkt0KhciARPTv6BR7Ky0=; b=uyz9uSIKl8YjXXq95m/Rf4xRo/PRtAeTRkaCCeBrmWSPpkSoisELGpK7ZgFz6Kq5XCA59C 1Ndo3iN/KK9/AJkawe5qcGBA0awBaGMbBKFAZwXXhtz9IStzhQWUOR7t+LlP9On03FYDpb a5yb7XAMuslCgX2YMPKKmIH9rojuBZk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1668548181; 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=dlenJjpDzLcxo3DWLnYtaPtdkt0KhciARPTv6BR7Ky0=; b=fHa3Wajmy0bbb5yUoFvoQZ5nhwtxA7CXUym/vI2atKyujCRdZmw1pxEsNypju/KTFtmiT5 Q8pFrKOGENR8HlAg== 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 C1C6A13A91; Tue, 15 Nov 2022 21:36:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id dYfXLlUGdGMrMwAAMHmgww (envelope-from ); Tue, 15 Nov 2022 21:36:21 +0000 Date: Tue, 15 Nov 2022 22:36:17 +0100 From: Borislav Petkov To: Peter Gonda Cc: thomas.lendacky@amd.com, 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 14, 2022 at 02:11:48PM -0700, Peter Gonda wrote: > Thanks for detailed review. Working on cleaning up the text for a V5. Yeah, and I have some questions in my reply which you haven't addressed... > > > @@ -676,7 +712,7 @@ static int __init sev_guest_probe(struct platform_device *pdev) > > > if (!snp_dev->response) > > > goto e_free_request; > > > > > > - snp_dev->certs_data = alloc_shared_pages(dev, SEV_FW_BLOB_MAX_SIZE); > > > + snp_dev->certs_data = alloc_shared_pages(dev, sizeof(*snp_dev->certs_data)); > > > > What's that change for? > > > > I went searching for that ->certs_data only ot realize that it is an > > array of size of SEV_FW_BLOB_MAX_SIZE elems. > > Do you want this change reverted? I liked the extra readability of the > sizeof(*snp_dev->certs_data) but its unnecessary for this change. Really? I think using a define which is a SIZE define is better. Especially if you look at sizeof(*snp_dev->certs_data) and wonder what type ->certs_data is. And it's not like it'll go out of sync since it is an array of size, well, SEV_FW_BLOB_MAX_SIZE. :-) Thx. -- Regards/Gruss, Boris. SUSE Software Solutions Germany GmbH GF: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman (HRB 36809, AG Nürnberg)