All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rustam Mustafin <rmustafin@cloudlinux.com>
To: Peter Huewe <peterhuewe@gmx.de>, Jarkko Sakkinen <jarkko@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Shuah Khan <shuah@kernel.org>,
	Jaewon Yang <yong010301@gmail.com>,
	linux-integrity@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Rustam Mustafin <rmustafin@cloudlinux.com>
Subject: [PATCH v3 0/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0
Date: Tue, 24 Nov 2026 21:24:30 +0700	[thread overview]
Message-ID: <20261124142432.368943-1-rmustafin@cloudlinux.com> (raw)

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


             reply	other threads:[~2026-11-24 14:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:24 Rustam Mustafin [this message]
2026-11-24 14:24 ` [PATCH v3 1/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0 Rustam Mustafin
2026-11-24 17:22   ` Jarkko Sakkinen
2026-11-25  6:54     ` Rustam Mustafin
2026-11-25  6:54       ` [PATCH v3 2/2] selftests: tpm2: test that io_uring reads are rejected Rustam Mustafin
2026-11-25 16:57         ` Jarkko Sakkinen
2026-11-25 16:58       ` [PATCH v3 1/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0 Jarkko Sakkinen
2026-11-25 17:12         ` Jarkko Sakkinen
2026-11-25 17:18           ` Jarkko Sakkinen
2026-11-26 14:08             ` Rustam Mustafin
2026-11-26 17:27               ` Jarkko Sakkinen
2026-11-24 14:24 ` [PATCH v3 2/2] selftests: tpm2: test that io_uring reads are rejected Rustam Mustafin

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=20261124142432.368943-1-rmustafin@cloudlinux.com \
    --to=rmustafin@cloudlinux.com \
    --cc=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=shuah@kernel.org \
    --cc=yong010301@gmail.com \
    /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.