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 X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 C882FC433DF for ; Tue, 11 Aug 2020 14:21:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A521F20768 for ; Tue, 11 Aug 2020 14:21:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="nIVENNEC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728821AbgHKOVR (ORCPT ); Tue, 11 Aug 2020 10:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728516AbgHKOVP (ORCPT ); Tue, 11 Aug 2020 10:21:15 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619D6C06174A for ; Tue, 11 Aug 2020 07:21:15 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id q19so536506pll.0 for ; Tue, 11 Aug 2020 07:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kpp0GdsRYi0omTcELeAUu1IMsTjPcKqE7Mbm6MS6NsM=; b=nIVENNECr3scMV3Vs0Pk19gB4ND0y15sXhPBCf6HIrSOLZcwArP5jkRsMgiiQTGGTT K0gMxPkFjppSFqMHHcUessGfQrn6yLDwJVujYkXTbgWxsrBk81BWCRbILztlDnoLnIeC BpyLr590T6RGyyAtJD9fxl1IUWlqdwNvb5Ln8ftjU4NOEtRmEp3zQx5JmssgcR4DzXi8 Mp19H0InTGtz41UCno+m+z6cPqH/ruxaU9dY8w9qr1hSyROsHdH5a71TiiykxPR+G4pq 9HkTKlqfovpph0d9YnJbb1rMkgNhlWiWtUDEkRgHqMjRBFvZoWMi20V++sq6rE6Jkni8 pRpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kpp0GdsRYi0omTcELeAUu1IMsTjPcKqE7Mbm6MS6NsM=; b=VhWudY33MmFOdj3f0uSr23NtYTW4lH/o9h/KRUq1wdzeduZJbyT117lsCIBHtRoUNe 8wlgwvXF/l/kPYjordAB6kizoic4RrZpWXaw83OHy5WqpxNyIngeyLOs96X7uaeNzO/g Y6oPMszOsP4iNvEf8WzjvK7wMKLBrVmqsXrvUBK5tTTJsrNMLzSf+i2sTir6Lz3shqS4 thVS7kqCg14s+KzmxsYokVUdyZLet1RX/fvYqyTeGDDCRnU3zve0qQslPLFj9PrU0xHu T6CVaaGQ8fAohgl5EOPbwYYeNLq6nplJkcqUS80QkNB7U8Qk/zxoPwxHIJy/tXBCcvYu NLNw== X-Gm-Message-State: AOAM533W3RrU1mrDs0RrEK/ipH5usAW4FzNLRhvDfcx7UjjkYO+UZj93 So9hF3ieuKA30CZg3tJH1CdrGw== X-Google-Smtp-Source: ABdhPJxfOVBzlRW7S7Ar5cYVRxLsJ7EGz70ufrLcvD+osyMmeYUOi6NLWrhlSTcaWP9RyHAaH9gABA== X-Received: by 2002:a17:902:b941:: with SMTP id h1mr1142974pls.200.1597155674883; Tue, 11 Aug 2020 07:21:14 -0700 (PDT) Received: from [192.168.1.182] ([66.219.217.173]) by smtp.gmail.com with ESMTPSA id j13sm26263358pfa.149.2020.08.11.07.21.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Aug 2020 07:21:14 -0700 (PDT) Subject: Re: possible deadlock in __io_queue_deferred To: Stefano Garzarella Cc: syzbot , io-uring@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com, viro@zeniv.linux.org.uk References: <00000000000035fdf505ac87b7f9@google.com> <76cc7c43-2ebb-180d-c2c8-912972a3f258@kernel.dk> <20200811140010.gigc2amchytqmrkk@steredhat> From: Jens Axboe Message-ID: <504b4b08-30c1-4ca8-ab3b-c9f0b58f0cfa@kernel.dk> Date: Tue, 11 Aug 2020 08:21:12 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200811140010.gigc2amchytqmrkk@steredhat> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/11/20 8:00 AM, Stefano Garzarella wrote: > On Mon, Aug 10, 2020 at 09:55:17AM -0600, Jens Axboe wrote: >> On 8/10/20 9:36 AM, syzbot wrote: >>> Hello, >>> >>> syzbot found the following issue on: >>> >>> HEAD commit: 449dc8c9 Merge tag 'for-v5.9' of git://git.kernel.org/pub/.. >>> git tree: upstream >>> console output: https://syzkaller.appspot.com/x/log.txt?x=14d41e02900000 >>> kernel config: https://syzkaller.appspot.com/x/.config?x=9d25235bf0162fbc >>> dashboard link: https://syzkaller.appspot.com/bug?extid=996f91b6ec3812c48042 >>> compiler: clang version 10.0.0 (https://github.com/llvm/llvm-project/ c2443155a0fb245c8f17f2c1c72b6ea391e86e81) >>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=133c9006900000 >>> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1191cb1a900000 >>> >>> IMPORTANT: if you fix the issue, please add the following tag to the commit: >>> Reported-by: syzbot+996f91b6ec3812c48042@syzkaller.appspotmail.com >> >> Thanks, the below should fix this one. > > Yeah, it seems right to me, since only __io_queue_deferred() (invoked by > io_commit_cqring()) can be called with 'completion_lock' held. Right > Just out of curiosity, while exploring the code I noticed that we call > io_commit_cqring() always with the 'completion_lock' held, except in the > io_poll_* functions. > > That's because then there can't be any concurrency? Do you mean the iopoll functions? Because we're definitely holding it for the io_poll_* functions. -- Jens Axboe