ladybird/Kernel/FileSystem
Andreas Kling 16850423cf Kernel: Fix deadlock caused by page faults while holding disk cache lock
If the data passed to sys$write() is backed by a not-yet-paged-in inode
mapping, we could end up in a situation where we get a page fault when
trying to copy data from userspace.

If that page fault handler tried reading from an inode that someone else
had locked while waiting for the disk cache lock, we'd deadlock.

This patch fixes the issue by copying the userspace data into a local
buffer before acquiring the disk cache lock. This is not ideal since it
incurs an extra copy, and I'm sure we can think of a better solution
eventually.

This was a frequent cause of startup deadlocks on x86_64 for me. :^)
2021-12-26 00:42:51 +01:00
..
AnonymousFile.cpp Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T> 2021-11-08 01:10:53 +01:00
AnonymousFile.h Everywhere: Fix -Winconsistent-missing-override warnings from Clang 2021-12-11 13:14:15 -08:00
BlockBasedFileSystem.cpp Kernel: Fix deadlock caused by page faults while holding disk cache lock 2021-12-26 00:42:51 +01:00
BlockBasedFileSystem.h Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T> 2021-11-08 01:10:53 +01:00
Custody.cpp Kernel: Add implied auto-specifiers in FileSystem 2021-12-15 23:34:11 -08:00
Custody.h Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T> 2021-11-08 01:10:53 +01:00
DeviceFileTypes.h Kernel: Make major and minor numbers to be DistinctNumerics 2021-12-23 23:02:39 +01:00
DevPtsFS.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
DevPtsFS.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
DevTmpFS.cpp Kernel: Make major and minor numbers to be DistinctNumerics 2021-12-23 23:02:39 +01:00
DevTmpFS.h Kernel: Make major and minor numbers to be DistinctNumerics 2021-12-23 23:02:39 +01:00
ext2_fs.h Everywhere: Behaviour => Behavior 2021-09-07 13:53:14 +02:00
ext2_types.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Ext2FileSystem.cpp Kernel+LibC: Move errno definitions to Kernel/API/POSIX 2021-12-16 22:21:35 +03:30
Ext2FileSystem.h Kernel: Always initialize ext2_inode and ext_super_block structs 2021-12-22 13:29:31 -08:00
FIFO.cpp Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
FIFO.h Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
File.cpp Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T> 2021-11-08 01:10:53 +01:00
File.h Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
FileBackedFileSystem.cpp Kernel: Rename FileDescription => OpenFileDescription 2021-09-07 13:53:14 +02:00
FileBackedFileSystem.h Kernel: Rename FileDescription => OpenFileDescription 2021-09-07 13:53:14 +02:00
FileSystem.cpp Kernel: Use DistinctNumeric for filesystem ID's 2021-11-18 21:11:30 +01:00
FileSystem.h Kernel: Use DistinctNumeric for filesystem ID's 2021-11-18 21:11:30 +01:00
Inode.cpp Kernel: Use copy_typed_from_user() in more places :^) 2021-12-18 11:30:10 +01:00
Inode.h Kernel: Remove unused Inode::preopen_fd() 2021-12-06 19:22:16 +01:00
InodeFile.cpp Kernel+LibC: Move errno definitions to Kernel/API/POSIX 2021-12-16 22:21:35 +03:30
InodeFile.h Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
InodeIdentifier.h Kernel: Use DistinctNumeric for filesystem ID's 2021-11-18 21:11:30 +01:00
InodeMetadata.h Kernel: Make major and minor numbers to be DistinctNumerics 2021-12-23 23:02:39 +01:00
InodeWatcher.cpp Kernel: Handle string format errors in FileSystem APIs :^) 2021-11-30 11:16:35 +01:00
InodeWatcher.h Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T> 2021-11-08 01:10:53 +01:00
ISO9660FileSystem.cpp Kernel: Add implied auto-specifiers in FileSystem 2021-12-15 23:34:11 -08:00
ISO9660FileSystem.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Mount.cpp Kernel: Make VirtualFileSystem::Mount a top-level class 2021-07-11 00:51:06 +02:00
Mount.h Kernel: Fix missing include in FileSystem/Mount.h 2021-12-15 23:34:11 -08:00
OpenFileDescription.cpp Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
OpenFileDescription.h Kernel: Make File::stat() & friends return Error<struct stat> 2021-12-18 11:30:10 +01:00
Plan9FileSystem.cpp Kernel: Remove else statements after return in Plan9FileSystem.cpp 2021-12-15 23:34:11 -08:00
Plan9FileSystem.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
ProcFS.cpp Kernel+LibC: Move errno definitions to Kernel/API/POSIX 2021-12-16 22:21:35 +03:30
ProcFS.h Everywhere: Fix -Winconsistent-missing-override warnings from Clang 2021-12-11 13:14:15 -08:00
SysFS.cpp Kernel: Add implied auto-specifiers in FileSystem 2021-12-15 23:34:11 -08:00
SysFS.h Kernel/SysFS: Prevent allocation for component name during construction 2021-12-14 09:01:33 +01:00
SysFSComponent.cpp Kernel/SysFS: Prevent allocation for component name during construction 2021-12-14 09:01:33 +01:00
SysFSComponent.h Kernel/SysFS: Prevent allocation for component name during construction 2021-12-14 09:01:33 +01:00
TmpFS.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
TmpFS.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
UnveilNode.h Kernel: Move UnveilNode.h into Kernel/FileSystem/ 2021-08-06 14:11:45 +02:00
VirtualFileSystem.cpp Kernel: Move symlink recursion limit to .h, increase it to 8 2021-12-21 12:54:11 -08:00
VirtualFileSystem.h Kernel: Move symlink recursion limit to .h, increase it to 8 2021-12-21 12:54:11 -08:00