• Stefano Garzarella's avatar
    io_uring: add IOURING_REGISTER_RESTRICTIONS opcode · 21b55dbc
    Stefano Garzarella authored
    The new io_uring_register(2) IOURING_REGISTER_RESTRICTIONS opcode
    permanently installs a feature allowlist on an io_ring_ctx.
    The io_ring_ctx can then be passed to untrusted code with the
    knowledge that only operations present in the allowlist can be
    executed.
    
    The allowlist approach ensures that new features added to io_uring
    do not accidentally become available when an existing application
    is launched on a newer kernel version.
    
    Currently is it possible to restrict sqe opcodes, sqe flags, and
    register opcodes.
    
    IOURING_REGISTER_RESTRICTIONS can only be made once. Afterwards
    it is not possible to change restrictions anymore.
    This prevents untrusted code from removing restrictions.
    Suggested-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
    Reviewed-by: default avatarKees Cook <keescook@chromium.org>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    21b55dbc
io_uring.c 223 KB