Re: [syzbot] [fscrypt?] WARNING in fscrypt_destroy_keyring

From: Eric Biggers
Date: Mon Mar 13 2023 - 18:17:55 EST


On Mon, Mar 13, 2023 at 08:53:55AM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: fe15c26ee26e Linux 6.3-rc1
> git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
> console output: https://syzkaller.appspot.com/x/log.txt?x=14e2d88ac80000
> kernel config: https://syzkaller.appspot.com/x/.config?x=7573cbcd881a88c9
> dashboard link: https://syzkaller.appspot.com/bug?extid=93e495f6a4f748827c88
> compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
> userspace arch: arm64
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16171188c80000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15ac08dac80000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/89d41abd07bd/disk-fe15c26e.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/fa75f5030ade/vmlinux-fe15c26e.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/590d0f5903ee/Image-fe15c26e.gz.xz
> mounted in repro: https://storage.googleapis.com/syzbot-assets/bf3b409baf10/mount_0.gz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+93e495f6a4f748827c88@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> EXT4-fs (loop0): mounted filesystem 76b65be2-f6da-4727-8c75-0525a5b65a09 without journal. Quota mode: writeback.
> fscrypt: AES-256-CTS-CBC using implementation "cts-cbc-aes-ce"
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 5945 at fs/crypto/keyring.c:237 fscrypt_destroy_keyring+0x164/0x240 fs/crypto/keyring.c:237

Very impressive find by syzbot! fscrypt_destroy_keyring() needs to be called
after security_sb_delete(), not before. Fix is
https://lore.kernel.org/linux-fscrypt/20230313221231.272498-2-ebiggers@xxxxxxxxxx

- Eric