lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <001a113f711a5c70f9055f76c074@google.com>
Date:   Sun, 03 Dec 2017 14:02:01 -0800
From:   syzbot 
        <bot+e93a80c1bb7c5c56e522461c149f8bf55eab1b2b@...kaller.appspotmail.com>
To:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzkaller-bugs@...glegroups.com, viro@...iv.linux.org.uk
Subject: possible deadlock in seq_read

syzkaller has found reproducer for the following crash on  
ae64f9bd1d3621b5e60d7363bc20afb46aede215
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.
C reproducer is attached
syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers



======================================================
WARNING: possible circular locking dependency detected
4.15.0-rc2+ #206 Not tainted
------------------------------------------------------
syzkaller646059/3083 is trying to acquire lock:
  (&p->lock){+.+.}, at: [<00000000732c25f5>] seq_read+0xd5/0x13d0  
fs/seq_file.c:165

but task is already holding lock:
  (sb_writers){.+.+}, at: [<00000000d0158187>] file_start_write  
include/linux/fs.h:2715 [inline]
  (sb_writers){.+.+}, at: [<00000000d0158187>] do_sendfile+0xaec/0xe90  
fs/read_write.c:1412

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (sb_writers){.+.+}:
        spin_lock include/linux/spinlock.h:315 [inline]
        lockref_put_or_lock+0x19/0x80 lib/lockref.c:143

-> #2 ((completion)&req.done){+.+.}:
        lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4004
        complete_acquire include/linux/completion.h:40 [inline]
        __wait_for_common kernel/sched/completion.c:109 [inline]
        wait_for_common kernel/sched/completion.c:123 [inline]
        wait_for_completion+0xcb/0x7b0 kernel/sched/completion.c:144
        devtmpfs_create_node+0x32b/0x4a0 drivers/base/devtmpfs.c:115
        device_add+0x120f/0x1640 drivers/base/core.c:1824
        device_create_groups_vargs+0x1f3/0x250 drivers/base/core.c:2430
        device_create_vargs drivers/base/core.c:2470 [inline]
        device_create+0xda/0x110 drivers/base/core.c:2506
        vcs_make_sysfs+0x35/0x60 drivers/tty/vt/vc_screen.c:629
        vc_allocate+0x4b7/0x6b0 drivers/tty/vt/vt.c:797
        con_install+0x52/0x440 drivers/tty/vt/vt.c:2876
        tty_driver_install_tty drivers/tty/tty_io.c:1215 [inline]
        tty_init_dev+0xf6/0x4a0 drivers/tty/tty_io.c:1315
        tty_open_by_driver drivers/tty/tty_io.c:1942 [inline]
        tty_open+0x608/0xab0 drivers/tty/tty_io.c:1990
        chrdev_open+0x257/0x730 fs/char_dev.c:417
        do_dentry_open+0x682/0xd70 fs/open.c:752
        vfs_open+0x107/0x230 fs/open.c:866
        do_last fs/namei.c:3379 [inline]
        path_openat+0x1157/0x3530 fs/namei.c:3519
        do_filp_open+0x25b/0x3b0 fs/namei.c:3554
        do_sys_open+0x502/0x6d0 fs/open.c:1059
        SYSC_open fs/open.c:1077 [inline]
        SyS_open+0x2d/0x40 fs/open.c:1072
        entry_SYSCALL_64_fastpath+0x1f/0x96

-> #1 (console_lock){+.+.}:
        lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4004
        console_lock+0x4b/0x80 kernel/printk/printk.c:2047
        c_start+0x18/0xf0 arch/x86/kernel/cpu/proc.c:146
        seq_read+0x2f3/0x13d0 fs/seq_file.c:229
        proc_reg_read+0xef/0x170 fs/proc/inode.c:217
        __vfs_read+0xef/0xa00 fs/read_write.c:411
        vfs_read+0x124/0x360 fs/read_write.c:447
        SYSC_read fs/read_write.c:573 [inline]
        SyS_read+0xef/0x220 fs/read_write.c:566
        entry_SYSCALL_64_fastpath+0x1f/0x96

-> #0 (&p->lock){+.+.}:
        check_prevs_add kernel/locking/lockdep.c:2031 [inline]
        validate_chain kernel/locking/lockdep.c:2473 [inline]
        __lock_acquire+0x3498/0x47f0 kernel/locking/lockdep.c:3500
        lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4004
        __mutex_lock_common kernel/locking/mutex.c:756 [inline]
        __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
        mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
        seq_read+0xd5/0x13d0 fs/seq_file.c:165
        proc_reg_read+0xef/0x170 fs/proc/inode.c:217
        do_loop_readv_writev fs/read_write.c:673 [inline]
        do_iter_read+0x3db/0x5b0 fs/read_write.c:897
        vfs_readv+0x121/0x1c0 fs/read_write.c:959
        kernel_readv fs/splice.c:361 [inline]
        default_file_splice_read+0x508/0xae0 fs/splice.c:416
        do_splice_to+0x110/0x170 fs/splice.c:880
        splice_direct_to_actor+0x242/0x820 fs/splice.c:952
        do_splice_direct+0x2a7/0x3d0 fs/splice.c:1061
        do_sendfile+0x5d5/0xe90 fs/read_write.c:1413
        SYSC_sendfile64 fs/read_write.c:1468 [inline]
        SyS_sendfile64+0xbd/0x160 fs/read_write.c:1460
        entry_SYSCALL_64_fastpath+0x1f/0x96

other info that might help us debug this:

Chain exists of:
   &p->lock --> (completion)&req.done --> sb_writers

  Possible unsafe locking scenario:

        CPU0                    CPU1
        ----                    ----
   lock(sb_writers);
                                lock((completion)&req.done);
                                lock(sb_writers);
   lock(&p->lock);

  *** DEADLOCK ***

1 lock held by syzkaller646059/3083:
  #0:  (sb_writers){.+.+}, at: [<00000000d0158187>] file_start_write  
include/linux/fs.h:2715 [inline]
  #0:  (sb_writers){.+.+}, at: [<00000000d0158187>] do_sendfile+0xaec/0xe90  
fs/read_write.c:1412

stack backtrace:
CPU: 1 PID: 3083 Comm: syzkaller646059 Not tainted 4.15.0-rc2+ #206
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x194/0x257 lib/dump_stack.c:53
  print_circular_bug+0x42d/0x610 kernel/locking/lockdep.c:1271
  check_prev_add+0x666/0x15f0 kernel/locking/lockdep.c:1914
  check_prevs_add kernel/locking/lockdep.c:2031 [inline]
  validate_chain kernel/locking/lockdep.c:2473 [inline]
  __lock_acquire+0x3498/0x47f0 kernel/locking/lockdep.c:3500
  lock_acquire+0x1d5/0x580 kernel/locking/lockdep.c:4004
  __mutex_lock_common kernel/locking/mutex.c:756 [inline]
  __mutex_lock+0x16f/0x1a80 kernel/locking/mutex.c:893
  mutex_lock_nested+0x16/0x20 kernel/locking/mutex.c:908
  seq_read+0xd5/0x13d0 fs/seq_file.c:165
  proc_reg_read+0xef/0x170 fs/proc/inode.c:217
  do_loop_readv_writev fs/read_write.c:673 [inline]
  do_iter_read+0x3db/0x5b0 fs/read_write.c:897
  vfs_readv+0x121/0x1c0 fs/read_write.c:959
  kernel_readv fs/splice.c:361 [inline]
  default_file_splice_read+0x508/0xae0 fs/splice.c:416
  do_splice_to+0x110/0x170 fs/splice.c:880
  splice_direct_to_actor+0x242/0x820 fs/splice.c:952
  do_splice_direct+0x2a7/0x3d0 fs/splice.c:1061
  do_sendfile+0x5d5/0xe90 fs/read_write.c:1413
  SYSC_sendfile64 fs/read_write.c:1468 [inline]
  SyS_sendfile64+0xbd/0x160 fs/read_write.c:1460
  entry_SYSCALL_64_fastpath+0x1f/0x96
RIP: 0033:0x445f29
RSP: 002b:00007ffc0519bcf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000445f29
RDX: 00000000203e1000 RSI: 0000000000000008 RDI: 0000000000000007
RBP: 0000000000000000 R08: 00000000004038a0 R09: 00000000004038a0
R10: 00000000000003fe R11: 0000000000000246 R12: 0000000000403810
R13: 00000000004038a0 R14: 0000000000000000 R15: 0000000000000000


View attachment "config.txt" of type "text/plain" (126531 bytes)

Download attachment "raw.log" of type "application/octet-stream" (49998 bytes)

View attachment "repro.txt" of type "text/plain" (2000 bytes)

Download attachment "repro.c" of type "application/octet-stream" (12727 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ