Received: by 2002:ab2:3c46:0:b0:1f5:f2ab:c469 with SMTP id x6csp209443lqf; Fri, 26 Apr 2024 04:42:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRYZs3b/bDgjJKR8zRMxAuVMsfPWMMhvtpywHXmksjORZ6+a/Xfqiq8BMKdVt27P7B6ZCAvbR91iUv6D9f7Z3P0bBERw04lnAeVhCRnA== X-Google-Smtp-Source: AGHT+IFW6CMQegPB/cJnYZsgJTvc5UevKI/DSmZm97GTaU4PIGPPQ+bHvr0KMHnn/P2GAMIZdX/k X-Received: by 2002:a05:6a00:2187:b0:6f3:8479:290a with SMTP id h7-20020a056a00218700b006f38479290amr2913456pfi.17.1714131735588; Fri, 26 Apr 2024 04:42:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714131735; cv=pass; d=google.com; s=arc-20160816; b=jThrvtOKR4QtNHPpJdldSCr6HB4/h6FJ9wcnMLlhLS0a7ILA3Nol8hX7SVR9G0GScO WePWgqmgaOaU6ijJPkSE4ZDzO2YB+HdDQNrjNX/WQ1XRkdiKgkhNtHnRUNep6HbD6TCb pp5I1fhagkKYGaJDW5pNwA99dEChVa5t7S5vbre4HrtLYxEzF+7FPWzMLWbk4wp5jBGQ tvHF2YH4rHtg8Ey0fB6Gue/qDXuSks86iznIQomK0q7xUJRr+DoQPTsBh512qWWhhhaa RuTpbtkcxmYvTMxL92MhsSrbjv1tZGMABX9vDhymIpHJZMD58c/p6Z7t43ivvGvg/1mn k5eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=TWBGeyEItUFJv4p6VcuuL19rn6QGIuBuAfWSiuxHp0k=; fh=SlGUBxZQBm2ziWDg8QRQrRqT40IT6IccLCNxljvu+zs=; b=HoZ7Qt/X8/U/073vHbZH1lQG1mZVyDdU86Qj/i3QbeL8PSBx+GL6P6vvNIVILF5YHH DMPQeY7vReGj4KarqDxBMe3GAInFka935Vv2KhNr1yKy4TuYoFgO393e1zkZuDHWcJr1 aKUS2RzlUXwnb9NSF1PVSI8OlS+HcaesF6lvomF+BoaN7sU7SUVwGLb1Fu5dNx98e/ZD b29xZ7uN+wpm6ANTrpKKVNpNcfHOVxfx4/tVrFTi4CyHNm2GsQ6JHyrNuCWiOjK7FWyB 8kZtGYOn36rRDxZm9si2mhMe2zvYQt9PcVIWp903h/ZYOgPVzxkw0jHLmfQl7CF71zKW 0VXg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lMU7B8Sk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159945-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i15-20020aa78d8f000000b006eada9fe237si15142472pfr.188.2024.04.26.04.42.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 04:42:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-159945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lMU7B8Sk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-159945-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-159945-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BE6102833DD for ; Fri, 26 Apr 2024 11:42:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50EBA145B3E; Fri, 26 Apr 2024 11:41:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lMU7B8Sk" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79295145341; Fri, 26 Apr 2024 11:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714131713; cv=none; b=Nyuig7NrS4Gf2aWmU5rLBGGe2/qPG8jQeqXD69tyOT6A7zMH+C2ykC3UMWodCkpLCqmaM01/yck+Be0dHncSRp/wOM1TMVjra1uMf0lEAFSgfaWikbHHhB0AtTHNj1zcguqJCQg68JIFImypF70emjgpdfI7mK8vLo88/0V9hZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714131713; c=relaxed/simple; bh=060C0eRyK2crDEUo4GFbKKDarWvNJFdiUqBTqnc9Udg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=KIIuPgUu4p5tdH7GuLPUR3MDN5BPyhUHYpsHSG9IMbdmC7a23T0Zo3sI06OUsXVG6hjY1mriM+k3LvtRFDuRXpmQF8bBDU1QGTbcpBVvBbhWk2jvOeeNKgUhrSSps4m5vG+ASi4RE8Bn5DzQX/h2tuj1rxRb+u/MukiS1LL5zH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lMU7B8Sk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDC84C113CD; Fri, 26 Apr 2024 11:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714131713; bh=060C0eRyK2crDEUo4GFbKKDarWvNJFdiUqBTqnc9Udg=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=lMU7B8SknPTVtxDHVYvvYmHeak7SID/R2+WrjbQuJDD0dZaXJsNbun+p5KHqZ5P6D iKuO9oKPAVBoYcVt2XyKj7vyPVRRV6xDMF8rZmDFk+dEQKyv0lCwHTWL8FhRkacUv3 ixOxDYQj4uI9Mrij6z4TEC4wYpJvdUBmF8n/oL/gkEeScLm/7OrLYP6qA79Ur9WUQ9 sPb9JsmvKX9nrPh02b45ZzXbou1AyGpOLV0eI/mibSVT4WmUJyQSlp7KKQprJytG0m k8g1Kbuiu31UdIf8jxxFIo5leJihWoGI9zZtxTOqEuQvwHfijYTBPMAFjkay4enuQZ bpPFlr/ixgNPA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 26 Apr 2024 14:41:47 +0300 Message-Id: Cc: , "Ilias Apalodimas" , "Lennart Poettering" Subject: Re: [PATCH] efi: expose TPM event log to userspace via sysfs From: "Jarkko Sakkinen" To: "Mikko Rapeli" , "Ard Biesheuvel" , X-Mailer: aerc 0.17.0 References: <20240422112711.362779-1-mikko.rapeli@linaro.org> In-Reply-To: <20240422112711.362779-1-mikko.rapeli@linaro.org> On Mon Apr 22, 2024 at 2:27 PM EEST, Mikko Rapeli wrote: > Userspace needs to know if TPM kernel drivers need to be loaded > and related services started early in the boot if TPM device > is used and available. If EFI firmware has used TPM device > to e.g. measure binaries, then many of them also provide the TPM What are the other uses cases? TPM settings and reset (clear), i.e. machine owner use cases? I think "e.g." is not needed here and it confuses a bit. > log to kernel in addition to the actual TPM device side measurements. > Expose availability of TPM event log to userspace via > /sys/firmware/efi/tpm_log. If the file exists, then firmware > provided a TPM event log to kernel, and userspace init should also > queue TPM module loading and other early boot services for TPM support. > > Enables systemd to support TPM drivers as modules when rootfs is > encrypted with the TPM device. "Enabling systemd" is not an unambiguous sequence of events, as far as I know. Please describe what the changes are done to the kernel, and how they help to enable whatever systemd wants it. This is way too abstract to work as "a pitch". > > Sample output from a arm64 qemu machine with u-boot based EFI firmware > and swtpm: > > root@trs-qemuarm64:~# dmesg|grep TPMEvent > [ 0.000000] efi: TPMFinalLog=3D0xbd648040 RTPROP=3D0xbd646040 SMBIOS3.= 0=3D0xbe6ad000 TPMEventLog=3D0xbd5f9040 INITRD=3D0xbd5f7040 RNG=3D0xbd5f604= 0 MEMRESERVE=3D0xbd5f5040 > root@trs-qemuarm64:~# ls -l /sys/firmware/efi/tpm_log > -r-------- 1 root root 4096 Apr 22 10:31 /sys/firmware/efi/tpm_log > root@trs-qemuarm64:~# cat /sys/firmware/efi/tpm_log > TPMEventLog=3D0xbd5f9040 > root@trs-qemuarm64:~# cat /sys/firmware/efi/systab > SMBIOS3=3D0xbe6ad000 > > Other similar information is currently in /sys/firmware/efi/systab but > for new exported variables a one-variable-per-file sysfs interface > is preferred according to comments in systab_show() > drivers/firmware/efi/efi.c > > See also: > https://github.com/systemd/systemd/pull/32314 > https://lists.freedesktop.org/archives/systemd-devel/2024-April/050206.ht= ml > > Cc: Ilias Apalodimas > Cc: Lennart Poettering > Signed-off-by: Mikko Rapeli I'd recommend to test this also with hardware. Easy options for ARM are: 1. Raspberry Pi 3B+. It has broken TrustZone that allows supply your own payloads. OP-TEE supports this. 2. Get https://thepihut.com/products/letstrust-tpm-for-raspberry-pi. BR, Jarkko