Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 860D6C4338F for ; Mon, 2 Aug 2021 11:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C4BE60FC2 for ; Mon, 2 Aug 2021 11:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbhHBLhh (ORCPT ); Mon, 2 Aug 2021 07:37:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:39466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233255AbhHBLhg (ORCPT ); Mon, 2 Aug 2021 07:37:36 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 252D060F4B; Mon, 2 Aug 2021 11:37:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627904247; bh=aIODNLyimMurh3rZSZ3kal7It5jhD1KsNeQcM7A8pJg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DWPPnVO4xhpesVVzXsmwc0Vwq8ENEox2IuHMCOkeTAzhLGVx7OExk+vBMbbo+mBsM Y5D5H/AvnH6EmdHYcag92b9BQlp76qeTyuhLFJfTeba4inTQHRuaVJYw1Co0gN14M0 GnfI8ewQ5ZyOy37VEf8bzlp16+RSPbPJVZCw4hxo= Date: Mon, 2 Aug 2021 13:37:25 +0200 From: Greg KH To: Jens Axboe Cc: forza@tnonline.net, stable@vger.kernel.org Subject: Re: FAILED: patch "[PATCH] io_uring: fix race in unified task_work running" failed to apply to 5.13-stable tree Message-ID: References: <162771380065153@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Sat, Jul 31, 2021 at 08:44:33AM -0600, Jens Axboe wrote: > On 7/31/21 12:43 AM, gregkh@linuxfoundation.org wrote: > > > > The patch below does not apply to the 5.13-stable tree. > > If someone wants it applied there, or to any other stable or longterm > > tree, then please email the backport, including the original git commit > > id to . > > Here's a tested 5.13-stable port. > > From: Jens Axboe > Subject: io_uring: fix race in unified task_work running > > commit 110aa25c3ce417a44e35990cf8ed22383277933a upstream. > > We use a bit to manage if we need to add the shared task_work, but > a list + lock for the pending work. Before aborting a current run > of the task_work we check if the list is empty, but we do so without > grabbing the lock that protects it. This can lead to races where > we think we have nothing left to run, where in practice we could be > racing with a task adding new work to the list. If we do hit that > race condition, we could be left with work items that need processing, > but the shared task_work is not active. > > Ensure that we grab the lock before checking if the list is empty, > so we know if it's safe to exit the run or not. > > Link: https://lore.kernel.org/io-uring/c6bd5987-e9ae-cd02-49d0-1b3ac1ef65b1@tnonline.net/ > Cc: stable@vger.kernel.org # 5.11+ > Reported-by: Forza > Tested-by: Forza Now queued up, thanks! greg k-h