Skip to content

Restrict the uring_cmd command multiplexer? #65

Description

@gnoack

file->f_op->uring_cmd is a generic command multiplexer through which files can implement file-specific commands.

This is similar to ioctl(2) in that sense, although the command numbers have a different namespace.
We should maybe restrict that, similarly as we have done it for IOCTLs with LANDLOCK_ACCESS_FS_IOCTL_DEV.

This was brought up by Bryam Vargas in https://lore.kernel.org/all/20260616201633.275067-1-hexlabsecurity@proton.me/ (and the follow-up discussion). There can be overlaps between uring_cmd commands and IOCTL commands, as it was pointed out there for BLOCK_URING_CMD_DISCARD and ioctl(BLKDISCARD). In the case of such commands, it might be surprising that they are blocked when used through IOCTL but work when used through io_uring.

Another alternative approach would be to block the creation of an io_uring altogether, through a Landlock policy. That would be a coarser control, but maybe good enough for the start, for the majority of use cases?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions