Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2383543pxb; Thu, 3 Feb 2022 05:35:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3i2NFJxVGky9kwG5fki9J9vhJbv0rf+DSKF5/FC2FpZVayh9lKaI+tWUF6R5llTzZ4iEY X-Received: by 2002:a17:907:9491:: with SMTP id dm17mr29018283ejc.47.1643895323966; Thu, 03 Feb 2022 05:35:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643895323; cv=none; d=google.com; s=arc-20160816; b=LqXyDj/j0q6al0NHzny5tPd+u6t0K+KZjEWYYfL/a/8z6cfli75grCYkL7DJq2ahTy iNZo2r0iMUi1NUKEgYCSPLZ/FvN8w53fYeLQJtuA4xMJlSSBrHEgr/Q7XfzoMvcwO4IB qR44IQ9eVZrMPEZIT6XhHZQjfsKqhueekqObKg2wIofsfi0SqpS9LZ/iE3lB/TpW7dMf IGYhZONstpX+LDIGLLwJyrV0FaSf9DxWRrSoiDCT7fAzbh47ax6ZUZMpYyxEgGwNCsmD 53KqMDmCRYuhsqC3AvvvpZxYRj4ZVOAr+aTu20E5tbIswLf28d5v+WQa+fETQhZfC26k c9+g== 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=FgpMsQQCeVrG6sl2UYp1/oUbqnLQ5oqDwItlUehJG3k=; b=GjAlSHSmnPepg647JBd77zzctI9p3A83s+rcvV3fjo3rmQfd+W8DDp34+q/oBV1/uZ odYr9nSo6B9A0KNwIRPmZzK6JhdUucXosQjcHM4Mrv32ziDrCY1t+LBKN4pAZC373LW2 7lCZ0nQqb5DxpkTJGgYpq6x/AIRIbu6ek7Jyn9ndgf3aJB9940zolaXFBaiHzpn0BdYx hEXeoVm0YCPFrChOOxymrZGVUAEZOjvVb6Do7W7dMzR2NvARc7DLmVx2eI+a6wVhj9Pd ZEfnl/R0igdu+FcPcl/E8MEVIcNgZFzx2UTY7qvZzWiVqYj+4rmOZ08ShUfzjLkSDRrG N/Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ILM/CZ2L"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13si12790997edi.477.2022.02.03.05.34.57; Thu, 03 Feb 2022 05:35:23 -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=@redhat.com header.s=mimecast20190719 header.b="ILM/CZ2L"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245174AbiBBIrm (ORCPT + 99 others); Wed, 2 Feb 2022 03:47:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54628 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237169AbiBBIrl (ORCPT ); Wed, 2 Feb 2022 03:47:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643791661; 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: in-reply-to:in-reply-to:references:references; bh=FgpMsQQCeVrG6sl2UYp1/oUbqnLQ5oqDwItlUehJG3k=; b=ILM/CZ2L330qWJZr2/XJOBzIcELVg1etDtM7/aLu9QTvueh4JAdlWgizzZo+MtRYMubrrI klZ0ANaCRVosXrHCTiwloE/BAkxO29zKet7BuXvfNVRDcS/CUyqzPvm6vghcFmit9nDlm/ HeLSGEfwtufqQi6l6VHAnXj8diwQeZ8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-586-pS9IErz6OjOB7wZPlsgLhA-1; Wed, 02 Feb 2022 03:47:38 -0500 X-MC-Unique: pS9IErz6OjOB7wZPlsgLhA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B40028144E5; Wed, 2 Feb 2022 08:47:25 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.193.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 603CC6AB98; Wed, 2 Feb 2022 08:47:25 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 8BE3B1800397; Wed, 2 Feb 2022 09:47:23 +0100 (CET) Date: Wed, 2 Feb 2022 09:47:23 +0100 From: Gerd Hoffmann 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 , Greg KH , Andrew Scull , Dave Hansen , "Dr. David Alan Gilbert" , 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 4/5] efi: Load efi_secret module if EFI secret area is populated Message-ID: <20220202084723.ushasiekb3cxami4@sirius.home.kraxel.org> References: <20220201124413.1093099-1-dovmurik@linux.ibm.com> <20220201124413.1093099-5-dovmurik@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220201124413.1093099-5-dovmurik@linux.ibm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 01, 2022 at 12:44:12PM +0000, Dov Murik wrote: > If the efi_secret module is built, register a late_initcall in the EFI > driver which checks whether the EFI secret area is available and > populated, and then requests to load the efi_secret module. > + area = memremap(efi.coco_secret, sizeof(*area), MEMREMAP_WB); > + if (!area) { > + pr_err("Failed to map confidential computing secret area descriptor\n"); > + return -ENOMEM; > + } > + if (!area->base_pa || area->size < sizeof(*header_guid)) > + goto unmap_desc; > + > + header_guid = (void __force *)ioremap_encrypted(area->base_pa, sizeof(*header_guid)); > + if (!header_guid) { > + pr_err("Failed to map secret area\n"); > + ret = -ENOMEM; > + goto unmap_desc; > + } > + if (efi_guidcmp(*header_guid, EFI_SECRET_TABLE_HEADER_GUID)) > + goto unmap_encrypted; Why these sanity checks are here and not in the efi_secret module? take care, Gerd