Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fc78b2fc authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Greg Kroah-Hartman
Browse files

io_uring: disable polling pollfree files



Older kernels lack io_uring POLLFREE handling. As only affected files
are signalfd and android binder the safest option would be to disable
polling those files via io_uring and hope there are no users.

Fixes: 221c5eb2 ("io_uring: add support for IORING_OP_POLL")
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b474ff1b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -6083,6 +6083,7 @@ const struct file_operations binder_fops = {
	.open = binder_open,
	.open = binder_open,
	.flush = binder_flush,
	.flush = binder_flush,
	.release = binder_release,
	.release = binder_release,
	.may_pollfree = true,
};
};


static int __init init_binder_device(const char *name)
static int __init init_binder_device(const char *name)
+3 −0
Original line number Original line Diff line number Diff line
@@ -1908,6 +1908,9 @@ static int io_poll_add(struct io_kiocb *req, const struct io_uring_sqe *sqe)
	__poll_t mask;
	__poll_t mask;
	u16 events;
	u16 events;


	if (req->file->f_op->may_pollfree)
		return -EOPNOTSUPP;

	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
	if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
		return -EINVAL;
		return -EINVAL;
	if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
	if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index)
+1 −0
Original line number Original line Diff line number Diff line
@@ -248,6 +248,7 @@ static const struct file_operations signalfd_fops = {
	.poll		= signalfd_poll,
	.poll		= signalfd_poll,
	.read		= signalfd_read,
	.read		= signalfd_read,
	.llseek		= noop_llseek,
	.llseek		= noop_llseek,
	.may_pollfree	= true,
};
};


static int do_signalfd4(int ufd, sigset_t *mask, int flags)
static int do_signalfd4(int ufd, sigset_t *mask, int flags)
+1 −0
Original line number Original line Diff line number Diff line
@@ -1859,6 +1859,7 @@ struct file_operations {
				   struct file *file_out, loff_t pos_out,
				   struct file *file_out, loff_t pos_out,
				   loff_t len, unsigned int remap_flags);
				   loff_t len, unsigned int remap_flags);
	int (*fadvise)(struct file *, loff_t, loff_t, int);
	int (*fadvise)(struct file *, loff_t, loff_t, int);
	bool may_pollfree;
} __randomize_layout;
} __randomize_layout;


struct inode_operations {
struct inode_operations {