From: Stefan Berger <stefanb@linux.ibm.com>
To: qemu-devel@nongnu.org
Cc: berrange@redhat.com, marcandre.lureau@gmail.com,
Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH v2 0/2] tpm: Resolve potential blocking-forever issue
Date: Wed, 16 Oct 2024 09:34:48 -0400 [thread overview]
Message-ID: <20241016133450.1071197-1-stefanb@linux.ibm.com> (raw)
In case swtpm was to return a control channel message with an error code it
would only return 4 bytes. However, some of the commands expect a response
with more bytes and QEMU would get stuck in qemu_chr_fe_read_all() waiting
for bytes following the error code. Therefore, read the response in 2
passes stopping if an error code is received in the first 4 bytes to avoid
getting stuck. Implement an exception for CMD_GET_STATEBLOB that has always
been sending the header in case of error.
Stefan
v2:
-
Stefan Berger (2):
tpm: Use new ptm_cap_n structure for PTM_GET_CAPABILITY
tpm_emulator: Read control channel response in 2 passes
backends/tpm/tpm_emulator.c | 45 ++++++++++++++++++++++++++++++-------
backends/tpm/tpm_ioctl.h | 13 ++++++++++-
backends/tpm/trace-events | 2 +-
3 files changed, 50 insertions(+), 10 deletions(-)
--
2.47.0
next reply other threads:[~2024-10-16 13:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-16 13:34 Stefan Berger [this message]
2024-10-16 13:34 ` [PATCH v2 1/2] tpm: Use new ptm_cap_n structure for PTM_GET_CAPABILITY Stefan Berger
2024-10-16 13:34 ` [PATCH v2 2/2] tpm_emulator: Read control channel response in 2 passes Stefan Berger
2024-10-16 14:31 ` [PATCH v2 0/2] tpm: Resolve potential blocking-forever issue Stefan Berger
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=20241016133450.1071197-1-stefanb@linux.ibm.com \
--to=stefanb@linux.ibm.com \
--cc=berrange@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=qemu-devel@nongnu.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).