Skip to content

ublk_drv: add mechanism for supporting unprivileged ublk device

Ming Lei linux-block oe-kbuild-all 4 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 4 repliesApplied
  2. v36 patches 5 repliesSuperseded
  3. v26 patches 5 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches5 repliesSuperseded

Changes in v4 from the cover letter

- only allow to create unprivileged udev for current user, as suggested by Jonathan Corbet
- fix misc bug for handling failure
- add detailed document
- update userspace

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/6ublk_drv: remove nr_aborted_queues from ublk_devicedrivers/block/ublk_drv.c+0 -10 replies
2/6ublk_drv: don't probe partitions if the ubq daemon isn't trusteddrivers/block/ublk_drv.c+9 -00 replies
3/6ublk_drv: move ublk_get_device_from_id into ublk_ctrl_uring_cmddrivers/block/ublk_drv.c+49 -890 replies
4/6ublk_drv: add device parameter UBLK_PARAM_TYPE_DEVTdrivers/block/ublk_drv.c include/uapi/linux/ublk_cmd.h+36 -10 replies
5/6ublk_drv: add module parameter of ublks_max for limiting max allowed ublk devdrivers/block/ublk_drv.c+19 -00 replies
6/6ublk_drv: add mechanism for supporting unprivileged ublk deviceDocumentation/block/ublk.rst drivers/block/ublk_drv.c include/uapi/linux/ublk_cmd.h+220 -170 replies

Reviews trailers per patch

4 of 6 patches have a Reviewed-by or Acked-by.

PatchZiyangZhang
1/6R-b
2/6R-b
3/6R-b
4/6
5/6R-b
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH V4 0/6] ublk_drv: add mechanism for supporting unprivileged ublk device

Hello,

Stefan Hajnoczi suggested un-privileged ublk device[1] for container use case.

So far only administrator can create/control ublk device which is too strict and increase system administrator burden, and this patchset implements un-privileged ublk device:

- any user can create ublk device, which can only be controlled & accessed by the owner of the device or administrator

For using such mechanism, system administrator needs to deploy two simple udev rules[2] after running 'make install' in ublksrv.

Userspace(ublksrv):

https://github.com/ming1/ubdsrv/tree/unprivileged-ublk

'ublk add -t $TYPE --un_privileged' is for creating one un-privileged ublk device if the user is un-privileged.

[1] https://lore.kernel.org/linux-block/[email protected]/
[2] https://github.com/ming1/ubdsrv/blob/unprivileged-ublk/README.rst#un-privileged-mode

V4:
- only allow to create unprivileged udev for current user, as suggested by Jonathan Corbet
- fix misc bug for handling failure
- add detailed document
- update userspace

V3:
- don't warn on invalid user input for setting devt parameter, as suggested by Ziyang, patch 4/6
- fix one memory corruption issue, patch 6/6

V2:
- fix "ublk_ctrl_uring_cmd_permission() error: uninitialized symbol 'mask'", reported by Dan Carpenter' test robot
- address Ziyang's comment on dealing with nr_privileged_daemon

Ming Lei (6):
ublk_drv: remove nr_aborted_queues from ublk_device
ublk_drv: don't probe partitions if the ubq daemon isn't trusted
ublk_drv: move ublk_get_device_from_id into ublk_ctrl_uring_cmd
ublk_drv: add device parameter UBLK_PARAM_TYPE_DEVT
ublk_drv: add module parameter of ublks_max for limiting max allowed
ublk dev
ublk_drv: add mechanism for supporting unprivileged ublk device

 Documentation/block/ublk.rst  |  49 ++++-
 drivers/block/ublk_drv.c      | 341 ++++++++++++++++++++++++----------
 include/uapi/linux/ublk_cmd.h |  49 ++++-
 3 files changed, 332 insertions(+), 107 deletions(-)
Signature · 1 line
2.31.1