serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Kernel/Ext2: Kernel panic when writing a large file

Open tcl3 opened this issue 5 months ago • 0 comments

I can reliably reproduce a kernel panic when copying or creating a new large file on an ext2 filesystem.

This command can be used to reproduce the panic: dd if=/dev/zero of=test.dat bs=1M count=1024.

Stack trace:

[dd(44:44)]: ASSERTION FAILED: found_a_group
[dd(44:44)]: ./Kernel/FileSystem/Ext2FS/FileSystem.cpp:257 in AK::ErrorOr<AK::Vector<AK::DistinctNumeric<long unsigned int, Kernel::__BlockIndex_tag, AK::DistinctNumericFeature::Comparison, AK::DistinctNumericFeature::CastToBool> > > Kernel::Ext2FS::allocate_blocks(GroupIndex, size_t)
[dd(44:44)]: KERNEL PANIC! :^(
[dd(44:44)]: Aborted
[dd(44:44)]: at ./Kernel/Arch/x86_64/CPU.cpp:36 in void abort()
[dd(44:44)]: Kernel + 0x00000000009eb7ea  Kernel::__panic(char const*, unsigned int, char const*) +0x9a
[dd(44:44)]: Kernel + 0x0000000000f46266  abort +0x22e
[dd(44:44)]: Kernel + 0x0000000000f46038  abort +0x0
[dd(44:44)]: Kernel + 0x000000000050ed95  Kernel::Ext2FS::allocate_blocks(AK::DistinctNumeric<unsigned int, Kernel::__GroupIndex_tag, AK::DistinctNumericFeature::Comparison, AK::DistinctNumericFeature::CastToBool>, unsigned long) +0x9b5
[dd(44:44)]: Kernel + 0x000000000054a0ee  Kernel::Ext2FSInode::get_or_allocate_block(AK::DistinctNumeric<unsigned long, Kernel::__BlockIndex_tag, AK::DistinctNumericFeature::Comparison, AK::DistinctNumericFeature::CastToBool>, bool, bool) +0x4be
[dd(44:44)]: Kernel + 0x000000000055ca8c  Kernel::Ext2FSInode::write_bytes_locked(long, unsigned long, Kernel::UserOrKernelBuffer const&, Kernel::OpenFileDescription*) +0x73c
[dd(44:44)]: Kernel + 0x00000000005fd5c8  Kernel::Inode::prepare_and_write_bytes_locked(long, unsigned long, Kernel::UserOrKernelBuffer const&, Kernel::OpenFileDescription*) +0x268
[dd(44:44)]: Kernel + 0x00000000005fdaee  Kernel::Inode::write_bytes(long, unsigned long, Kernel::UserOrKernelBuffer const&, Kernel::OpenFileDescription*) +0xde
[dd(44:44)]: Kernel + 0x000000000062135a  Kernel::InodeFile::write(Kernel::OpenFileDescription&, unsigned long, Kernel::UserOrKernelBuffer const&, unsigned long) +0x11a
[dd(44:44)]: Kernel + 0x000000000069184d  Kernel::OpenFileDescription::write(Kernel::UserOrKernelBuffer const&, unsigned long) +0x30d
[dd(44:44)]: Kernel + 0x0000000000d69d23  Kernel::Process::do_write(Kernel::OpenFileDescription&, Kernel::UserOrKernelBuffer const&, unsigned long, AK::Optional<long>) +0xc33
[dd(44:44)]: Kernel + 0x0000000000d6ba0a  Kernel::Process::sys$write(int, AK::Userspace<unsigned char const*>, unsigned long) +0x6aa
[dd(44:44)]: Kernel + 0x0000000000d1db12  Kernel::Syscall::handle(Kernel::RegisterState&, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) +0x6d2
[dd(44:44)]: Kernel + 0x0000000000d1f250  syscall_handler +0x920
[dd(44:44)]: Kernel + 0x0000000000f89464  syscall_entry +0x54

tcl3 avatar Aug 31 '24 20:08 tcl3