Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7426898imu; Tue, 22 Jan 2019 06:00:23 -0800 (PST) X-Google-Smtp-Source: ALg8bN5ZlYhWfAwJ4qgMBGPeZIM2ktluClhRWEAj4o/hqMYW0scRIJaRkRTazgy/Akxi9HacHtac X-Received: by 2002:a17:902:7588:: with SMTP id j8mr34828816pll.215.1548165622950; Tue, 22 Jan 2019 06:00:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548165622; cv=none; d=google.com; s=arc-20160816; b=KMz34L7iaVxn4gkluzlN1HcAx9ftnDsfbRGmy3qPhn/3S+vEExawwpuSS6ZcSe65J1 jaO0Tf5cre0UP6BSt7F/mpwiBtlayXnMzYeFBixJvrh4v51pmZpR/qNGPKjNhU/IW1Bh d8s1kB66YgzyZzo55Y8o8j2hbEBxopGZQiHNn02d4WfNJ682uzwF6H7eIheSH+JhduhO Pb4yulU3cekRcf7gpN0k/KipU/BHAcNpJ1eWXiJdTKOpPE5BfnCTcYFE4pFt4frAHIOV NhCtJOsayk4JtJv9ndO6+F6lyPssotKH8X4Gzwj08+WGHrJUwcqaZCZqfSfAk7ltJaE3 sOCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DF4BC871O2Dk1wll+Ha0pIljRxxk2JF7IAPB89GFj9k=; b=EG6RLp98iH8u3XHHFVLLTB8mxxoiaN++em6VFwuUu3jSA8dKwMy5s7x8nr84eWLrDu pL5AlS2mag9EoqS/cSjZX0v+UaqaxecqXhucA6mZZ+RjN0nD+yKC+ImV2rGjI7MNysFz XJ5xrH3LmHSQ5TH4ZwH7F926QdL3QpjctFWP+n2u7u0VDPQ1g9AN3OQPw589LwH28zDk OmRAMndRfyhAYUdH1FTpiCUn21RfOqaDRv3boogw9kCWcXjNR7XFUbYdlUXeOJBsl4JO /HeuQ8Cel7kQ0o3Sq6GtZ1yStnEvmh9DJcQrutgE/JBwjycT6KfOtgUBBr3xu/z+wVmZ zj9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Uu5l6zsB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si15415837plt.26.2019.01.22.06.00.06; Tue, 22 Jan 2019 06:00:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Uu5l6zsB; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728615AbfAVN6w (ORCPT + 99 others); Tue, 22 Jan 2019 08:58:52 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:37380 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728502AbfAVN6w (ORCPT ); Tue, 22 Jan 2019 08:58:52 -0500 Received: by mail-it1-f195.google.com with SMTP id b5so20123265iti.2 for ; Tue, 22 Jan 2019 05:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DF4BC871O2Dk1wll+Ha0pIljRxxk2JF7IAPB89GFj9k=; b=Uu5l6zsBg+B6rdXx9lRuJTJ7xrReOyArTzCLLqFlrwt8FBGIdh2/kDV8PPBZ/UEu4y C3V4kT7b13x7ZFMSF4m508fFe3lku2dcKpmOtu6kZkYa90wfPzX3LTWBlczlXGcNntv7 fI6XwpKNZHtbT/we2LltEQw6DHVZ2U0BtjRZVvVn95xbE5wWUVjUfeYPwJK684X338Ft auaXrzP8Q6XlxpuJV8LUjoZSq7qqVAN9LuRYTxiiMU+LceFRRTIpA96GbymvcNDjAa2O a/dpqoac0zQDjawQLIZqNHtix+0Z+krZZEf7bKxTivmybV6XGnARGCP8LC6UXbLQkWct HbIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DF4BC871O2Dk1wll+Ha0pIljRxxk2JF7IAPB89GFj9k=; b=Lzs8Y0fVq0ep4lcRiiSu5ltaHksNgcxJOfXkiwWcZW607mIZuTXAsfaoUCUslFE8R+ i5EMTMmFfHjHwheB0fsg3Wj92AIE8N/A80zgbgRqPguIcp03J3HGfDRxU1e11NCFlncY ZnCVlWsAjsETAEpJtk4fS3DFXkiTR3CSCqjdtzjt/cn4Le+xLL/fg8xkYEFXgOHoEhr9 OeZtjW4poC362qEdP9bP76xusiJPkIq8BBrTg/37RTfeqN7G/+n4DmzcJWgXW7qCShmE 3wKbaOz1sqdsF/FvEY+oa7aBirhEkuX2QpGuHXXRl02AbXYSLGCpxmNeM715+5JgtUsV c4DQ== X-Gm-Message-State: AJcUukdJ0jV+0Btg7nAuXSLi3pDUOTuuKftSiRZKLl2iIJukkeaFsCdL 5JrnUGVN7QFwuYObFpCxZNgaWGBQr/6RJcW/K6Zq+w== X-Received: by 2002:a05:660c:f94:: with SMTP id x20mr1833184itl.144.1548165530258; Tue, 22 Jan 2019 05:58:50 -0800 (PST) MIME-Version: 1.0 References: <000000000000194520056affab14@google.com> <20180509075715.GH711@sol.localdomain> In-Reply-To: From: Dmitry Vyukov Date: Tue, 22 Jan 2019 14:58:39 +0100 Message-ID: Subject: Re: possible deadlock in vfs_fallocate To: Todd Kjos Cc: Eric Biggers , Joel Fernandes , Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , "open list:ANDROID DRIVERS" , linux-fsdevel , LKML , syzkaller-bugs , syzbot+148c2885d71194f18d28@syzkaller.appspotmail.com, Tetsuo Handa Content-Type: multipart/mixed; boundary="0000000000007cda1305800c609a" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000007cda1305800c609a Content-Type: text/plain; charset="UTF-8" On Wed, May 9, 2018 at 6:57 PM 'Todd Kjos' via syzkaller-bugs wrote: > > +Joel Fernandes > > On Wed, May 9, 2018 at 12:55 AM Eric Biggers wrote: >> >> [+ashmem maintainers] >> >> On Sun, Apr 29, 2018 at 10:00:03AM -0700, syzbot wrote: >> > Hello, >> > >> > syzbot hit the following crash on upstream commit >> > cdface5209349930ae1b51338763c8e029971b97 (Sun Apr 29 03:07:21 2018 +0000) >> > Merge tag 'for_linus_stable' of >> > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 >> > syzbot dashboard link: >> > https://syzkaller.appspot.com/bug?extid=148c2885d71194f18d28 >> > >> > C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5054004375584768 >> > syzkaller reproducer: >> > https://syzkaller.appspot.com/x/repro.syz?id=6438048191479808 >> > Raw console output: >> > https://syzkaller.appspot.com/x/log.txt?id=5404215203594240 >> > Kernel config: >> > https://syzkaller.appspot.com/x/.config?id=7043958930931867332 >> > compiler: gcc (GCC) 8.0.1 20180413 (experimental) Let's test Tetsuo's patch #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master >> > IMPORTANT: if you fix the bug, please add the following tag to the commit: >> > Reported-by: syzbot+148c2885d71194f18d28@syzkaller.appspotmail.com >> > It will help syzbot understand when the bug is fixed. See footer for >> > details. >> > If you forward the report, please keep this part and the footer. >> > >> > random: sshd: uninitialized urandom read (32 bytes read) >> > random: sshd: uninitialized urandom read (32 bytes read) >> > random: sshd: uninitialized urandom read (32 bytes read) >> > >> > ====================================================== >> > WARNING: possible circular locking dependency detected >> > 4.17.0-rc2+ #23 Not tainted >> > ------------------------------------------------------ >> > syz-executor715/4492 is trying to acquire lock: >> > (ptrval) (sb_writers#6){.+.+}, at: file_start_write >> > include/linux/fs.h:2718 [inline] >> > (ptrval) (sb_writers#6){.+.+}, at: vfs_fallocate+0x5be/0x8d0 >> > fs/open.c:318 >> > >> > but task is already holding lock: >> > (ptrval) (ashmem_mutex){+.+.}, at: ashmem_shrink_scan+0xac/0x560 >> > drivers/staging/android/ashmem.c:440 >> > >> > which lock already depends on the new lock. >> > >> > >> > the existing dependency chain (in reverse order) is: >> > >> > -> #3 (ashmem_mutex){+.+.}: >> > __mutex_lock_common kernel/locking/mutex.c:756 [inline] >> > __mutex_lock+0x16d/0x17f0 kernel/locking/mutex.c:893 >> > mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908 >> > ashmem_mmap+0x53/0x460 drivers/staging/android/ashmem.c:361 >> > call_mmap include/linux/fs.h:1789 [inline] >> > mmap_region+0xd13/0x1820 mm/mmap.c:1723 >> > do_mmap+0xc79/0x11d0 mm/mmap.c:1494 >> > do_mmap_pgoff include/linux/mm.h:2237 [inline] >> > vm_mmap_pgoff+0x1fb/0x2a0 mm/util.c:357 >> > ksys_mmap_pgoff+0x4c9/0x640 mm/mmap.c:1544 >> > __do_sys_mmap arch/x86/kernel/sys_x86_64.c:100 [inline] >> > __se_sys_mmap arch/x86/kernel/sys_x86_64.c:91 [inline] >> > __x64_sys_mmap+0xe9/0x1b0 arch/x86/kernel/sys_x86_64.c:91 >> > do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 >> > entry_SYSCALL_64_after_hwframe+0x49/0xbe >> > >> > -> #2 (&mm->mmap_sem){++++}: >> > __might_fault+0x155/0x1e0 mm/memory.c:4555 >> > _copy_to_user+0x30/0x110 lib/usercopy.c:25 >> > copy_to_user include/linux/uaccess.h:155 [inline] >> > filldir+0x1ea/0x3a0 fs/readdir.c:196 >> > dir_emit_dot include/linux/fs.h:3378 [inline] >> > dir_emit_dots include/linux/fs.h:3389 [inline] >> > dcache_readdir+0x13a/0x620 fs/libfs.c:192 >> > iterate_dir+0x4b0/0x5d0 fs/readdir.c:51 >> > __do_sys_getdents fs/readdir.c:231 [inline] >> > __se_sys_getdents fs/readdir.c:212 [inline] >> > __x64_sys_getdents+0x293/0x4e0 fs/readdir.c:212 >> > do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 >> > entry_SYSCALL_64_after_hwframe+0x49/0xbe >> > >> > -> #1 (&sb->s_type->i_mutex_key#11){++++}: >> > down_write+0x87/0x120 kernel/locking/rwsem.c:70 >> > inode_lock include/linux/fs.h:713 [inline] >> > do_last fs/namei.c:3274 [inline] >> > path_openat+0x123b/0x4e20 fs/namei.c:3501 >> > do_filp_open+0x249/0x350 fs/namei.c:3535 >> > do_sys_open+0x56f/0x740 fs/open.c:1093 >> > __do_sys_open fs/open.c:1111 [inline] >> > __se_sys_open fs/open.c:1106 [inline] >> > __x64_sys_open+0x7e/0xc0 fs/open.c:1106 >> > do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 >> > entry_SYSCALL_64_after_hwframe+0x49/0xbe >> > >> > -> #0 (sb_writers#6){.+.+}: >> > lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 >> > percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 >> > [inline] >> > percpu_down_read include/linux/percpu-rwsem.h:59 [inline] >> > __sb_start_write+0x1e9/0x300 fs/super.c:1385 >> > file_start_write include/linux/fs.h:2718 [inline] >> > vfs_fallocate+0x5be/0x8d0 fs/open.c:318 >> > ashmem_shrink_scan+0x1f1/0x560 drivers/staging/android/ashmem.c:447 >> > ashmem_ioctl+0x3bf/0x13a0 drivers/staging/android/ashmem.c:789 >> > vfs_ioctl fs/ioctl.c:46 [inline] >> > file_ioctl fs/ioctl.c:500 [inline] >> > do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684 >> > ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 >> > __do_sys_ioctl fs/ioctl.c:708 [inline] >> > __se_sys_ioctl fs/ioctl.c:706 [inline] >> > __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706 >> > do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 >> > entry_SYSCALL_64_after_hwframe+0x49/0xbe >> > >> > other info that might help us debug this: >> > >> > Chain exists of: >> > sb_writers#6 --> &mm->mmap_sem --> ashmem_mutex >> > >> > Possible unsafe locking scenario: >> > >> > CPU0 CPU1 >> > ---- ---- >> > lock(ashmem_mutex); >> > lock(&mm->mmap_sem); >> > lock(ashmem_mutex); >> > lock(sb_writers#6); >> > >> > *** DEADLOCK *** >> > >> > 1 lock held by syz-executor715/4492: >> > #0: (ptrval) (ashmem_mutex){+.+.}, at: >> > ashmem_shrink_scan+0xac/0x560 drivers/staging/android/ashmem.c:440 >> > >> > stack backtrace: >> > CPU: 1 PID: 4492 Comm: syz-executor715 Not tainted 4.17.0-rc2+ #23 >> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS >> > Google 01/01/2011 >> > Call Trace: >> > __dump_stack lib/dump_stack.c:77 [inline] >> > dump_stack+0x1b9/0x294 lib/dump_stack.c:113 >> > print_circular_bug.isra.36.cold.54+0x1bd/0x27d >> > kernel/locking/lockdep.c:1223 >> > check_prev_add kernel/locking/lockdep.c:1863 [inline] >> > check_prevs_add kernel/locking/lockdep.c:1976 [inline] >> > validate_chain kernel/locking/lockdep.c:2417 [inline] >> > __lock_acquire+0x343e/0x5140 kernel/locking/lockdep.c:3431 >> > lock_acquire+0x1dc/0x520 kernel/locking/lockdep.c:3920 >> > percpu_down_read_preempt_disable include/linux/percpu-rwsem.h:36 [inline] >> > percpu_down_read include/linux/percpu-rwsem.h:59 [inline] >> > __sb_start_write+0x1e9/0x300 fs/super.c:1385 >> > file_start_write include/linux/fs.h:2718 [inline] >> > vfs_fallocate+0x5be/0x8d0 fs/open.c:318 >> > ashmem_shrink_scan+0x1f1/0x560 drivers/staging/android/ashmem.c:447 >> > ashmem_ioctl+0x3bf/0x13a0 drivers/staging/android/ashmem.c:789 >> > vfs_ioctl fs/ioctl.c:46 [inline] >> > file_ioctl fs/ioctl.c:500 [inline] >> > do_vfs_ioctl+0x1cf/0x16a0 fs/ioctl.c:684 >> > ksys_ioctl+0xa9/0xd0 fs/ioctl.c:701 >> > __do_sys_ioctl fs/ioctl.c:708 [inline] >> > __se_sys_ioctl fs/ioctl.c:706 [inline] >> > __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:706 >> > do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287 >> > entry_SYSCALL_64_after_hwframe+0x49/0xbe >> > RIP: 0033:0x440179 >> > RSP: 002b:00007ffc165d4a28 EFLAGS: 00000217 ORIG_RAX: 0000000000000010 >> > RAX: ffffffffffffffda RBX: 6873612f7665642f RCX: 0000000000440179 >> > RDX: 0000000000000000 RSI: 000000000000770a RDI: 0000000000000004 >> > RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000 >> > R10: 0000000000000004 R11: 0000000000000217 R12: 00000000004016a0 >> > R13: 0000000000401730 R14: 0000000000000000 R15: 0000000000000000 >> > random: crng init done >> > >> > >> > --- >> > This bug is generated by a dumb bot. It may contain errors. >> > See https://goo.gl/tpsmEJ for details. >> > Direct all questions to syzkaller@googlegroups.com. >> > >> > syzbot will keep track of this bug report. >> > If you forgot to add the Reported-by tag, once the fix for this bug is >> > merged >> > into any tree, please reply to this email with: >> > #syz fix: exact-commit-title >> > If you want to test a patch for this bug, please reply with: >> > #syz test: git://repo/address.git branch >> > and provide the patch inline or as an attachment. >> > To mark this as a duplicate of another syzbot report, please reply with: >> > #syz dup: exact-subject-of-another-report >> > If it's a one-off invalid bug report, please reply with: >> > #syz invalid >> > Note: if the crash happens again, it will cause creation of a new bug >> > report. >> > Note: all commands must start from beginning of the line in the email body. >> >> Looks like yet another locking bug in ashmem. ashmem_mutex normally ranks below >> mmap_sem, but ashmem_shrink_scan() inverts that order, via the >> file_start_write() in vfs_fallocate(). >> >> - Eric --0000000000007cda1305800c609a Content-Type: text/x-patch; charset="US-ASCII"; name="ashmem.patch" Content-Disposition: attachment; filename="ashmem.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jr7trhnd0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvc3RhZ2luZy9hbmRyb2lkL2FzaG1lbS5jIGIvZHJpdmVycy9z dGFnaW5nL2FuZHJvaWQvYXNobWVtLmMKaW5kZXggOTBhOGE5ZjFhYzdkLi4xYTg5MGM0M2ExMGEg MTAwNjQ0Ci0tLSBhL2RyaXZlcnMvc3RhZ2luZy9hbmRyb2lkL2FzaG1lbS5jCisrKyBiL2RyaXZl cnMvc3RhZ2luZy9hbmRyb2lkL2FzaG1lbS5jCkBAIC03NSw2ICs3NSwxNyBAQCBzdHJ1Y3QgYXNo bWVtX3JhbmdlIHsKIC8qIExSVSBsaXN0IG9mIHVucGlubmVkIHBhZ2VzLCBwcm90ZWN0ZWQgYnkg YXNobWVtX211dGV4ICovCiBzdGF0aWMgTElTVF9IRUFEKGFzaG1lbV9scnVfbGlzdCk7CiAKK3N0 YXRpYyBzdHJ1Y3Qgd29ya3F1ZXVlX3N0cnVjdCAqYXNobWVtX3dxOworc3RhdGljIGF0b21pY190 IGFzaG1lbV9zaHJpbmtfaW5mbGlnaHQgPSBBVE9NSUNfSU5JVCgwKTsKK3N0YXRpYyBERUNMQVJF X1dBSVRfUVVFVUVfSEVBRChhc2htZW1fc2hyaW5rX3dhaXQpOworCitzdHJ1Y3QgYXNobWVtX3No cmlua193b3JrIHsKKwlzdHJ1Y3Qgd29ya19zdHJ1Y3Qgd29yazsKKwlzdHJ1Y3QgZmlsZSAqZmls ZTsKKwlsb2ZmX3Qgc3RhcnQ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