From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Jason Andryuk <jandryuk@gmail.com>
Cc: xen-devel@lists.xenproject.org,
Daniel De Graaf <dgdegra@tycho.nsa.gov>,
Quan Xu <quan.xu0@gmail.com>
Subject: Re: [PATCH 8/9] vtpmmgr: Shutdown more gracefully
Date: Tue, 4 May 2021 15:18:42 +0200 [thread overview]
Message-ID: <20210504131842.cas3s2rpd4cvr46q@begin> (raw)
In-Reply-To: <20210504124842.220445-9-jandryuk@gmail.com>
Jason Andryuk, le mar. 04 mai 2021 08:48:41 -0400, a ecrit:
> vtpmmgr uses the default, weak app_shutdown, which immediately calls the
> shutdown hypercall. This short circuits the vtpmmgr clean up logic. We
> need to perform the clean up to actually Flush our key out of the tpm.
>
> Setting do_shutdown is one step in that direction, but vtpmmgr will most
> likely be waiting in tpmback_req_any. We need to call shutdown_tpmback
> to cancel the wait inside tpmback and perform the shutdown.
>
> Signed-off-by: Jason Andryuk <jandryuk@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibaut@ens-lyon.org>
> ---
> stubdom/vtpmmgr/vtpmmgr.c | 12 +++++++++++-
> 1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/stubdom/vtpmmgr/vtpmmgr.c b/stubdom/vtpmmgr/vtpmmgr.c
> index 9fddaa24f8..46ea018921 100644
> --- a/stubdom/vtpmmgr/vtpmmgr.c
> +++ b/stubdom/vtpmmgr/vtpmmgr.c
> @@ -67,11 +67,21 @@ int hw_is_tpm2(void)
> return (hardware_version.hw_version == TPM2_HARDWARE) ? 1 : 0;
> }
>
> +static int do_shutdown;
> +
> +void app_shutdown(unsigned int reason)
> +{
> + printk("Shutdown requested: %d\n", reason);
> + do_shutdown = 1;
> +
> + shutdown_tpmback();
> +}
> +
> void main_loop(void) {
> tpmcmd_t* tpmcmd;
> uint8_t respbuf[TCPA_MAX_BUFFER_LENGTH];
>
> - while(1) {
> + while (!do_shutdown) {
> /* Wait for requests from a vtpm */
> vtpmloginfo(VTPM_LOG_VTPM, "Waiting for commands from vTPM's:\n");
> if((tpmcmd = tpmback_req_any()) == NULL) {
> --
> 2.30.2
>
next prev parent reply other threads:[~2021-05-04 13:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-04 12:48 [PATCH 0/9] vtpmmgr: Some fixes - still incomplete Jason Andryuk
2021-05-04 12:48 ` [PATCH 1/9] docs: Warn about incomplete vtpmmgr TPM 2.0 support Jason Andryuk
2021-05-04 17:55 ` Andrew Cooper
2021-05-07 15:31 ` Daniel P. Smith
2021-05-04 12:48 ` [PATCH 2/9] vtpmmgr: Print error code to aid debugging Jason Andryuk
2021-05-04 13:03 ` Samuel Thibault
2021-05-07 15:33 ` Daniel P. Smith
2021-05-04 12:48 ` [PATCH 3/9] stubom: newlib: Enable C99 formats for %z Jason Andryuk
2021-05-04 13:08 ` Samuel Thibault
2021-05-07 15:37 ` Daniel P. Smith
2021-05-04 12:48 ` [PATCH 4/9] vtpmmgr: Allow specifying srk_handle for TPM2 Jason Andryuk
2021-05-04 13:13 ` Samuel Thibault
2021-05-04 17:04 ` Jason Andryuk
2021-05-04 17:07 ` Samuel Thibault
2021-05-04 17:27 ` Jason Andryuk
2021-05-04 17:48 ` Samuel Thibault
2021-05-04 12:48 ` [PATCH 5/9] vtpmmgr: Move vtpmmgr_shutdown Jason Andryuk
2021-05-04 13:14 ` Samuel Thibault
2021-05-04 12:48 ` [PATCH 6/9] vtpmmgr: Flush transient keys on shutdown Jason Andryuk
2021-05-04 13:15 ` Samuel Thibault
2021-05-04 12:48 ` [PATCH 7/9] vtpmmgr: Flush all transient keys Jason Andryuk
2021-05-04 13:16 ` Samuel Thibault
2021-05-04 17:05 ` Jason Andryuk
2021-05-04 17:07 ` Samuel Thibault
2021-05-04 12:48 ` [PATCH 8/9] vtpmmgr: Shutdown more gracefully Jason Andryuk
2021-05-04 13:18 ` Samuel Thibault [this message]
2021-05-04 12:48 ` [PATCH 9/9] vtpmmgr: Support GetRandom passthrough on TPM 2.0 Jason Andryuk
2021-05-04 13:33 ` Samuel Thibault
2021-05-04 17:23 ` Jason Andryuk
2021-05-04 17:47 ` Samuel Thibault
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=20210504131842.cas3s2rpd4cvr46q@begin \
--to=samuel.thibault@ens-lyon.org \
--cc=dgdegra@tycho.nsa.gov \
--cc=jandryuk@gmail.com \
--cc=quan.xu0@gmail.com \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).