The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH v3 0/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0
@ 2026-11-24 14:24 Rustam Mustafin
  2026-11-24 14:24 ` [PATCH v3 1/2] " Rustam Mustafin
  2026-11-24 14:24 ` [PATCH v3 2/2] selftests: tpm2: test that io_uring reads are rejected Rustam Mustafin
  0 siblings, 2 replies; 4+ messages in thread
From: Rustam Mustafin @ 2026-11-24 14:24 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Jason Gunthorpe, Shuah Khan, Jaewon Yang, linux-integrity,
	linux-kselftest, linux-kernel, Rustam Mustafin

io_uring passes its own file offset to the TPM character devices despite
nonseekable_open(), and its asynchronous requests do not fit the single
command and response per open file. Patch 1 rejects io_uring and AIO with
-EIO. Patch 2 adds the selftest and replaces the separate selftest
patch [1].

The series applies on top of "tpm: Track the response read position
internally" [2].

preadv2() and pwritev2() with RWF_SYNC, RWF_DSYNC, RWF_APPEND or
RWF_NOAPPEND now succeed and ignore the flag, instead of failing with
-EOPNOTSUPP.

Tested with swtpm in QEMU: the tpm2 selftests pass, and the new one fails
without patch 1.

Changes in v3:
- squash the selftest into this series, SPDX GPL-2.0-only (Jarkko)
- keep tpm_common_read_iter() and tpm_common_write_iter() non-static:
  like tpm_common_read() and tpm_common_write(), they are used in
  tpm-dev.c and tpmrm-dev.c (Jarkko)

Changes in v2:
- open the message with the use case, rewrap (Jarkko)
- drop the CONFIG_IO_URING guards (Jarkko)
- drop Suggested-by

[1] https://lore.kernel.org/all/20261123165638.2161305-1-rmustafin@cloudlinux.com/
[2] https://lore.kernel.org/all/20261120121614.978396-2-rmustafin@cloudlinux.com/
v2: https://lore.kernel.org/all/20261123173321.2363162-1-rmustafin@cloudlinux.com/
v1: https://lore.kernel.org/all/20261120142116.1630010-1-rmustafin@cloudlinux.com/

Rustam Mustafin (2):
  tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0
  selftests: tpm2: test that io_uring reads are rejected

 drivers/char/tpm/tpm-dev-common.c          | 70 +++++++++++++++++++++
 drivers/char/tpm/tpm-dev.c                 |  2 +
 drivers/char/tpm/tpm-dev.h                 |  2 +
 drivers/char/tpm/tpmrm-dev.c               |  2 +
 tools/testing/selftests/tpm2/Makefile      |  2 +-
 tools/testing/selftests/tpm2/test_uring.sh | 15 +++++
 tools/testing/selftests/tpm2/tpm2_tests.py | 72 ++++++++++++++++++++++
 7 files changed, 164 insertions(+), 1 deletion(-)
 create mode 100755 tools/testing/selftests/tpm2/test_uring.sh

-- 
2.52.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-24 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 14:24 [PATCH v3 0/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0 Rustam Mustafin
2026-11-24 14:24 ` [PATCH v3 1/2] " Rustam Mustafin
2026-11-24 17:22   ` Jarkko Sakkinen
2026-11-24 14:24 ` [PATCH v3 2/2] selftests: tpm2: test that io_uring reads are rejected Rustam Mustafin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox