All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+b8ae5f37f5baa84cb085@syzkaller.appspotmail.com>
To: asmadeus@codewreck.org, ericvh@kernel.org,
	linux-kernel@vger.kernel.org,  linux_oss@crudebyte.com,
	lucho@ionkov.net, syzkaller-bugs@googlegroups.com,
	 v9fs@lists.linux.dev
Subject: Re: [syzbot] [v9fs?] possible deadlock in __cachefiles_write
Date: Sun, 15 Nov 2026 18:08:31 -0800	[thread overview]
Message-ID: <6afa659f.920b2b3a.148c65.005a.GAE@google.com> (raw)
In-Reply-To: <6af8c1e1.aa201734.33d248.0007.GAE@google.com>

syzbot has found a reproducer for the following issue on:

HEAD commit:    fa2933aac170 Merge tag 'x86-urgent-2026-11-15' of git://gi..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1673d5a1580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=1cf189394a856f11
dashboard link: https://syzkaller.appspot.com/bug?extid=b8ae5f37f5baa84cb085
compiler:       gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=10e2e44d580000

AI-generated root cause summary:
A false-positive circular locking dependency is reported by lockdep between the
backing filesystem's freeze protection lock (`sb_writers`), the IMA integrity
cache mutex (`&ima_iint_mutex_key[depth]`), and the upper network filesystem
inode lock (`&sb->s_type->i_mutex_key`). In `do_open()` with `O_TRUNC`,
`mnt_want_write()` is held across `security_file_post_open()`, establishing
`sb_writers -> ima_iint_mutex`. During IMA file measurement on 9p,
`integrity_kernel_read()` takes 9p's `i_rwsem`, establishing `ima_iint_mutex ->
9p i_rwsem`. Finally, truncating a 9p file (`do_truncate()`) flushes dirty pages
through `netfs_writepages()` to cachefiles, where `__cachefiles_write()`
acquires `sb_writers` on the local backing filesystem. Because neither 9p nor
the local backing filesystem increments `s_stack_depth`, their distinct
per-inode `iint->mutex` instances share lockdep class `&ima_iint_mutex_key[0]`,
producing a spurious circular dependency report even though the actual lock
objects differ and cannot deadlock.

full analysis:  https://syzkaller.appspot.com/x/ai_root_cause?x=b8ae5f37f5baa84cb085

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+b8ae5f37f5baa84cb085@syzkaller.appspotmail.com

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor273/6102 is trying to acquire lock:
ffff88802c81e478 (sb_writers#5){.+.+}-{0:0}, at: __cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355

but task is already holding lock:
ffff888052ca8d00 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: inode_lock_killable include/linux/fs.h:1032 [inline]
ffff888052ca8d00 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: do_truncate+0x14e/0x240 fs/open.c:63

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sb->s_type->i_mutex_key#25){++++}-{4:4}:
       lock_acquire kernel/locking/lockdep.c:5942 [inline]
       lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
       down_read_interruptible+0x97/0x520 kernel/locking/rwsem.c:1584
       netfs_start_io_read+0x1f/0x100 fs/netfs/locking.c:67
       netfs_buffered_read_iter+0xf3/0x190 fs/netfs/buffered_read.c:940
       netfs_file_read_iter+0x10f/0x190 fs/netfs/buffered_read.c:978
       v9fs_file_read_iter+0x9b/0x100 fs/9p/vfs_file.c:369
       __kernel_read+0x397/0xac0 fs/read_write.c:512
       integrity_kernel_read+0x7e/0xb0 security/integrity/iint.c:28
       ima_calc_file_hash_tfm+0x25e/0x350 security/integrity/ima/ima_crypto.c:222
       ima_calc_file_hash+0x1e3/0x380 security/integrity/ima/ima_crypto.c:280
       ima_collect_measurement+0x952/0xb30 security/integrity/ima/ima_api.c:300
       process_measurement+0xe04/0x2360 security/integrity/ima/ima_main.c:425
       ima_file_check+0xbf/0x110 security/integrity/ima/ima_main.c:686
       security_file_post_open+0xc4/0x210 security/security.c:2777
       do_open fs/namei.c:4853 [inline]
       path_openat+0x5d0/0x23f0 fs/namei.c:5016
       do_file_open+0x20e/0x430 fs/namei.c:5045
       do_sys_openat2+0x163/0x1d0 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+0x12d/0x210 fs/open.c:1460
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #1 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}:
       lock_acquire kernel/locking/lockdep.c:5942 [inline]
       lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821
       process_measurement+0x5ab/0x2360 security/integrity/ima/ima_main.c:319
       ima_file_check+0xbf/0x110 security/integrity/ima/ima_main.c:686
       security_file_post_open+0xc4/0x210 security/security.c:2777
       do_open fs/namei.c:4853 [inline]
       path_openat+0x5d0/0x23f0 fs/namei.c:5016
       do_file_open+0x20e/0x430 fs/namei.c:5045
       do_sys_openat2+0x163/0x1d0 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+0x12d/0x210 fs/open.c:1460
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
       entry_SYSCALL_64_after_hwframe+0x77/0x7f

-> #0 (sb_writers#5){.+.+}-{0:0}:
       check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209
       check_prevs_add kernel/locking/lockdep.c:3328 [inline]
       validate_chain kernel/locking/lockdep.c:3952 [inline]
       __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288
       lock_acquire kernel/locking/lockdep.c:5942 [inline]
       lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
       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 include/linux/fs/super.h:125 [inline]
       kiocb_start_write include/linux/fs.h:2799 [inline]
       vfs_iocb_iter_write+0x1fe/0xa50 fs/read_write.c:929
       __cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355
       cachefiles_write+0xc2/0x150 fs/cachefiles/io.c:395
       cachefiles_issue_write+0x513/0x810 fs/cachefiles/io.c:607
       netfs_do_issue_write+0xee/0x340 fs/netfs/write_issue.c:256
       netfs_issue_write fs/netfs/write_issue.c:290 [inline]
       netfs_advance_write fs/netfs/write_issue.c:331 [inline]
       netfs_advance_write+0x37e/0x4c0 fs/netfs/write_issue.c:299
       netfs_write_folio fs/netfs/write_issue.c:510 [inline]
       netfs_writepages+0x10bb/0x2390 fs/netfs/write_issue.c:600
       do_writepages+0x278/0x600 mm/page-writeback.c:2562
       filemap_writeback+0x22d/0x2e0 mm/filemap.c:386
       v9fs_vfs_setattr_dotl+0x8fe/0xcf0 fs/9p/vfs_inode_dotl.c:585
       notify_change+0xb09/0x1350 fs/attr.c:556
       do_truncate+0x1df/0x240 fs/open.c:68
       handle_truncate fs/namei.c:4306 [inline]
       do_open fs/namei.c:4855 [inline]
       path_openat+0x1e93/0x23f0 fs/namei.c:5016
       do_file_open+0x20e/0x430 fs/namei.c:5045
       do_sys_openat2+0x163/0x1d0 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+0x12d/0x210 fs/open.c:1460
       do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
       do_syscall_64+0x123/0x7b0 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:
  sb_writers#5 --> &ima_iint_mutex_key[depth] --> &sb->s_type->i_mutex_key#25

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#25);
                               lock(&ima_iint_mutex_key[depth]);
                               lock(&sb->s_type->i_mutex_key#25);
  rlock(sb_writers#5);

 *** DEADLOCK ***

locks held by syz-executor273/6102: 2, on CPU#3:
 #0: ffff88802ea90478 (sb_writers#14){.+.+}-{0:0}, at: do_open fs/namei.c:4838 [inline]
 #0: ffff88802ea90478 (sb_writers#14){.+.+}-{0:0}, at: path_openat+0x1920/0x23f0 fs/namei.c:5016
 #1: ffff888052ca8d00 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: inode_lock_killable include/linux/fs.h:1032 [inline]
 #1: ffff888052ca8d00 (&sb->s_type->i_mutex_key#25){++++}-{4:4}, at: do_truncate+0x14e/0x240 fs/open.c:63

stack backtrace:
CPU: 3 UID: 0 PID: 6102 Comm: syz-executor273 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:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087
 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219
 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209
 check_prevs_add kernel/locking/lockdep.c:3328 [inline]
 validate_chain kernel/locking/lockdep.c:3952 [inline]
 __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288
 lock_acquire kernel/locking/lockdep.c:5942 [inline]
 lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899
 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 include/linux/fs/super.h:125 [inline]
 kiocb_start_write include/linux/fs.h:2799 [inline]
 vfs_iocb_iter_write+0x1fe/0xa50 fs/read_write.c:929
 __cachefiles_write+0x56f/0xd40 fs/cachefiles/io.c:355
 cachefiles_write+0xc2/0x150 fs/cachefiles/io.c:395
 cachefiles_issue_write+0x513/0x810 fs/cachefiles/io.c:607
 netfs_do_issue_write+0xee/0x340 fs/netfs/write_issue.c:256
 netfs_issue_write fs/netfs/write_issue.c:290 [inline]
 netfs_advance_write fs/netfs/write_issue.c:331 [inline]
 netfs_advance_write+0x37e/0x4c0 fs/netfs/write_issue.c:299
 netfs_write_folio fs/netfs/write_issue.c:510 [inline]
 netfs_writepages+0x10bb/0x2390 fs/netfs/write_issue.c:600
 do_writepages+0x278/0x600 mm/page-writeback.c:2562
 filemap_writeback+0x22d/0x2e0 mm/filemap.c:386
 v9fs_vfs_setattr_dotl+0x8fe/0xcf0 fs/9p/vfs_inode_dotl.c:585
 notify_change+0xb09/0x1350 fs/attr.c:556
 do_truncate+0x1df/0x240 fs/open.c:68
 handle_truncate fs/namei.c:4306 [inline]
 do_open fs/namei.c:4855 [inline]
 path_openat+0x1e93/0x23f0 fs/namei.c:5016
 do_file_open+0x20e/0x430 fs/namei.c:5045
 do_sys_openat2+0x163/0x1d0 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+0x12d/0x210 fs/open.c:1460
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x123/0x7b0 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7feefe53f45e
Code: 08 0f 85 f5 e2 ff ff 49 89 fb 48 89 f0 48 89 d7 48 89 ce 4c 89 c2 4d 89 ca 4c 8b 44 24 08 4c 8b 4c 24 10 4c 89 5c 24 08 0f 05 <c3> 90 41 57 41 56 4d 89 c6 41 55 4d 89 cd 41 54 55 53 48 83 ec 08
RSP: 002b:00007fff976f93e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 0000555558a8a400 RCX: 00007feefe53f45e
RDX: 0000000000000202 RSI: 00007feefe58e995 RDI: ffffffffffffff9c
RBP: 00007feefe58e995 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000005
R13: 00007fff976fa3f0 R14: 00007feefe58e979 R15: 0000000000000003
 </TASK>
CacheFiles: File cache on CacheFiles unregistering
netfs: Withdrawing cache "CacheFiles" (1 objs)

      reply	other threads:[~2026-11-16  2:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 20:17 [syzbot] [v9fs?] possible deadlock in __cachefiles_write syzbot
2026-11-16  2:08 ` syzbot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6afa659f.920b2b3a.148c65.005a.GAE@google.com \
    --to=syzbot+b8ae5f37f5baa84cb085@syzkaller.appspotmail.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=v9fs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.