====================================================== WARNING: possible circular locking dependency detected 4.14.299-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.1/8013 is trying to acquire lock: (&dat_lock_key){.+.+}, at: [] nilfs_count_free_blocks+0x68/0x180 fs/nilfs2/the_nilfs.c:707 but task is already holding lock: (&nilfs->ns_sem){++++}, at: [] nilfs_put_super+0x139/0x190 fs/nilfs2/super.c:483 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&nilfs->ns_sem){++++}: down_write+0x34/0x90 kernel/locking/rwsem.c:54 nilfs_set_error fs/nilfs2/super.c:95 [inline] __nilfs_error+0x176/0x399 fs/nilfs2/super.c:140 nilfs_bmap_convert_error fs/nilfs2/bmap.c:44 [inline] nilfs_bmap_lookup_contig+0x130/0x170 fs/nilfs2/bmap.c:104 nilfs_get_block+0x1bd/0x7a0 fs/nilfs2/inode.c:93 do_mpage_readpage+0x615/0x1470 fs/mpage.c:211 mpage_readpages+0x2d6/0x5f0 fs/mpage.c:383 read_pages mm/readahead.c:121 [inline] __do_page_cache_readahead+0x522/0x940 mm/readahead.c:199 ra_submit mm/internal.h:66 [inline] ondemand_readahead.isra.0+0x514/0xb60 mm/readahead.c:486 page_cache_sync_readahead mm/readahead.c:518 [inline] page_cache_sync_readahead+0xa6/0xf0 mm/readahead.c:503 generic_file_buffered_read mm/filemap.c:2003 [inline] generic_file_read_iter+0xfbc/0x21c0 mm/filemap.c:2273 call_read_iter include/linux/fs.h:1774 [inline] new_sync_read fs/read_write.c:401 [inline] __vfs_read+0x449/0x620 fs/read_write.c:413 integrity_kernel_read+0x11b/0x1b0 security/integrity/iint.c:199 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:381 [inline] ima_calc_file_shash security/integrity/ima/ima_crypto.c:410 [inline] ima_calc_file_hash+0x3ee/0x780 security/integrity/ima/ima_crypto.c:467 ima_collect_measurement+0x39d/0x430 security/integrity/ima/ima_api.c:227 process_measurement+0x78b/0xb20 security/integrity/ima/ima_main.c:264 do_last fs/namei.c:3435 [inline] path_openat+0x10ad/0x2970 fs/namei.c:3571 do_filp_open+0x179/0x3c0 fs/namei.c:3605 do_sys_open+0x296/0x410 fs/open.c:1081 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 -> #0 (&dat_lock_key){.+.+}: lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 down_read+0x36/0x80 kernel/locking/rwsem.c:24 nilfs_count_free_blocks+0x68/0x180 fs/nilfs2/the_nilfs.c:707 nilfs_set_log_cursor fs/nilfs2/super.c:248 [inline] nilfs_cleanup_super+0x123/0x450 fs/nilfs2/super.c:330 nilfs_put_super+0x141/0x190 fs/nilfs2/super.c:484 generic_shutdown_super+0x144/0x370 fs/super.c:446 kill_block_super+0x95/0xe0 fs/super.c:1161 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 deactivate_super+0x7f/0xa0 fs/super.c:350 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nilfs->ns_sem); lock(&dat_lock_key); lock(&nilfs->ns_sem); lock(&dat_lock_key); *** DEADLOCK *** 2 locks held by syz-executor.1/8013: #0: (&type->s_umount_key#78){+.+.}, at: [] deactivate_super+0x77/0xa0 fs/super.c:349 #1: (&nilfs->ns_sem){++++}, at: [] nilfs_put_super+0x139/0x190 fs/nilfs2/super.c:483 stack backtrace: CPU: 0 PID: 8013 Comm: syz-executor.1 Not tainted 4.14.299-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1258 check_prev_add kernel/locking/lockdep.c:1905 [inline] check_prevs_add kernel/locking/lockdep.c:2022 [inline] validate_chain kernel/locking/lockdep.c:2464 [inline] __lock_acquire+0x2e0e/0x3f20 kernel/locking/lockdep.c:3491 lock_acquire+0x170/0x3f0 kernel/locking/lockdep.c:3998 down_read+0x36/0x80 kernel/locking/rwsem.c:24 nilfs_count_free_blocks+0x68/0x180 fs/nilfs2/the_nilfs.c:707 nilfs_set_log_cursor fs/nilfs2/super.c:248 [inline] nilfs_cleanup_super+0x123/0x450 fs/nilfs2/super.c:330 nilfs_put_super+0x141/0x190 fs/nilfs2/super.c:484 generic_shutdown_super+0x144/0x370 fs/super.c:446 kill_block_super+0x95/0xe0 fs/super.c:1161 deactivate_locked_super+0x6c/0xd0 fs/super.c:319 deactivate_super+0x7f/0xa0 fs/super.c:350 cleanup_mnt+0x186/0x2c0 fs/namespace.c:1183 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 NILFS (loop1): segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) audit: type=1804 audit(1668753804.078:13): pid=11531 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.1" name="/root/syzkaller-testdir1541361482/syzkaller.KzthmS/55/file0/file2" dev="loop1" ino=16 res=1 Remounting filesystem read-only NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) audit: type=1800 audit(1668753804.458:14): pid=11497 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed" comm="syz-executor.1" name="file2" dev="loop1" ino=16 res=0 NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) audit: type=1800 audit(1668753804.558:15): pid=11531 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed" comm="syz-executor.1" name="file2" dev="loop1" ino=16 res=0 NILFS (loop1): segctord starting. Construction interval = 5 seconds, CP frequency < 30 seconds audit: type=1804 audit(1668753804.768:16): pid=11583 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir3084901278/syzkaller.T2T60t/57/bus" dev="sda1" ino=14038 res=1 EXT4-fs (loop3): Unrecognized mount option "sma" or missing value NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 audit: type=1800 audit(1668753804.768:17): pid=11583 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.3" name="bus" dev="sda1" ino=14038 res=0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) Zero length message leads to an empty skb Remounting filesystem read-only netlink: 16 bytes leftover after parsing attributes in process `syz-executor.2'. NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 audit: type=1804 audit(1668753805.028:18): pid=11596 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.1" name="/root/syzkaller-testdir1541361482/syzkaller.KzthmS/56/file0/file2" dev="loop1" ino=16 res=1 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) audit: type=1800 audit(1668753805.378:19): pid=11572 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed" comm="syz-executor.1" name="file2" dev="loop1" ino=16 res=0 NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) NILFS (loop1): bad btree node (ino=16, blocknr=15): level = 0, flags = 0x0, nchildren = 0 NILFS error (device loop1): nilfs_bmap_lookup_contig: broken bmap (inode number=16) EXT4-fs (loop3): Unrecognized mount option "sma" or missing value EXT4-fs (loop5): Unrecognized mount option "sma" or missing value EXT4-fs (loop3): Unrecognized mount option "sma" or missing value kauditd_printk_skb: 7 callbacks suppressed audit: type=1804 audit(1668753806.878:27): pid=11698 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir3077790436/syzkaller.K1JsPQ/62/bus" dev="sda1" ino=14083 res=1 EXT4-fs (loop5): Unrecognized mount option "sma" or missing value audit: type=1800 audit(1668753806.878:28): pid=11698 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="bus" dev="sda1" ino=14083 res=0 F2FS-fs (loop4): Invalid blocksize (65536), supports only 4KB F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock F2FS-fs (loop4): Found nat_bits in checkpoint F2FS-fs (loop4): Mounted with checkpoint version = 3e17dab1 audit: type=1804 audit(1668753807.358:29): pid=11714 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/81/file0/bus" dev="loop4" ino=10 res=1 audit: type=1804 audit(1668753807.358:30): pid=11714 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/81/file0/bus" dev="loop4" ino=10 res=1 audit: type=1804 audit(1668753807.358:31): pid=11714 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/81/file0/bus" dev="loop4" ino=10 res=1 ISO 9660 Extensions: Microsoft Joliet Level 0 audit: type=1804 audit(1668753808.168:32): pid=11746 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir3084901278/syzkaller.T2T60t/60/bus" dev="sda1" ino=14092 res=1 audit: type=1800 audit(1668753808.168:33): pid=11746 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.3" name="bus" dev="sda1" ino=14092 res=0 audit: type=1804 audit(1668753808.238:34): pid=11747 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir3077790436/syzkaller.K1JsPQ/63/bus" dev="sda1" ino=14091 res=1 audit: type=1800 audit(1668753808.238:35): pid=11747 uid=0 auid=4294967295 ses=4294967295 op="collect_data" cause="failed(directio)" comm="syz-executor.5" name="bus" dev="sda1" ino=14091 res=0 ISO 9660 Extensions: Microsoft Joliet Level 0 F2FS-fs (loop5): Invalid blocksize (65536), supports only 4KB F2FS-fs (loop5): Can't find valid F2FS filesystem in 1th superblock F2FS-fs (loop5): Found nat_bits in checkpoint ISO 9660 Extensions: Microsoft Joliet Level 0 F2FS-fs (loop5): Mounted with checkpoint version = 3e17dab1 audit: type=1804 audit(1668753808.958:36): pid=11800 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.5" name="/root/syzkaller-testdir3077790436/syzkaller.K1JsPQ/64/file0/bus" dev="loop5" ino=10 res=1 F2FS-fs (loop4): Invalid blocksize (65536), supports only 4KB F2FS-fs (loop4): Can't find valid F2FS filesystem in 1th superblock NILFS (loop1): broken superblock, retrying with spare superblock (blocksize = 1024) NILFS (loop1): unrecognized mount option "snapshot=0x0000000000000001" squashfs: SQUASHFS error: unable to read inode lookup table unregister_netdevice: waiting for ip6gre0 to become free. Usage count = -1 kauditd_printk_skb: 26 callbacks suppressed audit: type=1804 audit(1668753812.198:63): pid=12017 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir3084901278/syzkaller.T2T60t/66/file0/bus" dev="loop3" ino=10 res=1 squashfs: SQUASHFS error: unable to read inode lookup table audit: type=1804 audit(1668753812.198:64): pid=12017 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.3" name="/root/syzkaller-testdir3084901278/syzkaller.T2T60t/66/file0/bus" dev="loop3" ino=10 res=1 audit: type=1804 audit(1668753812.198:65): pid=12017 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.3" name="/root/syzkaller-testdir3084901278/syzkaller.T2T60t/66/file0/bus" dev="loop3" ino=10 res=1 audit: type=1804 audit(1668753812.238:66): pid=12012 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/84/file0/bus" dev="loop4" ino=10 res=1 audit: type=1804 audit(1668753812.238:67): pid=12012 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="ToMToU" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/84/file0/bus" dev="loop4" ino=10 res=1 audit: type=1804 audit(1668753812.248:68): pid=12012 uid=0 auid=4294967295 ses=4294967295 op="invalid_pcr" cause="open_writers" comm="syz-executor.4" name="/root/syzkaller-testdir4064603503/syzkaller.wF717Y/84/file0/bus" dev="loop4" ino=10 res=1