From: Jon Mason <jdmason@kudzu.us>
To: meta-arm@lists.yoctoproject.org
Cc: Mikko Rapeli <mikko.rapeli@linaro.org>
Subject: [PATCH v7 2/4] arm/optee-client: fix systemd service dependencies
Date: Thu, 26 Sep 2024 11:47:37 -0400 [thread overview]
Message-ID: <20240926154739.2379609-3-jon.mason@arm.com> (raw)
In-Reply-To: <20240926154739.2379609-1-jon.mason@arm.com>
From: Mikko Rapeli <mikko.rapeli@linaro.org>
udev starts tee-supplicant once optee has been found.
Fix dependencies in systemd service so that starting it in
initrd is possible. Stopping requires that ftpm
kernel module is disabled or any TPM related actions will fail until
the next reboot so working around these in the service file. These
are limitations of current kernel optee and ftpm drivers.
tpm2.target requires systemd 256 or newer. With older system version
there is no simple way to queue in service before TPM device is
available.
https://www.freedesktop.org/software/systemd/man/devel/systemd.special.html#tpm2.target
Note that
https://www.freedesktop.org/software/systemd/man/devel/systemd-tpm2-generator.html
detects TPM support from either existing kernel driver (built in or
loaded really early in initrd and rootfs boot) or ACPI table entry for
TPM device. If firmware used a TPM device but doesn't provide ACPI table
entry for it, then a kernel patch has been proposed to expose this to
userspace:
https://lore.kernel.org/lkml/20240422112711.362779-1-mikko.rapeli@linaro.org/
and matching change proposal for systemd:
https://github.com/systemd/systemd/pull/32400
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
.../optee/optee-client/tee-supplicant@.service | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/meta-arm/recipes-security/optee/optee-client/tee-supplicant@.service b/meta-arm/recipes-security/optee/optee-client/tee-supplicant@.service
index 72c0b9aa57ec..8325b6be5174 100644
--- a/meta-arm/recipes-security/optee/optee-client/tee-supplicant@.service
+++ b/meta-arm/recipes-security/optee/optee-client/tee-supplicant@.service
@@ -1,10 +1,12 @@
[Unit]
Description=TEE Supplicant on %i
+DefaultDependencies=no
+After=dev-%i.device
+Wants=dev-%i.device
+Conflicts=shutdown.target
+Before=tpm2.target sysinit.target shutdown.target
[Service]
-User=root
EnvironmentFile=-@sysconfdir@/default/tee-supplicant
ExecStart=@sbindir@/tee-supplicant $OPTARGS
-
-[Install]
-WantedBy=basic.target
+ExecStop=-/bin/sh -c "/sbin/modprobe -v -r tpm_ftpm_tee ; /bin/kill $MAINPID"
--
2.39.5
next prev parent reply other threads:[~2024-09-26 15:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 15:47 [PATCH v7 0/4] UEFI secureboot Jon Mason
2024-09-26 15:47 ` [PATCH v7 1/4] arm/optee: Add optee udev rules Jon Mason
2024-09-26 15:47 ` Jon Mason [this message]
2024-09-26 15:47 ` [PATCH v7 3/4] arm: Enable Secure Boot in all required recipes Jon Mason
2024-09-26 15:47 ` [PATCH v7 4/4] arm/qemuarm64-secureboot: Enable UEFI Secure Boot Jon Mason
2024-09-26 15:55 ` [meta-arm] [PATCH v7 0/4] UEFI secureboot Javier Tia
2024-09-26 16:35 ` Jon Mason
2024-09-26 15:58 ` Mikko Rapeli
2024-09-26 16:37 ` Jon Mason
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240926154739.2379609-3-jon.mason@arm.com \
--to=jdmason@kudzu.us \
--cc=meta-arm@lists.yoctoproject.org \
--cc=mikko.rapeli@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.