mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: syzbot <syzbot+ecf337bf2c6f75c1ddd8@syzkaller.appspotmail.com>
To: a.hindborg@kernel.org, amir73il@gmail.com, leitao@debian.org,
	 linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-unionfs@vger.kernel.org, miklos@szeredi.hu,
	 syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [overlayfs?] possible deadlock in ima_path_truncate
Date: Tue, 24 Nov 2026 18:29:29 -0800	[thread overview]
Message-ID: <6b064809.e1ffc79a.44bf.0003.GAE@google.com> (raw)
In-Reply-To: <6a8e6f78.dbb3a75c.7844.0033.GAE@google.com>

syzbot has found a reproducer for the following issue on:

HEAD commit:    8d7fe9885c62 Merge tag 'hid-for-linus-2026112301' of git:/..
git tree:       git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12615bbe580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=462e918ed4cc6d73
dashboard link: https://syzkaller.appspot.com/bug?extid=ecf337bf2c6f75c1ddd8
compiler:       Debian clang version 22.1.8 (1~deb13u5), Debian LLD 22.1.8
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=112be823580000

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

======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
syz-executor272/5659 is trying to acquire lock:
ffff88801359bed0 (&ima_iint_mutex_key[depth]){+.+.}-{4:4}, at: ima_reset_action_flags security/integrity/ima/ima_main.c:709 [inline]
ffff88801359bed0 (&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:
ffff888051144478 (sb_writers#4){.+.+}-{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#4){.+.+}-{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#25){++++}-{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#4

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  rlock(sb_writers#4);
                               lock(&ovl_i_mutex_key[depth]);
                               lock(sb_writers#4);
  lock(&ima_iint_mutex_key[depth]);

 *** DEADLOCK ***

locks held by syz-executor272/5659: 1, on CPU#0:
 #0: ffff888051144478 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x41/0x90 fs/namespace.c:531

stack backtrace:
CPU: 0 UID: 0 PID: 5659 Comm: syz-executor272 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_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:0x7f0e2c62c7c7
Code: 44 00 00 31 ff e8 89 f7 ff ff 48 8b 2d f2 81 2a 00 85 c0 79 93 eb d5 48 8d 7c 1d 00 eb 99 0f 1f 44 00 00 b8 4c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 d0 ff ff ff f7 d8 64 89 02 b8
RSP: 002b:00007ffe754e2898 EFLAGS: 00000246 ORIG_RAX: 000000000000004c
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f0e2c62c7c7
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00007f0e2c69ea92
RBP: 00007ffe754e2940 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f0e2c69eab0
R13: 00007ffe754e28c0 R14: 00007ffe754e2980 R15: 00007f0e2c69e8cf
 </TASK>
CacheFiles: File cache on CacheFiles unregistering
netfs: Withdrawing cache "CacheFiles" (6 objs)

      reply	other threads:[~2026-11-25  2:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  4:45 [syzbot] [fs?] " syzbot
2026-11-25  2:29 ` 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=6b064809.e1ffc79a.44bf.0003.GAE@google.com \
    --to=syzbot+ecf337bf2c6f75c1ddd8@syzkaller.appspotmail.com \
    --cc=a.hindborg@kernel.org \
    --cc=amir73il@gmail.com \
    --cc=leitao@debian.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=syzkaller-bugs@googlegroups.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®