Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp485997imn; Wed, 27 Jul 2022 11:32:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vXrkY6xmpls8q0gVx365SHqEKQaQ1EsEljz8ibH9DQyY0pJ3ZaJ1qnApT/nWGvibii1CTt X-Received: by 2002:a17:907:c0d:b0:72b:d0b0:2b55 with SMTP id ga13-20020a1709070c0d00b0072bd0b02b55mr18799494ejc.110.1658946722653; Wed, 27 Jul 2022 11:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946722; cv=none; d=google.com; s=arc-20160816; b=PlgETtwPdVXueinbaXp9AN2ieAC0RKOcbSxrbzQMguU+445+iZzomD/yJsvA0V3YQI Lhj7wZKEO6cGSGgeiF3BvfXBrFMfUT1s0yikn/xLu9i6PBjBXZo736HcKUzAHb5py+Id KaQkQPs9OcBarJZzY/GfWX5fRQfbiaDrBdg4R42uTUukujti4oTwTdLdifaHhovZiyxE kknoZZkUltcOuV7B5Wsk82JE3BSLjwB3KGfKulmfZpS9IID/rJIFJkdNJctcO16sdyoq RosFDayTUeM0zNy8vQ81bgxW/U67ZBl6l/mXH7hoyFrxK2CxTiTfsPQtrxn8vOIZZCZk Qxhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qBgTYq3jA2nEqZyXzt3fAlKNmFTdcP+LWxqkISGuEMM=; b=DAz6VN4KV/We2ExZ7E4Qr0dqudjFm/FXaQt42rmQGoWTicmVWNFsaKfV+bjElwMFcp M86pF11fnUwcF1cnp4NzZVW+DIBYxLa8hQI+AQ6EjPKUyv9WZbvAUKgITvN0JCqmV7rA 4ZCx+0VaMwZWs7rXcG5xGvvScdHY6By7KrnUANPwBuDPWlWifZxlbOdPK/myGsx8l8U6 4GBABAwH6MEic8dtt5AV7YO3QEsJVV82PR62PlHNF7GdZz41GCLCjrXhzum0LD6TfaWS FBOqRHJrb6EqabdAk//vv7QQHEz64DGXdQTzUxsiRFyjcpI0y9obLZLoXjpEEP72Q1D5 59vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ys3SfmOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr2-20020a170906d54200b0072b68ed1a49si5600690ejc.870.2022.07.27.11.31.37; Wed, 27 Jul 2022 11:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ys3SfmOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240513AbiG0Qtp (ORCPT + 99 others); Wed, 27 Jul 2022 12:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240449AbiG0Qsj (ORCPT ); Wed, 27 Jul 2022 12:48:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5162561131; Wed, 27 Jul 2022 09:32:33 -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 ams.source.kernel.org (Postfix) with ESMTPS id C6710B821D0; Wed, 27 Jul 2022 16:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CBECC433D6; Wed, 27 Jul 2022 16:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658939550; bh=0u1Q4T/coKPKlkRYB8LRz3wU3+rbSCklXjpL4Hkyeds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ys3SfmOY2ZvQtjqUamZWdKV5Ai9f1+MyiFzgLiLCVQgg+1LSk9LoQIr8HkEqsmZaQ 5mbzv3Wt/0Sf+pjZKxgmQxJ36doXCuTfRH9i2dI1UV1G4kt/MFlB86O9SCt7RRB35e awjfyazj1clVvp84IIPHLaRUD3Q6nRmF8fjQzODA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, lee@kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , Pavel Begunkov , Alexander Viro , io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 5.10 005/105] io_uring: Use original task for req identity in io_identity_cow() Date: Wed, 27 Jul 2022 18:09:51 +0200 Message-Id: <20220727161012.279068616@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161012.056867467@linuxfoundation.org> References: <20220727161012.056867467@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lee Jones This issue is conceptually identical to the one fixed in 29f077d07051 ("io_uring: always use original task when preparing req identity"), so rather than reinvent the wheel, I'm shamelessly quoting the commit message from that patch - thanks Jens: "If the ring is setup with IORING_SETUP_IOPOLL and we have more than one task doing submissions on a ring, we can up in a situation where we assign the context from the current task rather than the request originator. Always use req->task rather than assume it's the same as current. No upstream patch exists for this issue, as only older kernels with the non-native workers have this problem." Cc: Jens Axboe Cc: Pavel Begunkov Cc: Alexander Viro Cc: io-uring@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org Fixes: 5c3462cfd123b ("io_uring: store io_identity in io_uring_task") Signed-off-by: Lee Jones Signed-off-by: Greg Kroah-Hartman --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -1325,7 +1325,7 @@ static void io_req_clean_work(struct io_ */ static bool io_identity_cow(struct io_kiocb *req) { - struct io_uring_task *tctx = current->io_uring; + struct io_uring_task *tctx = req->task->io_uring; const struct cred *creds = NULL; struct io_identity *id;