syzbot


WARNING in fscrypt_destroy_keyring

Status: fixed on 2023/04/11 15:30
Reported-by: syzbot+f392c1fbf6f8ef194b04@syzkaller.appspotmail.com
Fix commit: d77531fac6a1 fscrypt: destroy keyring after security_sb_delete()
First crash: 410d, last: 410d
Fix bisection: fixed by (bisect log) :
commit d77531fac6a1fd9f1db0195438ba5419d72b96c4
Author: Eric Biggers <ebiggers@google.com>
Date: Mon Mar 13 22:12:29 2023 +0000

  fscrypt: destroy keyring after security_sb_delete()

  
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream WARNING in fscrypt_destroy_keyring fscrypt ext4 C 2 410d 408d 22/26 fixed on 2023/06/08 14:41

Sample crash report:
EXT4-fs (loop0): Test dummy encryption mode enabled
EXT4-fs (loop0): mounted filesystem without journal. Quota mode: writeback.
fscrypt: AES-256-CTS-CBC using implementation "cts-cbc-aes-ce"
------------[ cut here ]------------
WARNING: CPU: 0 PID: 4308 at fs/crypto/keyring.c:242 fscrypt_destroy_keyring+0x174/0x244 fs/crypto/keyring.c:242
Modules linked in:
CPU: 0 PID: 4308 Comm: syz-executor377 Not tainted 6.1.17-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : fscrypt_destroy_keyring+0x174/0x244 fs/crypto/keyring.c:242
lr : fscrypt_destroy_keyring+0x174/0x244 fs/crypto/keyring.c:242
sp : ffff80001dc97970
x29: ffff80001dc97970 x28: 1ffff00002ae5aa9 x27: dfff800000000000
x26: 0000000000000000 x25: 0000000000000002 x24: 1fffe0001b2df825
x23: dfff800000000000 x22: 0000000000000002 x21: ffff0000d97c0000
x20: ffff0000c26ea000 x19: ffff0000d96fc128 x18: ffff80001dc97320
x17: ffff80001572d000 x16: ffff8000083099b4 x15: ffff8000081c35f8
x14: 1ffff00002ae60b0 x13: dfff800000000000 x12: 0000000000000001
x11: ff80800008bb2ecc x10: 0000000000000000 x9 : ffff800008bb2ecc
x8 : ffff0000d90eb680 x7 : ffff800008b5e4fc x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff800008bb2e08
x2 : 0000000000000000 x1 : 0000000000000002 x0 : 0000000000000001
Call trace:
 fscrypt_destroy_keyring+0x174/0x244 fs/crypto/keyring.c:242
 generic_shutdown_super+0xac/0x328 fs/super.c:483
 kill_block_super+0x70/0xdc fs/super.c:1441
 deactivate_locked_super+0xac/0x124 fs/super.c:332
 deactivate_super+0xf0/0x110 fs/super.c:363
 cleanup_mnt+0x394/0x41c fs/namespace.c:1186
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1193
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x554/0x1a88 kernel/exit.c:869
 do_group_exit+0x194/0x22c kernel/exit.c:1019
 __do_sys_exit_group kernel/exit.c:1030 [inline]
 __se_sys_exit_group kernel/exit.c:1028 [inline]
 __wake_up_parent+0x0/0x60 kernel/exit.c:1028
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
irq event stamp: 15414
hardirqs last  enabled at (15413): [<ffff8000083a2090>] call_rcu+0x614/0xa40 kernel/rcu/tree.c:2833
hardirqs last disabled at (15414): [<ffff80001224ba94>] el1_dbg+0x24/0x80 arch/arm64/kernel/entry-common.c:405
softirqs last  enabled at (15230): [<ffff800008020ee8>] softirq_handle_end kernel/softirq.c:414 [inline]
softirqs last  enabled at (15230): [<ffff800008020ee8>] __do_softirq+0xd88/0xff4 kernel/softirq.c:600
softirqs last disabled at (15223): [<ffff80000802b598>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:79
---[ end trace 0000000000000000 ]---
Unable to handle kernel paging request at virtual address dfff800000000003
KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
Mem abort info:
  ESR = 0x0000000096000006
  EC = 0x25: DABT (current EL), IL = 32 bits
  SET = 0, FnV = 0
  EA = 0, S1PTW = 0
  FSC = 0x06: level 2 translation fault
Data abort info:
  ISV = 0, ISS = 0x00000006
  CM = 0, WnR = 0
[dfff800000000003] address between user and kernel address ranges
Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 4308 Comm: syz-executor377 Tainted: G        W          6.1.17-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : __lock_acquire+0x104/0x764c kernel/locking/lockdep.c:4926
lr : lock_acquire+0x300/0x8e4 kernel/locking/lockdep.c:5669
sp : ffff80001dc97060
x29: ffff80001dc97300 x28: 1ffff00002ae60af x27: ffff800008bb29f0
x26: 0000000000000001 x25: ffff700003b92e30 x24: 0000000000000000
x23: 0000000000000000 x22: 0000000000000000 x21: 0000000000000000
x20: 0000000000000000 x19: 0000000000000018 x18: ffff80001dc97398
x17: ffff80001572d000 x16: ffff80001224ff0c x15: ffff8000081c35f8
x14: 1ffff00002ae60b0 x13: ffff80001dc97180 x12: dfff800000000000
x11: ffff80000830edcc x10: ffff80001573057c x9 : 00000000000000f3
x8 : 0000000000000003 x7 : ffff800008bb29f0 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000018
Call trace:
 __lock_acquire+0x104/0x764c kernel/locking/lockdep.c:4926
 lock_acquire+0x300/0x8e4 kernel/locking/lockdep.c:5669
 __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
 _raw_spin_lock+0x54/0x6c kernel/locking/spinlock.c:154
 spin_lock include/linux/spinlock.h:350 [inline]
 fscrypt_put_master_key_activeref+0xa0/0x408 fs/crypto/keyring.c:96
 put_crypt_info+0x1e4/0x29c fs/crypto/keysetup.c:512
 fscrypt_put_encryption_info+0x44/0x6c fs/crypto/keysetup.c:709
 ext4_clear_inode+0x154/0x174 fs/ext4/super.c:1445
 ext4_evict_inode+0x6ec/0x146c fs/ext4/inode.c:346
 evict+0x260/0x68c fs/inode.c:664
 iput_final fs/inode.c:1747 [inline]
 iput+0x988/0xa6c fs/inode.c:1773
 hook_sb_delete+0x688/0xa10 security/landlock/fs.c:1012
 security_sb_delete+0x50/0x94 security/security.c:922
 generic_shutdown_super+0xb4/0x328 fs/super.c:484
 kill_block_super+0x70/0xdc fs/super.c:1441
 deactivate_locked_super+0xac/0x124 fs/super.c:332
 deactivate_super+0xf0/0x110 fs/super.c:363
 cleanup_mnt+0x394/0x41c fs/namespace.c:1186
 __cleanup_mnt+0x20/0x30 fs/namespace.c:1193
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x554/0x1a88 kernel/exit.c:869
 do_group_exit+0x194/0x22c kernel/exit.c:1019
 __do_sys_exit_group kernel/exit.c:1030 [inline]
 __se_sys_exit_group kernel/exit.c:1028 [inline]
 __wake_up_parent+0x0/0x60 kernel/exit.c:1028
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
Code: f006a628 b9436108 34000208 d343fe68 (386c6908) 
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
   0:	f006a628 	adrp	x8, 0xd4c7000
   4:	b9436108 	ldr	w8, [x8, #864]
   8:	34000208 	cbz	w8, 0x48
   c:	d343fe68 	lsr	x8, x19, #3
* 10:	386c6908 	ldrb	w8, [x8, x12] <-- trapping instruction

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/03/11 16:16 linux-6.1.y 11585e2f8b9d 5205ef30 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 WARNING in fscrypt_destroy_keyring
* Struck through repros no longer work on HEAD.