From nobody Sun Sep 7 12:20:26 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 104F9C38145 for ; Fri, 2 Sep 2022 12:41:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237303AbiIBMlT (ORCPT ); Fri, 2 Sep 2022 08:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237254AbiIBMiz (ORCPT ); Fri, 2 Sep 2022 08:38:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0DD444566; Fri, 2 Sep 2022 05:30:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E41326215A; Fri, 2 Sep 2022 12:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB809C433D6; Fri, 2 Sep 2022 12:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121820; bh=jg21/zAcWtXDnw6C4rfwOyVUqIjJj4LhRlaz0D8/GT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f/w6eqSiR1xA9GRJ2pYbx0/Ukp0CYoOEvDXUKtBjoBI13knHP5B+l1l/6CZHWcr/I QBNel3q/nIDlZVhUBZueyyQnEglhaM8cDbAXAP1EeFVOwPbtn90WOoWH6XtUycPp7M lUQZnhEtyLJfoaw8d3zeywTK/9L6qBeSyOGzeQ+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Pavel Begunkov Subject: [PATCH 5.4 75/77] io_uring: disable polling pollfree files Date: Fri, 2 Sep 2022 14:19:24 +0200 Message-Id: <20220902121406.177903979@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov 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: 221c5eb233823 ("io_uring: add support for IORING_OP_POLL") Signed-off-by: Pavel Begunkov Signed-off-by: Greg Kroah-Hartman --- drivers/android/binder.c | 1 + fs/io_uring.c | 3 +++ fs/signalfd.c | 1 + include/linux/fs.h | 1 + 4 files changed, 6 insertions(+) --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -6083,6 +6083,7 @@ const struct file_operations binder_fops .open =3D binder_open, .flush =3D binder_flush, .release =3D binder_release, + .may_pollfree =3D true, }; =20 static int __init init_binder_device(const char *name) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1908,6 +1908,9 @@ static int io_poll_add(struct io_kiocb * __poll_t mask; u16 events; =20 + if (req->file->f_op->may_pollfree) + return -EOPNOTSUPP; + if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL)) return -EINVAL; if (sqe->addr || sqe->ioprio || sqe->off || sqe->len || sqe->buf_index) --- a/fs/signalfd.c +++ b/fs/signalfd.c @@ -248,6 +248,7 @@ static const struct file_operations sign .poll =3D signalfd_poll, .read =3D signalfd_read, .llseek =3D noop_llseek, + .may_pollfree =3D true, }; =20 static int do_signalfd4(int ufd, sigset_t *mask, int flags) --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1859,6 +1859,7 @@ struct file_operations { struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags); int (*fadvise)(struct file *, loff_t, loff_t, int); + bool may_pollfree; } __randomize_layout; =20 struct inode_operations {