Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2344238pxb; Thu, 3 Feb 2022 04:47:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxk285rM6blywoxhXbTTGmaTubYDNr3vUBIjSdz2YlXx5oE39/swvQRkVdk5IcCZDV1r6iA X-Received: by 2002:a63:7b4c:: with SMTP id k12mr15363838pgn.179.1643892459535; Thu, 03 Feb 2022 04:47:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643892459; cv=none; d=google.com; s=arc-20160816; b=NBtNlOLLWrryzEhI1jnB17ZXKLsHI9HJYjbsYoxfZUw4Q+JxlXJRRJpl51qImUQsOL lAikb4ht0oiLisz/XBLKewLwx7yxzBxQe6qbhsFN85AGS4E7J62NBn1Hty/lq3rzr8IC O8n7pwTaGLoHvwRq3SarL2IbeA+Rdn86ar1uibByhKdbiYmUdSaGeB1s+xIRwggNZZpP qtcUWhgWcLIEwKUsznRZxyTT1ZFYA4GmQm0TgIEvQbjuARuYSOu4KewvTQBpw0A7Qxwi uY5xtQRE9tSLKNrUQ2kQCrRfE/PZUNu1PTNokMeoX6CpbvoxJh2otF/tiI/B7f8voCtf xH7Q== 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=9UeP884R0XOaRj0han6Xo8dpHPHnU7unNJM7uHqABog=; b=BAkt2dYcFTKhG/hqtZ1Pk74If/xQ7GbTJF0O3Q2oXdkALq36tHKgocI3lw+3KZq5u9 5c1fDtNR8jgWPcNyaRQ/lfpzG6tEu2y350dKvtqAvRZWPYwYnwWqMtFjStUYn8Jzz51r rIMqFaymURQ8DILb68H+ET0+m0BLGndKNFstDFw0gXs4V5oNlINpAZf1zkEa7Gltc5sN gyi/vfQffY0xeUDOUodWGNldwUYkz22SQAabC0UOfhGmgiCQV5teqhXXbFPT0OvsvwKz 62BiBS2bb5BN44OS0VFuKgqguIYtfzsumktkPbuyNlBc7YXAzJ7AGZFT7zTn84pUgrX5 aSWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tyE+zUDJ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a65si20300842pge.51.2022.02.03.04.47.27; Thu, 03 Feb 2022 04:47:39 -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=@linuxfoundation.org header.s=korg header.b=tyE+zUDJ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238901AbiBANu4 (ORCPT + 99 others); Tue, 1 Feb 2022 08:50:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43292 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230073AbiBANuz (ORCPT ); Tue, 1 Feb 2022 08:50:55 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41A3B6159D; Tue, 1 Feb 2022 13:50:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01212C340EB; Tue, 1 Feb 2022 13:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643723454; bh=ldq7bhd25XbE5kFzQtjZQM2k7oQhrQBRZZi85C+Hwts=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tyE+zUDJSrEZ9Q9Ye/QchpMFVu3J7iYkahV+mZ0c7QZkEIvj2dBruxSK+UOLi5C/k ag0aaGZJOEII5ShkiuXppByTUhWhl6dz2R1JtCzomHDB+99o2Z3tUlJ7I/OJXNOTQ/ YvTkN25TEpK6wGiq/MTQsMCRWlaNzHUKKXixfLD8= Date: Tue, 1 Feb 2022 14:50:52 +0100 From: Greg KH To: Dov Murik Cc: linux-efi@vger.kernel.org, Borislav Petkov , Ashish Kalra , Brijesh Singh , Tom Lendacky , Ard Biesheuvel , James Morris , "Serge E. Hallyn" , Andi Kleen , Andrew Scull , Dave Hansen , "Dr. David Alan Gilbert" , Gerd Hoffmann , Lenny Szubowicz , Peter Gonda , James Bottomley , Tobin Feldman-Fitzthum , Jim Cadden , Daniele Buono , linux-coco@lists.linux.dev, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 0/5] Allow guest access to EFI confidential computing secret area Message-ID: References: <20220201124413.1093099-1-dovmurik@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220201124413.1093099-1-dovmurik@linux.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 01, 2022 at 12:44:08PM +0000, Dov Murik wrote: > Confidential computing (coco) hardware such as AMD SEV (Secure Encrypted > Virtualization) allows guest owners to inject secrets into the VMs > memory without the host/hypervisor being able to read them. In SEV, > secret injection is performed early in the VM launch process, before the > guest starts running. > > OVMF already reserves designated area for secret injection (in its > AmdSev package; see edk2 commit 01726b6d23d4 "OvmfPkg/AmdSev: Expose the > Sev Secret area using a configuration table" [1]), but the secrets were > not available in the guest kernel. > > The patch series keeps the address of the EFI-provided memory for > injected secrets, and exposes the secrets to userspace via securityfs > using a new efi_secret kernel module. The module is autoloaded (by the > EFI driver) if the secret area is populated. > > The first patch in EFI keeps the address of the secret area as passed in > the EFI configuration table. The second patch is a quirk fix for older > firmwares didn't mark the secrets page as EFI_RESERVED_TYPE. The third > patch introduces the new efi_secret module that exposes the content of > the secret entries as securityfs files, and allows clearing out secrets > with a file unlink interface. The fourth patch auto-loads the > efi_secret module during startup if the injected secrets area is > populated. The last patch documents the data flow of confidential > computing secret injection. > > As a usage example, consider a guest performing computations on > encrypted files. The Guest Owner provides the decryption key (= secret) > using the secret injection mechanism. The guest application reads the > secret from the efi_secret filesystem and proceeds to decrypt the files > into memory and then performs the needed computations on the content. > > In this example, the host can't read the files from the disk image > because they are encrypted. Host can't read the decryption key because > it is passed using the secret injection mechanism (= secure channel). > Host can't read the decrypted content from memory because it's a > confidential (memory-encrypted) guest. > > This has been tested with AMD SEV and SEV-ES guests, but the kernel side > of handling the secret area has no SEV-specific dependencies, and > therefore might be usable (perhaps with minor changes) for any > confidential computing hardware that can publish the secret area via the > standard EFI config table entry. > > To enable this functionality, set CONFIG_EFI_SECRET=m when building the > guest kernel. > > Here is a simple example for usage of the efi_secret module in a guest > to which an EFI secret area with 4 secrets was injected during launch: > > # ls -la /sys/kernel/security/coco/efi_secret > total 0 > drwxr-xr-x 2 root root 0 Jun 28 11:54 . > drwxr-xr-x 3 root root 0 Jun 28 11:54 .. > -r--r----- 1 root root 0 Jun 28 11:54 736870e5-84f0-4973-92ec-06879ce3da0b > -r--r----- 1 root root 0 Jun 28 11:54 83c83f7f-1356-4975-8b7e-d3a0b54312c6 > -r--r----- 1 root root 0 Jun 28 11:54 9553f55d-3da2-43ee-ab5d-ff17f78864d2 > -r--r----- 1 root root 0 Jun 28 11:54 e6f5a162-d67f-4750-a67c-5d065f2a9910 > > # xxd /sys/kernel/security/coco/efi_secret/e6f5a162-d67f-4750-a67c-5d065f2a9910 > 00000000: 7468 6573 652d 6172 652d 7468 652d 6b61 these-are-the-ka > 00000010: 7461 2d73 6563 7265 7473 0001 0203 0405 ta-secrets...... > 00000020: 0607 .. > > # rm /sys/kernel/security/coco/efi_secret/e6f5a162-d67f-4750-a67c-5d065f2a9910 > > # ls -la /sys/kernel/security/coco/efi_secret > total 0 > drwxr-xr-x 2 root root 0 Jun 28 11:55 . > drwxr-xr-x 3 root root 0 Jun 28 11:54 .. > -r--r----- 1 root root 0 Jun 28 11:54 736870e5-84f0-4973-92ec-06879ce3da0b > -r--r----- 1 root root 0 Jun 28 11:54 83c83f7f-1356-4975-8b7e-d3a0b54312c6 > -r--r----- 1 root root 0 Jun 28 11:54 9553f55d-3da2-43ee-ab5d-ff17f78864d2 Please see my comments on the powerpc version of this type of thing: https://lore.kernel.org/r/20220122005637.28199-1-nayna@linux.ibm.com You all need to work together to come up with a unified place for this and stop making it platform-specific. Until then, we can't take this. sorry, greg k-h