blob: 3f0db4325c5efb3c0f13e78d27eb01de8e3fa87c [file] [log] [blame]
# Copyright 2021 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Chromium OS tpm2-simulator daemon"
author "chromium-os-dev@chromium.org"
stop on stopping boot-services and stopped trunksd
# This daemon should very unlikely to be killed by the OOM killer otherwise
# the other TPM related daemons(trunksd/chapsd/cryptohomed...) may crash.
oom score -100
# The limit for this task is 1000MB.
limit as 1000000000 unlimited
respawn
# mount-encrypted need this TPM simulator to create the encstateful, and
# the TPM simulator need to store its data in the persistent location.
env SIMULATOR_DIR=/mnt/stateful_partition/unencrypted/tpm2-simulator
env DEV_VTPMX=/dev/vtpmx
pre-start script
modprobe tpm_vtpm_proxy
mkdir -p -m 755 "${SIMULATOR_DIR}"
chown -R tpm2-simulator:tpm2-simulator "${SIMULATOR_DIR}"
end script
expect stop
# We would initialize the minijail seccomp when this daemon is already started.
# And it need root permission to create vTPM device.
exec /usr/bin/tpm2-simulator
post-start exec /usr/bin/tpm2-simulator-init
pre-stop exec /usr/bin/tpm2-simulator-stop