ladybird/Kernel/Devices
Sahan Fernando d0f314b23c Kernel: Fix subtle race condition in sys$write implementation
There is a slight race condition in our implementation of write().
We call File::can_write() before attempting to write to it (blocking if
it returns false). If it returns true, we assume that we can write to
the file, and our code assumes that File::write() cannot possibly fail
by being blocked. There is, however, the rare case where another process
writes to the file and prevents further writes in between the call to
Files::can_write() and File::write() in the first process. This would
result in the first process calling File::write() when it cannot be
written to.

We fix this by adding a mechanism for File::can_write() to signal that
it was blocked, making it the responsibilty of File::write() to check
whether it can write and then finally making sys$write() check if the
write failed due to it being blocked.
2021-05-18 16:33:15 +02:00
..
HID Kernel: Print scheduler state to the display console 2021-05-16 19:58:33 +02:00
USB Kernel: Fix UHCIController singleton startup null-deref race condition. 2021-05-15 09:46:41 +02:00
AsyncDeviceRequest.cpp Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
AsyncDeviceRequest.h Kernel: Make UserOrKernelBuffer R/W helpers return KResultOr<size_t> 2021-05-13 23:28:40 +02:00
BlockDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
BlockDevice.h Kernel: Mark AsyncBlockDeviceRequest + AnonymousVMObject as final 2021-05-03 16:03:17 +02:00
CharacterDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
CharacterDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Device.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Device.h AK: Rename adopt() to adopt_ref() 2021-04-23 16:46:57 +02:00
FullDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
FullDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
MemoryDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
MemoryDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NullDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NullDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
PCISerialDevice.cpp Kernel: Add support for multiple serial ports per device 2021-05-18 16:31:39 +02:00
PCISerialDevice.h Kernel: Add support for QEMU's emulated pci serial (-pci-serial option) 2021-05-17 19:45:35 +01:00
PCSpeaker.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
PCSpeaker.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
RandomDevice.cpp Kernel: Make UserOrKernelBuffer R/W helpers return KResultOr<size_t> 2021-05-13 23:28:40 +02:00
RandomDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SB16.cpp Kernel: Make AnonymousVMObject physical page APIs OOM safe 2021-05-15 09:01:32 +02:00
SB16.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SerialDevice.cpp Kernel: Fix subtle race condition in sys$write implementation 2021-05-18 16:33:15 +02:00
SerialDevice.h Kernel: Fix subtle race condition in sys$write implementation 2021-05-18 16:33:15 +02:00
VMWareBackdoor.cpp Kernel: Remove unused header includes from various files. 2021-05-03 16:03:17 +02:00
VMWareBackdoor.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ZeroDevice.cpp Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ZeroDevice.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00