Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8073695rwb; Tue, 6 Dec 2022 13:41:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf5y5wfGPmKzBG8iFzH4aSUDiYb0zMSMRaJ4OjPVfr13hdoTSvQ740+gGRxaQrm818X64mxA X-Received: by 2002:a17:902:f78a:b0:186:5bbc:2ad9 with SMTP id q10-20020a170902f78a00b001865bbc2ad9mr83620898pln.157.1670362913354; Tue, 06 Dec 2022 13:41:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670362913; cv=none; d=google.com; s=arc-20160816; b=t8fGEN/WrO9iKsng9PK00cAr1USWt38wfF+PDe4GFi+u+Dsyp9VXdAwJjgygBPC6ti HvtZBFYu17bEQelh0DoVAgYeIFR3VwzNi2WuzCMJfyNballaocyfkvAeff725K7B3SMR cIZrPblouqQQVs8wFWXCAkUoY1WKeMaVwIE0nY3GukkHjvTHgW8fjvvr0J3tiuOkd+Lk +o07L1qE2fyihkYsU9yj14E96UtcpQL2pq3sc3JbKkduzxqUy15tpIoqYHjB+3Mv+llz K6rYk3yGYIbuCDXxvIyfS5pyb7+KE4y9BTnYLdaxgZzI0QTlTx2W5wZUMb5OXbXbWQ2q EvDg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=YVDn0S8JQnZN5dcrnKjo8zsfbWVS/GOKauD82aiLVQQ=; b=ZXsD71C0WN5Q0IzIO74AHlJq2+J3BtImE7LIX201PkMPOdifu8hZEAh0OJY9uA/cRw rT6SSoLNcYs41DrK1gYOAhr1yOxgHaqg1iLIxbd01MBY9CGOya2DAl/MDst19KwwcANR eldMPXCo8L2mITj7tSYjyq3zSSFi06069XvWg6RN4owo0vO8dVLup+k7M3cyIvKOKbFh Sq3n+14dqNkshbFbNU2SCXpE9pVWNfO92xk9XNbjrN9swvd0Bla0kJUZvbjcmVtIMToF 64Jmkd7yyjJ1NNF5VEjDi0wGNOgFrO6gC0WLcFsUOBf7TsjcVBMrlEn/j4y9A+i7Zl2U CA7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=k3p47DcF; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw9-20020a17090b4d0900b0021901063557si11949758pjb.23.2022.12.06.13.41.41; Tue, 06 Dec 2022 13:41:53 -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=@alien8.de header.s=dkim header.b=k3p47DcF; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229538AbiLFV0c (ORCPT + 78 others); Tue, 6 Dec 2022 16:26:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiLFV03 (ORCPT ); Tue, 6 Dec 2022 16:26:29 -0500 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DFAA4841A for ; Tue, 6 Dec 2022 13:26:28 -0800 (PST) Received: from zn.tnic (p200300ea9733e711329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e711:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id DE0841EC0523; Tue, 6 Dec 2022 22:26:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1670361987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=YVDn0S8JQnZN5dcrnKjo8zsfbWVS/GOKauD82aiLVQQ=; b=k3p47DcFVuXJM8onhOBSue39zUDf2NtSZ560L/Q/UkcBnwDQn9r4LgyKfNSc04LKx6gCx1 MFY19yVzPP1FJBIamZWTWFxC+M6AzNa362IYaE6hcPq3XJ/xKyV8JgzriDHbJ91ExbsxWb ubjtbDRqGbxoLWi5CBOb2DfMqqURapQ= Date: Tue, 6 Dec 2022 22:26:22 +0100 From: Borislav Petkov To: Dionna Amalie Glaze Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Peter Gonda , Thomas Lendacky , Paolo Bonzini , Joerg Roedel , Ingo Molnar , Andy Lutomirsky , John Allen , Herbert Xu , "David S. Miller" Subject: Re: [PATCH v8 1/4] crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL Message-ID: References: <20221104230040.2346862-1-dionnaglaze@google.com> <20221104230040.2346862-2-dionnaglaze@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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, Dec 05, 2022 at 09:05:19AM -0800, Dionna Amalie Glaze wrote: > Arguably it shouldn't ever get this value. We're just not very > selective when we copy back the kernel copy of the ioctl argument. > In all cases user space should treat the value as undefined, but still > we don't want to leak uninitialized kernel stack values. Absolutely. > I've changed it to -1 to name the same kind of error across host and > guest: the communication with the PSP didn't complete successfully, so > the "error" value is not from the PSP. > This value can also get returned to user space during a -ENOTTY result. > We can call this NO_FW_CALL or UNDEFINED. I have no real preference. Me neither as long as this is written down and agreed upon as a possible value and not leaking kernel stack. > Whatever value we set initially, the VMM can overwrite exitinfo2 > during the ghcb_hv_call. > I'd rather that the "undefined" values were the same across both, > because the guest is merely receiving a value from the host's PSP > driver (or should be). > It keeps the enum for return values a bit tidier and not concerned > with whether the value is viewed from the host or guest. Ack. ... > I hope the above discussion is clear that it's purely a defined > "undefined" because being pickier about what to copy_to_user during > exceptional circumstances in order to not overwrite the user's fw_err > value seems an unnecessary amount of code. Ok, I think we're on the same page. So pls document that NO_FW_CALL or so value and what it means and that thing should be taken care of. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette