Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp116868pxb; Tue, 12 Apr 2022 18:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGlgb+Gx9bULs//dMYRQandvFjcNeprGtglgU6qEAHjoMPvFvI492ocbls7aIn4F99aEJh X-Received: by 2002:a17:907:6284:b0:6e0:f895:15a with SMTP id nd4-20020a170907628400b006e0f895015amr37445861ejc.713.1649813814831; Tue, 12 Apr 2022 18:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649813814; cv=none; d=google.com; s=arc-20160816; b=vMgrOGxTvxq0G43gnnDXHiEE8HxefgQMz5/lAXIOGa4qVJ4mUX5OAb2ejhdUhgwPcO sXuvDthCzhg2LZxeqmAo/HoW4hCOsxui9MVUu+rfKl+e6nekbh0y1nTfTEC109gx53K0 XANx2Tu5/7B28jHWmi/OXLCH9YeIRq+j00jLaxz4N9F8EwrGLMjD7KcAehGgOgF3+k9n jl0lMzVxmz+bh6y2KDTV+5hZ3u3Ut1irPcmc84gGAdm6xMVbuvtjzcspQBaWgDjT01kX UuyRdUb2ESF2X2+FlfmLwORdxxpzlCRIuSIriUDsrX+2kip/YYWAJliwcketBntDdFn8 iW8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aIldCVQRoNdnC3Z1iVnCtTVi9LvUbjghv4ynjTs66E4=; b=mbQpwmBHs6ziyvG5pEzOd445kSK83ad4tsb4z0DHPtbUpSNsK2fh0q42Ot9ivhY3Tb aoiY+js/PlHsg5ZpjHLRVkxhakfaqXcdh/zTVA4ajNIWK2iqbKQk26DojZq1t2nK2BDc VCXAgbVlQ9533nqckDleNHe/lni+hjZqQ96zbUgCOkTNdGZksmc4+T0NQ1baXVBW7ZHG lDjWL1YcJo3yTe7x8AM1MK/tpUPA50jnJGqXNHRv5Q6LsoZCdur7m6A5hQjKG51+oeKf ANW4jSh5Ua6zxjT3uqXuc19BAccMzshIOLsLvwvj6WDD8zpEVQ7XCWXN+pqLbgedDh1d 0fxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=Vz3Kp5UD; 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=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v1-20020a17090690c100b006e86e6dd523si8086610ejw.99.2022.04.12.18.36.29; Tue, 12 Apr 2022 18:36:54 -0700 (PDT) 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=@ibm.com header.s=pp1 header.b=Vz3Kp5UD; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229683AbiDLXYl (ORCPT + 99 others); Tue, 12 Apr 2022 19:24:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbiDLXYY (ORCPT ); Tue, 12 Apr 2022 19:24:24 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851C225597; Tue, 12 Apr 2022 15:46:29 -0700 (PDT) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 23CIq6ti008918; Tue, 12 Apr 2022 21:21:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=aIldCVQRoNdnC3Z1iVnCtTVi9LvUbjghv4ynjTs66E4=; b=Vz3Kp5UD1OsNmMvfPmC9OJ+lamGQ148Kar2OiY4KFBhai/5u9psrBB7g4JLrvVrqjL9o 90jscwMAun2+KdArjyx0fK50DfHsblmYy22jn7/uuwQ9X1KXo84ZOPBxyP7lnIh6wVes G++tGOhA0pySmpof0Ih/Nj0I5+XsmtXNqYeejNOTEV0tzKRzL29I6G4lObIgH73Mik7N PlG8GppIJba1CvgZB+f5wSWct8yiOpRJdaylCHECcTF5B/vaxB4rZ1NKnbmgup9uVzlL 1ULKW+Gz65C/oK8I4fnNnRLRn6eADoenEIkO7h2kHtOCnk+PGB7fJQtuoIFePgVLss7p hw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdf30aubm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Apr 2022 21:21:44 +0000 Received: from m0098421.ppops.net (m0098421.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 23CLEPmZ012122; Tue, 12 Apr 2022 21:21:43 GMT Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 3fdf30aubc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Apr 2022 21:21:43 +0000 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 23CLDUWx025013; Tue, 12 Apr 2022 21:21:42 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma04wdc.us.ibm.com with ESMTP id 3fb1s9u3x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Apr 2022 21:21:42 +0000 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 23CLLfq912976668 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 12 Apr 2022 21:21:41 GMT Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A334B13604F; Tue, 12 Apr 2022 21:21:41 +0000 (GMT) Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BEF66136053; Tue, 12 Apr 2022 21:21:39 +0000 (GMT) Received: from amdrome3.watson.ibm.com (unknown [9.2.130.16]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 12 Apr 2022 21:21:39 +0000 (GMT) From: Dov Murik To: linux-efi@vger.kernel.org Cc: Dov Murik , Gerd Hoffmann , 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 , Matthew Garrett , 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: [PATCH v10 3/4] efi: Register efi_secret platform device if EFI secret area is declared Date: Tue, 12 Apr 2022 21:21:26 +0000 Message-Id: <20220412212127.154182-4-dovmurik@linux.ibm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220412212127.154182-1-dovmurik@linux.ibm.com> References: <20220412212127.154182-1-dovmurik@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: u2uTO1zImiDvv4PXQBKeJLTtOesbo-J2 X-Proofpoint-ORIG-GUID: xXX4t1_Acjk5qWhE6wrxt_BfOhH5jdEX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-12_06,2022-04-12_02,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 suspectscore=0 phishscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 clxscore=1015 adultscore=0 spamscore=0 mlxlogscore=999 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2204120097 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 During efi initialization, check if coco_secret is defined in the EFI configuration table; in such case, register platform device "efi_secret". This allows udev to automatically load the efi_secret module (platform driver), which in turn will populate the /secrets/coco directory in guests into which secrets were injected. Note that a declared address of an EFI secret area doesn't mean that secrets where indeed injected to that area; if the secret area is not populated, the driver will not load (but the platform device will still be registered). Signed-off-by: Dov Murik Reviewed-by: Gerd Hoffmann --- drivers/firmware/efi/efi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 378d044b2463..b8e68a121119 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -425,6 +425,11 @@ static int __init efisubsys_init(void) if (efi_enabled(EFI_DBG) && efi_enabled(EFI_PRESERVE_BS_REGIONS)) efi_debugfs_init(); +#ifdef CONFIG_EFI_COCO_SECRET + if (efi.coco_secret != EFI_INVALID_TABLE_ADDR) + platform_device_register_simple("efi_secret", 0, NULL, 0); +#endif + return 0; err_remove_group: -- 2.25.1