All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] rpmb: add virtio RPMB driver
@ 2026-10-29 12:41 ` Haruka Kuze via OP-TEE
  0 siblings, 0 replies; 8+ messages in thread
From: Haruka Kuze @ 2026-10-29 12:41 UTC (permalink / raw)
  To: Jens Wiklander, Michael S . Tsirkin
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Jason Wang, Eugenio Pérez,
	Xuan Zhuo, Sumit Garg, Alex Bennée, Tomas Winkler,
	Ulf Hansson, Harald Mommer, virtualization, op-tee, linux-kernel

This adds a driver on top of the rpmb subsystem for virtio-rpmb devices.

Alex Bennée had an earlier virtio-rpmb driver in his RPMB series [1]
but that stalled due to the user space API.

The one that merged later has no user space API and OP-TEE routes frames
through it so this driver only needs to implement route_frames().

I added patch 1 to fix a use-after-free that I hit while testing
removing the device (OP-TEE can still route frames after driver unregisters
the rpmb device).

I tested this with UML (virtio_uml) and a vhost-user backend I wrote
for this on top of rust-vmm's vhost-device with KASAN, lockdep:

 - key programming
 - write counter
 - single and multi block write and read
 - MAC and counter failures
 - max_wr_cnt
 - unbinding the driver when the rpmb device is held

With OP-TEE 4.11 on QEMU virt arm64 the secure_storage example TA keeps
its objects in RPMB through the driver and an object written to in one
boot is found in the one after.

I have added myself in MAINTAINERS. I would like to maintain the driver.

Changes in v2:
- Use guard() and scoped_guard() for the locks in both patches (Greg)
- Call virtio_device_ready() before vr->vq is set, so a request on
  restore can not kick the queue before DRIVER_OK (sashiko)
- v1: https://lore.kernel.org/all/20261029081317.2264887-1-harukak@zohomail.eu/

- haruka

[1] https://lore.kernel.org/all/20220405093759.1126835-1-alex.bennee@linaro.org/

Haruka Kuze (2):
  rpmb: stop the routing after unregister
  rpmb: add a virtio RPMB device driver

 MAINTAINERS                      |   7 +
 drivers/misc/Kconfig             |  10 ++
 drivers/misc/Makefile            |   1 +
 drivers/misc/rpmb-core.c         |  14 +-
 drivers/misc/virtio_rpmb.c       | 286 +++++++++++++++++++++++++++++++
 include/linux/rpmb.h             |   4 +
 include/uapi/linux/virtio_rpmb.h |  56 ++++++
 7 files changed, 377 insertions(+), 1 deletion(-)
 create mode 100644 drivers/misc/virtio_rpmb.c
 create mode 100644 include/uapi/linux/virtio_rpmb.h


base-commit: c339f4010dea8b0d754f84ace70cd1b089878ef8
-- 
2.55.0


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

end of thread, other threads:[~2026-10-29 13:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 12:41 [PATCH v2 0/2] rpmb: add virtio RPMB driver Haruka Kuze
2026-10-29 12:41 ` Haruka Kuze via OP-TEE
2026-10-29 12:41 ` [PATCH v2 1/2] rpmb: stop the routing after unregister Haruka Kuze
2026-10-29 12:41   ` Haruka Kuze via OP-TEE
2026-10-29 12:47   ` sashiko-bot
2026-10-29 12:41 ` [PATCH v2 2/2] rpmb: add a virtio RPMB device driver Haruka Kuze
2026-10-29 12:41   ` Haruka Kuze via OP-TEE
2026-10-29 13:00   ` sashiko-bot

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.