overlayfs: missing 'lowerdir' loop0: detected capacity change from 32768 to 0 ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.0.0/5363 is trying to acquire lock: ffff888044ba9bb8 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: ima_reset_action_flags security/integrity/ima/ima_main.c:709 [inline] ffff888044ba9bb8 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: ima_path_truncate+0xd3/0x190 security/integrity/ima/ima_main.c:718 but task is already holding lock: ffff88804310c478 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:531 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 (sb_writers#12){.+.+}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read_freezable include/linux/percpu-rwsem.h:83 [inline] __sb_start_write include/linux/fs/super.h:19 [inline] sb_start_write+0x48/0x1c0 include/linux/fs/super.h:125 mnt_want_write+0x41/0x90 fs/namespace.c:531 ovl_xattr_set+0x15c/0x5e0 fs/overlayfs/xattrs.c:61 __vfs_setxattr+0x442/0x480 fs/xattr.c:223 __vfs_setxattr_noperm+0x12a/0x660 fs/xattr.c:257 vfs_setxattr+0x151/0x370 fs/xattr.c:344 cachefiles_preset_object_xattr+0x142/0x3e0 fs/cachefiles/xattr.c:58 cachefiles_create_tmpfile+0x3e7/0x790 fs/cachefiles/namei.c:455 cachefiles_create_file+0x78/0x140 fs/cachefiles/namei.c:487 cachefiles_look_up_object+0x38c/0x7b0 fs/cachefiles/namei.c:622 cachefiles_lookup_cookie+0x374/0x750 fs/cachefiles/interface.c:125 fscache_perform_lookup fs/netfs/fscache_cookie.c:518 [inline] fscache_cookie_state_machine fs/netfs/fscache_cookie.c:729 [inline] fscache_cookie_worker+0xa77/0x1170 fs/netfs/fscache_cookie.c:835 process_one_work kernel/workqueue.c:3495 [inline] process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659 kthread+0x38b/0x480 kernel/kthread.c:436 ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #2 (&ovl_i_mutex_key[depth]){+.+.}-{4:4}: down_write+0x91/0x200 kernel/locking/rwsem.c:1631 inode_lock include/linux/fs.h:1027 [inline] ovl_write_iter+0x1fb/0x3b0 fs/overlayfs/file.c:358 vfs_iocb_iter_write+0x245/0x5e0 fs/read_write.c:930 __cachefiles_write+0x6c9/0xbd0 fs/cachefiles/io.c:355 netfs_issue_write fs/netfs/write_issue.c:290 [inline] netfs_advance_write+0x328/0x4b0 fs/netfs/write_issue.c:331 netfs_write_folio fs/netfs/write_issue.c:510 [inline] netfs_writepages+0x12d3/0x22b0 fs/netfs/write_issue.c:600 do_writepages+0x338/0x560 mm/page-writeback.c:2562 filemap_writeback mm/filemap.c:386 [inline] filemap_fdatawrite_range mm/filemap.c:411 [inline] filemap_fdatawrite+0x1e9/0x2f0 mm/filemap.c:417 v9fs_vfs_setattr_dotl+0x4dc/0xab0 fs/9p/vfs_inode_dotl.c:585 notify_change+0xbba/0xea0 fs/attr.c:556 do_truncate+0x1c2/0x250 fs/open.c:68 handle_truncate fs/namei.c:4306 [inline] do_open fs/namei.c:4855 [inline] path_openat+0x18a6/0x20f0 fs/namei.c:5016 do_file_open+0x23e/0x4a0 fs/namei.c:5045 do_sys_openat2+0x115/0x200 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_sys_openat fs/open.c:1465 [inline] __se_sys_openat fs/open.c:1460 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&sb->s_type->i_mutex_key#26){++++}-{4:4}: down_read_interruptible+0x4b/0x3b0 kernel/locking/rwsem.c:1584 netfs_start_io_read+0x25/0x180 fs/netfs/locking.c:67 netfs_buffered_read_iter+0xd6/0x160 fs/netfs/buffered_read.c:940 __kernel_read+0x4ca/0x960 fs/read_write.c:512 integrity_kernel_read+0x89/0xd0 security/integrity/iint.c:28 ima_calc_file_hash_tfm security/integrity/ima/ima_crypto.c:222 [inline] ima_calc_file_hash+0x451/0x890 security/integrity/ima/ima_crypto.c:280 ima_collect_measurement+0x51b/0xa00 security/integrity/ima/ima_api.c:300 process_measurement+0x1272/0x1c10 security/integrity/ima/ima_main.c:425 ima_file_check+0xdc/0x130 security/integrity/ima/ima_main.c:686 security_file_post_open+0xb3/0x260 security/security.c:2777 do_open fs/namei.c:4853 [inline] path_openat+0x1748/0x20f0 fs/namei.c:5016 do_file_open+0x23e/0x4a0 fs/namei.c:5045 do_sys_openat2+0x115/0x200 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_sys_openat fs/open.c:1465 [inline] __se_sys_openat fs/open.c:1460 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1460 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 ima_reset_action_flags security/integrity/ima/ima_main.c:709 [inline] ima_path_truncate+0xd3/0x190 security/integrity/ima/ima_main.c:718 security_path_truncate+0x1d0/0x310 security/security.c:1578 vfs_truncate+0x46e/0x540 fs/open.c:116 ksys_truncate+0xf3/0x1c0 fs/open.c:142 __do_sys_truncate fs/open.c:154 [inline] __se_sys_truncate fs/open.c:152 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:152 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &ima_iint_mutex_key[depth] --> &ovl_i_mutex_key[depth] --> sb_writers#12 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- rlock(sb_writers#12); lock(&ovl_i_mutex_key[depth]); lock(sb_writers#12); lock(&ima_iint_mutex_key[depth]); *** DEADLOCK *** locks held by syz.0.0/5363: 1, on CPU#0: #0: ffff88804310c478 (sb_writers#12){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:531 stack backtrace: CPU: 0 UID: 0 PID: 5363 Comm: syz.0.0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2087 check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2219 check_prev_add kernel/locking/lockdep.c:3209 [inline] check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x164c/0x2de0 kernel/locking/lockdep.c:5288 lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5942 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x197/0x15a0 kernel/locking/mutex.c:821 ima_reset_action_flags security/integrity/ima/ima_main.c:709 [inline] ima_path_truncate+0xd3/0x190 security/integrity/ima/ima_main.c:718 security_path_truncate+0x1d0/0x310 security/security.c:1578 vfs_truncate+0x46e/0x540 fs/open.c:116 ksys_truncate+0xf3/0x1c0 fs/open.c:142 __do_sys_truncate fs/open.c:154 [inline] __se_sys_truncate fs/open.c:152 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:152 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x171/0x540 arch/x86/entry/syscall_64.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f392f7a9519 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f39306effe8 EFLAGS: 00000246 ORIG_RAX: 000000000000004c RAX: ffffffffffffffda RBX: 00007f392fa36090 RCX: 00007f392f7a9519 RDX: 0000000000000000 RSI: 0000000000008da6 RDI: 0000200000000140 RBP: 00007f392f839136 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f392fa36128 R14: 00007f392fa36090 R15: 00007ffe35465cb8