Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2574131pxb; Tue, 9 Mar 2021 06:08:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJwmaI3j97CZ1HMdstMDma+kmjBUwMbo9n5aY/87t1PawEAVAqGvoLNdT7KtX4RZPlsnpIyX X-Received: by 2002:aa7:c983:: with SMTP id c3mr4307467edt.185.1615298890926; Tue, 09 Mar 2021 06:08:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615298890; cv=none; d=google.com; s=arc-20160816; b=fa73UNQeJLa67QQC8d7i3KuMsav56uaO/XblZqKFlJEeP4noIw22fdQjgT98TztyfC qD2hmMn+e+1Un4gcyhHbZogTjRLxjqGgJgh4YFlWG3kj5723e5uC8Q1jpg2yPmRe7jwf /urrfxAD8jPnhVb82GP4SEEIBXe3ZY6uUKr3c51m+sizQ72IZuSyHCM8rjc8/eMuIuu8 E9MdA7nXfLETgwLnFRQfdzOQKYU/tkGK3o9YS+RdRlfP/rOnLVdIE+PB/pY+f8vpo2th DKGeP6VSULlBImF0qzy6V7y2sUgmmJQdRDnjcajs7gd+D43jHJ4gKbbY/JJLctNH8RAm 9P3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:from:subject:message-id:in-reply-to:date :mime-version; bh=1VPBK6wBtCcTOrKaN1TxGhoj3hC0x3OTkbjKlJiuNpo=; b=P9V8h7Du/FZENJ15GIdXAA5tqFZ9KNzOfBOjpW7Q1Megocr/RLxwXWwm+H1KK1PlmX 5EMjFtonk7WaC3JcMiW2XlwSltEY+FSY3q7twoAjVEVr3/wjzyZwUL9JvAYZ2OxCErqr KWfjiQlIbVHQhdtBr89x6qnp4j+4IxGKldx2cKkEtqiGr+CEbm3b0t3Fwth5eTVWR0R4 /3w6kdd14eT+vHBnv8e2JJYrmoj8tdEU6cgxXOyNke+1nMRpu7wSU6P2E+m+X4e8HXzX xWHasPLk7wN1Xd8T1pQW2j17zcqBRBXTNbL6HBsqo1L894GbOQbR/VTwZck3d3j0i5t8 F1tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si9609370ejd.683.2021.03.09.06.07.42; Tue, 09 Mar 2021 06:08:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231239AbhCIOEh (ORCPT + 99 others); Tue, 9 Mar 2021 09:04:37 -0500 Received: from mail-il1-f199.google.com ([209.85.166.199]:49285 "EHLO mail-il1-f199.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231229AbhCIOES (ORCPT ); Tue, 9 Mar 2021 09:04:18 -0500 Received: by mail-il1-f199.google.com with SMTP id q3so10177345ilv.16 for ; Tue, 09 Mar 2021 06:04:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id:subject :from:to; bh=1VPBK6wBtCcTOrKaN1TxGhoj3hC0x3OTkbjKlJiuNpo=; b=BwyShLRBRXv7v3NgnG6PbZUvCuwAjeAIry9buYwe30sMSS2b5x03J6TxisTJxMpsZ6 5g7N0ch65brV+hBwFUt4u59WAjpAiOzue7npVRiKQCPKtgpNqUJXotH5Epldgj7gfOQR 5gpCxT1khtoFc+G0f+mB/rLlI/AvBYeJgSdExUOuLsidocf4nbsjnUmy0Z7/u6fU+NP9 SoMisTaoaPP2EfDJbsmy2I33tDKwGYmTErQKxicjBi8Y1IK/5giW1icM/0JDbiXKHoS1 EDG7Qi+4fvHvciQGAxlAPmHkTjhQHg1eZyhpd9W2bUicEvorIjSfho3B3RyMYoH8Z/aB Ds9Q== X-Gm-Message-State: AOAM531RWVaOB38//rhRlXkpNgCKxjKLOiLxhCnhMRFp6rRefjjX910U YmvjwInaD1wGucLXQEVpUPKFIC8yejIelToilWGTiGw9J0Vk MIME-Version: 1.0 X-Received: by 2002:a02:cbb2:: with SMTP id v18mr28614932jap.4.1615298657982; Tue, 09 Mar 2021 06:04:17 -0800 (PST) Date: Tue, 09 Mar 2021 06:04:17 -0800 In-Reply-To: <000000000000430bf505bcef3b00@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <000000000000b71e9605bd1b064f@google.com> Subject: Re: [syzbot] possible deadlock in io_sq_thread_finish From: syzbot To: asml.silence@gmail.com, axboe@kernel.dk, io-uring@vger.kernel.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org syzbot has found a reproducer for the following issue on: HEAD commit: 144c79ef Merge tag 'perf-tools-fixes-for-v5.12-2020-03-07'.. git tree: upstream console output: https://syzkaller.appspot.com/x/log.txt?x=129addbcd00000 kernel config: https://syzkaller.appspot.com/x/.config?x=db9c6adb4986f2f2 dashboard link: https://syzkaller.appspot.com/bug?extid=ac39856cb1b332dbbdda syz repro: https://syzkaller.appspot.com/x/repro.syz?x=167574dad00000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12c8f566d00000 IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+ac39856cb1b332dbbdda@syzkaller.appspotmail.com ============================================ WARNING: possible recursive locking detected 5.12.0-rc2-syzkaller #0 Not tainted -------------------------------------------- kworker/u4:7/8696 is trying to acquire lock: ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_stop fs/io_uring.c:7099 [inline] ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_put_sq_data fs/io_uring.c:7115 [inline] ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_finish+0x408/0x650 fs/io_uring.c:7139 but task is already holding lock: ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_park fs/io_uring.c:7088 [inline] ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_park+0x63/0xc0 fs/io_uring.c:7082 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&sqd->lock); lock(&sqd->lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by kworker/u4:7/8696: #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline] #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: atomic64_set include/asm-generic/atomic-instrumented.h:856 [inline] #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: atomic_long_set include/asm-generic/atomic-long.h:41 [inline] #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: set_work_data kernel/workqueue.c:616 [inline] #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: set_work_pool_and_clear_pending kernel/workqueue.c:643 [inline] #0: ffff888010469138 ((wq_completion)events_unbound){+.+.}-{0:0}, at: process_one_work+0x871/0x1600 kernel/workqueue.c:2246 #1: ffffc9000253fda8 ((work_completion)(&ctx->exit_work)){+.+.}-{0:0}, at: process_one_work+0x8a5/0x1600 kernel/workqueue.c:2250 #2: ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_park fs/io_uring.c:7088 [inline] #2: ffff888015395870 (&sqd->lock){+.+.}-{3:3}, at: io_sq_thread_park+0x63/0xc0 fs/io_uring.c:7082 stack backtrace: CPU: 0 PID: 8696 Comm: kworker/u4:7 Not tainted 5.12.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events_unbound io_ring_exit_work Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_deadlock_bug kernel/locking/lockdep.c:2829 [inline] check_deadlock kernel/locking/lockdep.c:2872 [inline] validate_chain kernel/locking/lockdep.c:3661 [inline] __lock_acquire.cold+0x14c/0x3b4 kernel/locking/lockdep.c:4900 lock_acquire kernel/locking/lockdep.c:5510 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5475 __mutex_lock_common kernel/locking/mutex.c:946 [inline] __mutex_lock+0x139/0x1120 kernel/locking/mutex.c:1093 io_sq_thread_stop fs/io_uring.c:7099 [inline] io_put_sq_data fs/io_uring.c:7115 [inline] io_sq_thread_finish+0x408/0x650 fs/io_uring.c:7139 io_ring_ctx_free fs/io_uring.c:8408 [inline] io_ring_exit_work+0x82/0x9a0 fs/io_uring.c:8539 process_one_work+0x98d/0x1600 kernel/workqueue.c:2275 worker_thread+0x64c/0x1120 kernel/workqueue.c:2421 kthread+0x3b1/0x4a0 kernel/kthread.c:292 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294