syzbot
possible deadlock in __blk_crypto_evict_key
Status:
upstream: reported on 2026/09/04 20:10
Subsystems:
crypto
Labels:
prio:high
[Documentation on labels]
Reported-by: syzbot+20d60aafd9a0d1f2a380@syzkaller.appspotmail.com
First crash: 4d02h, last: 12h48m
Sample crash report:
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Not tainted
------------------------------------------------------
kswapd0/72 is trying to acquire lock:
ffff88803f7de4c8 (&profile->lock){++++}-{4:4}, at: blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline]
ffff88803f7de4c8 (&profile->lock){++++}-{4:4}, at: __blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359
but task is already holding lock:
ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:7177 [inline]
ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xa08/0x32c0 mm/vmscan.c:7555
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (fs_reclaim){+.+.}-{0:0}:
__fs_reclaim_acquire mm/page_alloc.c:4375 [inline]
fs_reclaim_acquire+0x71/0x100 mm/page_alloc.c:4389
might_alloc include/linux/sched/mm.h:316 [inline]
slab_pre_alloc_hook mm/slub.c:4636 [inline]
slab_alloc_node mm/slub.c:4974 [inline]
__do_kmalloc_node mm/slub.c:5413 [inline]
__kmalloc_noprof+0xbc/0x720 mm/slub.c:5439
_kmalloc_noprof include/linux/slab.h:995 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
adiantum_setkey+0x139/0x620 crypto/adiantum.c:129
crypto_skcipher_setkey+0x2a3/0x460 crypto/skcipher.c:422
crypto_sync_skcipher_setkey include/crypto/skcipher.h:621 [inline]
blk_crypto_fallback_keyslot_program+0x1ad/0x440 block/blk-crypto-fallback.c:122
blk_crypto_get_keyslot+0x941/0x1070 block/blk-crypto-profile.c:295
blk_crypto_fallback_encrypt_bio block/blk-crypto-fallback.c:362 [inline]
blk_crypto_fallback_bio_prep+0x424/0x1b40 block/blk-crypto-fallback.c:505
blk_crypto_submit_bio include/linux/blk-crypto.h:211 [inline]
f2fs_submit_write_bio+0x11b/0x2e0 fs/f2fs/data.c:575
__submit_merged_bio+0x258/0x6a0 fs/f2fs/data.c:590
__f2fs_submit_merged_write fs/f2fs/data.c:682 [inline]
__submit_merged_write_cond+0x3c9/0x4e0 fs/f2fs/data.c:706
f2fs_submit_merged_write_cond fs/f2fs/data.c:731 [inline]
f2fs_write_cache_pages fs/f2fs/data.c:3495 [inline]
__f2fs_write_data_pages fs/f2fs/data.c:3603 [inline]
f2fs_write_data_pages+0x2a27/0x36f0 fs/f2fs/data.c:3641
do_writepages+0x338/0x560 mm/page-writeback.c:2560
filemap_writeback mm/filemap.c:387 [inline]
filemap_fdatawrite_range mm/filemap.c:412 [inline]
file_write_and_wait_range+0x36e/0x440 mm/filemap.c:786
f2fs_do_sync_file+0x69d/0x1960 fs/f2fs/file.c:359
generic_write_sync include/linux/fs.h:2686 [inline]
f2fs_file_write_iter+0x68e/0x2920 fs/f2fs/file.c:5720
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x612/0xba0 fs/read_write.c:687
ksys_write+0x150/0x270 fs/read_write.c:739
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x166/0x520 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
-> #0 (&profile->lock){++++}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3181 [inline]
check_prevs_add kernel/locking/lockdep.c:3300 [inline]
validate_chain kernel/locking/lockdep.c:3924 [inline]
__lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908
down_write+0x96/0x200 kernel/locking/rwsem.c:1631
blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline]
__blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359
blk_crypto_evict_key+0x230/0x3c0 block/blk-crypto.c:443
fscrypt_destroy_inline_crypt_key+0x1b9/0x260 fs/crypto/block.c:164
fscrypt_destroy_prepared_key fs/crypto/keysetup.c:173 [inline]
put_crypt_info+0x110/0x2f0 fs/crypto/keysetup.c:560
fscrypt_put_encryption_info+0xf6/0x140 fs/crypto/keysetup.c:786
f2fs_evict_inode+0x1c9f/0x21f0 fs/f2fs/inode.c:1105
evict+0x624/0xb50 fs/inode.c:822
dispose_list fs/inode.c:864 [inline]
prune_icache_sb+0x223/0x2d0 fs/inode.c:1011
super_cache_scan+0x3f5/0x500 fs/super.c:240
do_shrink_slab+0x6d0/0x10e0 mm/shrinker.c:443
shrink_slab_memcg mm/shrinker.c:560 [inline]
shrink_slab+0x838/0x1220 mm/shrinker.c:638
shrink_one+0x2a2/0x730 mm/vmscan.c:5119
shrink_many mm/vmscan.c:5180 [inline]
lru_gen_shrink_node mm/vmscan.c:5258 [inline]
shrink_node+0x35d0/0x3e30 mm/vmscan.c:6247
kswapd_shrink_node mm/vmscan.c:7101 [inline]
balance_pgdat mm/vmscan.c:7279 [inline]
kswapd+0x185e/0x32c0 mm/vmscan.c:7555
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
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(fs_reclaim);
lock(&profile->lock);
lock(fs_reclaim);
lock(&profile->lock);
*** DEADLOCK ***
locks held by kswapd0/72: 2, last CPU#0:
#0: ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat mm/vmscan.c:7177 [inline]
#0: ffffffff8ee91d60 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0xa08/0x32c0 mm/vmscan.c:7555
#1: ffff88801fc4e0e8 (&type->s_umount_key#52){.+.+}-{4:4}, at: super_trylock_shared fs/super.c:688 [inline]
#1: ffff88801fc4e0e8 (&type->s_umount_key#52){.+.+}-{4:4}, at: super_cache_scan+0x94/0x500 fs/super.c:213
stack backtrace:
CPU: 0 UID: 0 PID: 72 Comm: kswapd0 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:2059
check_noncircular+0x12f/0x150 kernel/locking/lockdep.c:2191
check_prev_add kernel/locking/lockdep.c:3181 [inline]
check_prevs_add kernel/locking/lockdep.c:3300 [inline]
validate_chain kernel/locking/lockdep.c:3924 [inline]
__lock_acquire+0x15ff/0x2e50 kernel/locking/lockdep.c:5254
lock_acquire+0x115/0x350 kernel/locking/lockdep.c:5908
down_write+0x96/0x200 kernel/locking/rwsem.c:1631
blk_crypto_hw_enter block/blk-crypto-profile.c:55 [inline]
__blk_crypto_evict_key+0x111/0x5e0 block/blk-crypto-profile.c:359
blk_crypto_evict_key+0x230/0x3c0 block/blk-crypto.c:443
fscrypt_destroy_inline_crypt_key+0x1b9/0x260 fs/crypto/block.c:164
fscrypt_destroy_prepared_key fs/crypto/keysetup.c:173 [inline]
put_crypt_info+0x110/0x2f0 fs/crypto/keysetup.c:560
fscrypt_put_encryption_info+0xf6/0x140 fs/crypto/keysetup.c:786
f2fs_evict_inode+0x1c9f/0x21f0 fs/f2fs/inode.c:1105
evict+0x624/0xb50 fs/inode.c:822
dispose_list fs/inode.c:864 [inline]
prune_icache_sb+0x223/0x2d0 fs/inode.c:1011
super_cache_scan+0x3f5/0x500 fs/super.c:240
do_shrink_slab+0x6d0/0x10e0 mm/shrinker.c:443
shrink_slab_memcg mm/shrinker.c:560 [inline]
shrink_slab+0x838/0x1220 mm/shrinker.c:638
shrink_one+0x2a2/0x730 mm/vmscan.c:5119
shrink_many mm/vmscan.c:5180 [inline]
lru_gen_shrink_node mm/vmscan.c:5258 [inline]
shrink_node+0x35d0/0x3e30 mm/vmscan.c:6247
kswapd_shrink_node mm/vmscan.c:7101 [inline]
balance_pgdat mm/vmscan.c:7279 [inline]
kswapd+0x185e/0x32c0 mm/vmscan.c:7555
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
</TASK>
* Struck through repros no longer work on HEAD.