Re: [PATCH v3 1/2] tpm: Do not allow io_uring for /dev/tpm0 and /dev/tpmrm0

From: Jarkko Sakkinen

Date: Wed Nov 25 2026 - 11:59:05 EST


On Wed, Nov 25, 2026 at 01:54:28PM +0700, Rustam Mustafin wrote:
> io_uring passes its own file offset to the TPM character devices, although
> they are opened with nonseekable_open(): IORING_OP_READ copies sqe->off
> into ki_pos without checking FMODE_PREAD. The devices also keep a single
> command and response per open file, which does not fit asynchronous
> requests.
>
> Add tpm_common_read_iter() and tpm_common_write_iter(), which fail io_uring
> and AIO requests with -EIO. A multishot read uses a synchronous kiocb, so
> also reject IOCB_NOWAIT and io-wq workers. The callbacks call
> tpm_common_read() and tpm_common_write() once per iovec, so readv() can
> still split a response into the header and the body.
>
> Signed-off-by: Rustam Mustafin <rmustafin@xxxxxxxxxxxxxx>

Checkpatch with strict afaik already complains about assisted-by and
it is not a discussion topic for me. I make people do enough effort
to the patches so that they can call them of their own :-)

Br, Jarkko