• Pavel Begunkov's avatar
    io_uring: fix {SQ,IO}POLL with unsupported opcodes · 3232dd02
    Pavel Begunkov authored
    IORING_SETUP_IOPOLL is defined only for read/write, other opcodes should
    be disallowed, otherwise it'll get an error as below. Also refuse
    open/close with SQPOLL, as the polling thread wouldn't know which file
    table to use.
    
    RIP: 0010:io_iopoll_getevents+0x111/0x5a0
    Call Trace:
     ? _raw_spin_unlock_irqrestore+0x24/0x40
     ? do_send_sig_info+0x64/0x90
     io_iopoll_reap_events.part.0+0x5e/0xa0
     io_ring_ctx_wait_and_kill+0x132/0x1c0
     io_uring_release+0x20/0x30
     __fput+0xcd/0x230
     ____fput+0xe/0x10
     task_work_run+0x67/0xa0
     do_exit+0x353/0xb10
     ? handle_mm_fault+0xd4/0x200
     ? syscall_trace_enter+0x18c/0x2c0
     do_group_exit+0x43/0xa0
     __x64_sys_exit_group+0x18/0x20
     do_syscall_64+0x60/0x1e0
     entry_SYSCALL_64_after_hwframe+0x44/0xa9
    Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
    [axboe: allow provide/remove buffers and files update]
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    3232dd02
io_uring.c 193 KB