Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2466362rdg; Mon, 14 Aug 2023 03:38:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ0bqfbMvMJB68f+D4Vt0gnTI26l6uzWmMD3i0Qb+7/fQSi9hZu1zyPYudkzX1WllZbCoM X-Received: by 2002:a17:90a:e604:b0:26b:698f:dda7 with SMTP id j4-20020a17090ae60400b0026b698fdda7mr374713pjy.32.1692009506243; Mon, 14 Aug 2023 03:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692009506; cv=none; d=google.com; s=arc-20160816; b=rSAEKWfIVPJ/mj7B7eyOQvh3uAtjnmAqli+S6U7U1z7oHtFbp8T6AjAhWu0HZ4dqOA Met1+UyOW6PhTj1JUZB8X0RjIkNcjhw/hmObcGziUS+2DYSQzZjFWeVgPwficSG2JHxD WLHtSlw3drPZ6P6JybgAOhrHPnnEBGzFK8/CI4M9abRqyy54ijwQww0vrTV5lMP2znBN R2TjSoRcKoOxe6nPg3ZAvHqoisUV75y8Hb3x5Pxx6yKVVWAzry4akMbjLQhSapUd2TsN XENFK2Srz0LS5iR/uqhDA6p/nMvvTH+uKffrJwgRICnYDJRFHzRQFf9r+nA530V1bvlr oOBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JFxxFR5TymLQm+aito+FZJyIWGIRfXx3TVA3PFJ72C0=; fh=+bg7h6zUnfxtrlR0p0v46kC6Sg16D4XO+9Ym5yLs7iE=; b=A9mxLPf0pmfa8IcYrZdLY0WiAaX6MG24WeVZNr/VUxgm0UKJOvHUDn5HwZP7u34Ag9 x4tHsiQ+ej9Ju1j8DL4zEs3kHVZsmw9QRHGMPL2CvO4vUEPapTSVH0+6Wh4XQgE5cvla JBgSnKgt1WYTTtPRnLoQaT5ckYX/naBGilVcPz/ar5aF1n2+ecpJTLdm3tAQUNApphkd kmCf3L5ApKNo7v1827IGfkKE5YM2a4F0HjDFeceAjMiSE4bGL12HtNRvjHEaYqBgXbbH vFBIQ05VVBQ8+gBUce+huikddxOb+ZtctVvA1BUoNqNDO3c+PT4AUilTcBkRlmfnXCfK GFWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3GkhbXJ; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a17090a70c700b0026818f6a0c0si8122125pjm.86.2023.08.14.03.38.14; Mon, 14 Aug 2023 03:38:26 -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=@linaro.org header.s=google header.b=x3GkhbXJ; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233908AbjHNJZ2 (ORCPT + 99 others); Mon, 14 Aug 2023 05:25:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235677AbjHNJY6 (ORCPT ); Mon, 14 Aug 2023 05:24:58 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FB6113 for ; Mon, 14 Aug 2023 02:24:56 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ba1e9b1fa9so62587281fa.3 for ; Mon, 14 Aug 2023 02:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692005094; x=1692609894; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=JFxxFR5TymLQm+aito+FZJyIWGIRfXx3TVA3PFJ72C0=; b=x3GkhbXJC7WiYbklRuBlGb7WiDGlcrWkMpbKimBKGnsS7UOm4sFHGPD/nvR8QfAoFL VuOyl+JmQGxrn46EEoXzzDAM0UFO7waKyDAiu18vvJ3hqxDKMn9xzumiOPxiSAG5BcMH +UGfnaXC+D3PCcL7HT1uYHqWvI1BsSpL8iL6jg7+TcIIseQpnKW3066fJco8/ToqrGuS Im1ZEpgtynpE2iBYKnXtjYumLf9aPSzC65NrvNcygtn69i5Cr39oc0tAGIPcFihUdVgh YKl8GIZdGg/Z/iiM9FuXjdG5z9HUtGtd+HxniAbaznklMkxFETAtFTn1y3kfeQMTFReS rn2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692005094; x=1692609894; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JFxxFR5TymLQm+aito+FZJyIWGIRfXx3TVA3PFJ72C0=; b=HuakJOo82fPlo97Ni3mGq+UH4lFWnEve8dq8OBJWNYFzzqS5Ap8dZ9xlJE2ozJyTQa sr8eImaCETGKmlK2OkMyX2jOLn0PtrESBV0T2xMGMGuX5j0dYJmEsGblijZS+CbCptLi wA+d4+wa5F0eWbp4f6CRrzAdToOOmkKDFM+yF4K92hGsacngzhp1n5Mk/UZWayhXVdwq NR1FSuTxqZzKBs+vv6j61xGunj6ARd0Ib1vzH+QyA5WZHgRXHzzGdGwWPDogwKyFVsN2 tTa6kTU55t/JMJ/bT5ZuMeRv6q2KHZLjSC9/wDOh57nSCZ6blPnxLxEIQtXiicqFTYKW /kuQ== X-Gm-Message-State: AOJu0Yx7kJ0hgdveRr0NPMq17JdS/Czp0SiNCDbGRnT/HJDno/RCiHe2 jS3XXbqySDszYS+PofuUXJ1uQ3BjENi2Ngp0G+hXUESprrji4Zxm7IvYxw== X-Received: by 2002:a05:651c:212:b0:2b5:7f93:b3b0 with SMTP id y18-20020a05651c021200b002b57f93b3b0mr6151058ljn.17.1692005094466; Mon, 14 Aug 2023 02:24:54 -0700 (PDT) MIME-Version: 1.0 References: <20230807025343.1939-1-masahisa.kojima@linaro.org> In-Reply-To: <20230807025343.1939-1-masahisa.kojima@linaro.org> From: Ilias Apalodimas Date: Mon, 14 Aug 2023 12:24:18 +0300 Message-ID: Subject: Re: [PATCH v8 0/5] introduce tee-based EFI Runtime Variable Service To: Masahisa Kojima , Jan Kiszka Cc: Ard Biesheuvel , Jens Wiklander , Sumit Garg , linux-kernel@vger.kernel.org, op-tee@lists.trustedfirmware.org, Johan Hovold , Randy Dunlap , Heinrich Schuchardt , Jonathan Cameron Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 Hi Jan, On Mon, 7 Aug 2023 at 05:53, Masahisa Kojima wrote: > > This series introduces the tee based EFI Runtime Variable Service. > > The eMMC device is typically owned by the non-secure world(linux in > this case). There is an existing solution utilizing eMMC RPMB partition > for EFI Variables, it is implemented by interacting with > OP-TEE, StandaloneMM(as EFI Variable Service Pseudo TA), eMMC driver > and tee-supplicant. The last piece is the tee-based variable access > driver to interact with OP-TEE and StandaloneMM. > > Changelog: > v7 -> v8 > Only patch #3 "efi: Add tee-based EFI variable driver" is updated. > - fix typos > - refactor error handling, direct return if applicable > - use devm_add_action_or_reset() for closing of tee context/session > - remove obvious comment Any chance you can run this and see if it solves your issues? Thanks /Ilias > > v6 -> v7 > Patch #1-#4 are not updated. > Patch #5 is added into this series, original patch is here: > https://lore.kernel.org/all/20230609094532.562934-1-ilias.apalodimas@linaro.org/ > > There are two issues in the v6 series and v7 series addresses those. > > 1) efivar ops is not restored when the tee-supplicant daemon terminates. > -> As the following patch says, user must remove the device before > terminating tee-supplicant daemon. > https://lore.kernel.org/all/20230728134832.326467-1-sumit.garg@linaro.org/ > > 2) cause panic when someone remounts the efivarfs as RW even if > SetVariable is not supported > -> The fifth patch addresses this issue. > "[PATCH v7 5/5] efivarfs: force RO when remounting if SetVariable is > not supported" > > v5 -> v6 > - new patch #4 is added in this series, #1-#3 patches are unchanged. > automatically update super block flag when the efivarops support > SetVariable runtime service, so that user does not need to manually > remount the efivarfs as RW. > > v4 -> v5 > - rebase to efi-next based on v6.4-rc1 > - set generic_ops.query_variable_info, it works as expected as follows. > $ df -h /sys/firmware/efi/efivars/ > Filesystem Size Used Avail Use% Mounted on > efivarfs 16K 1.3K 15K 8% /sys/firmware/efi/efivars > > v3 -> v4: > - replace the reference from EDK2 to PI Specification > - remove EDK2 source code reference comments > - prepare nonblocking variant of set_variable, it just returns > EFI_UNSUPPORTED > - remove redundant buffer size check > - argument name change in mm_communicate > - function interface changes in setup_mm_hdr to remove (void **) cast > > v2 -> v3: > - add CONFIG_EFI dependency to TEE_STMM_EFI > - add missing return code check for tee_client_invoke_func() > - directly call efivars_register/unregister from tee_stmm_efi.c > > rfc v1 -> v2: > - split patch into three patches, one for drivers/tee, > one for include/linux/efi.h, and one for the driver/firmware/efi/stmm > - context/session management into probe() and remove() same as other tee > client driver > - StMM variable driver is moved from driver/tee/optee to driver/firmware/efi > - use "tee" prefix instead of "optee" in driver/firmware/efi/stmm/tee_stmm_efi.c, > this file does not contain op-tee specific code, abstracted by tee layer and > StMM variable driver will work on other tee implementation. > - PTA_STMM_CMD_COMMUNICATE -> PTA_STMM_CMD_COMMUNICATE > - implement query_variable_store() but currently not used > - no use of TEEC_SUCCESS, it is defined in driver/tee/optee/optee_private.h. > Other tee client drivers use 0 instead of using TEEC_SUCCESS > - remove TEEC_ERROR_EXCESS_DATA status, it is referred just to output > error message > > > > Ilias Apalodimas (1): > efivarfs: force RO when remounting if SetVariable is not supported > > Masahisa Kojima (4): > efi: expose efivar generic ops register function > efi: Add EFI_ACCESS_DENIED status code > efi: Add tee-based EFI variable driver > efivarfs: automatically update super block flag > > drivers/firmware/efi/Kconfig | 15 + > drivers/firmware/efi/Makefile | 1 + > drivers/firmware/efi/efi.c | 18 + > drivers/firmware/efi/stmm/mm_communication.h | 236 +++++++ > drivers/firmware/efi/stmm/tee_stmm_efi.c | 612 +++++++++++++++++++ > drivers/firmware/efi/vars.c | 8 + > fs/efivarfs/super.c | 45 ++ > include/linux/efi.h | 12 + > 8 files changed, 947 insertions(+) > create mode 100644 drivers/firmware/efi/stmm/mm_communication.h > create mode 100644 drivers/firmware/efi/stmm/tee_stmm_efi.c > > > base-commit: f6e6e95ce16205025b7b8680a66c30a0c4ec2270 > -- > 2.30.2 >