From mboxrd@z Thu Jan 1 00:00:00 1970 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 E0282C433FE for ; Wed, 23 Nov 2022 10:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236793AbiKWKE7 (ORCPT ); Wed, 23 Nov 2022 05:04:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237256AbiKWKD6 (ORCPT ); Wed, 23 Nov 2022 05:03:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAB65D6B for ; Wed, 23 Nov 2022 01:55:23 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 8E7E6B81EE6 for ; Wed, 23 Nov 2022 09:55:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA9D6C433C1; Wed, 23 Nov 2022 09:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669197321; bh=BC/feLDf9uuu/LOj6LryDJAUfcIqCn2shR0rtyGCVSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQRwDdUf6Euw/oLYG1BeStYIBm8tjotxhPndLgNwpHt95bnyLSZaB0jzCJNZX2SYh slS1AacXGE9pEjJORTXMw9MkDVhg8hfmIAeHyzDHseRFvhXml9sDY/YGi2+mU7vYFs o26zAg86M1ntJlTMT89K0wMtEjCHOXr+q06X5NKc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 260/314] io_uring: disallow self-propelled ring polling Date: Wed, 23 Nov 2022 09:51:45 +0100 Message-Id: <20221123084637.295202598@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123084625.457073469@linuxfoundation.org> References: <20221123084625.457073469@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Pavel Begunkov commit 7fdbc5f014c3f71bc44673a2d6c5bb2d12d45f25 upstream. When we post a CQE we wake all ring pollers as it normally should be. However, if a CQE was generated by a multishot poll request targeting its own ring, it'll wake that request up, which will make it to post a new CQE, which will wake the request and so on until it exhausts all CQ entries. Don't allow multishot polling io_uring files but downgrade them to oneshots, which was always stated as a correct behaviour that the userspace should check for. Cc: stable@vger.kernel.org Fixes: aa43477b04025 ("io_uring: poll rework") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/3124038c0e7474d427538c2d915335ec28c92d21.1668785722.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/poll.c | 2 ++ 1 file changed, 2 insertions(+) --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -244,6 +244,8 @@ static int io_poll_check_events(struct i continue; if (req->apoll_events & EPOLLONESHOT) return IOU_POLL_DONE; + if (io_is_uring_fops(req->file)) + return IOU_POLL_DONE; /* multishot, just fill a CQE and proceed */ if (!(req->flags & REQ_F_APOLL_MULTISHOT)) {