ladybird/Kernel
Brian Gianforcaro 4b2651ddab Kernel: Track allocated FileDescriptionAndFlag elements in each Process
The way the Process::FileDescriptions::allocate() API works today means
that two callers who allocate back to back without associating a
FileDescription with the allocated FD, will receive the same FD and thus
one will stomp over the other.

Naively tracking which FileDescriptions are allocated and moving onto
the next would introduce other bugs however, as now if you "allocate"
a fd and then return early further down the control flow of the syscall
you would leak that fd.

This change modifies this behavior by tracking which descriptions are
allocated and then having an RAII type to "deallocate" the fd if the
association is not setup the end of it's scope.
2021-07-28 19:07:00 +02:00
..
ACPI Kernel: Don't truncate physical address in ACPI table to 32 bits 2021-07-18 22:09:05 +02:00
API Kernel+LibSystem: Add a 4th syscall argument 2021-07-25 14:08:50 +02:00
Arch Kernel: Fix CPU initialization for SMP 2021-07-27 19:45:38 +02:00
Bus Kernel: Remove ContiguousVMObject, let AnonymousVMObject do the job 2021-07-25 18:44:47 +02:00
Devices Kernel: Fix integer overflow in KCOV_SETBUFSIZE ioctl 2021-07-26 23:52:15 +02:00
FileSystem Kernel/ProcFS: Add S_IFREG bit to regular files in /proc 2021-07-28 18:55:38 +02:00
Graphics Prekernel: Export some multiboot parameters in our own BootInfo struct 2021-07-27 13:15:16 +02:00
Heap Kernel+AK: Generate compile-time error for non-sized delete 2021-07-16 20:51:13 +02:00
Interrupts Kernel: Use IntrusiveList for keeping track of GenericInterruptHandlers 2021-07-21 20:21:29 +02:00
Modules
Net Kernel: Make LoopbackAdapter always link up 2021-07-27 00:28:12 +02:00
Prekernel Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
Storage Kernel: Consolidate API for creating AnonymousVMObject with given pages 2021-07-22 09:17:02 +02:00
Syscalls Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
Tasks
Time Everywhere: Make tracking cpu usage independent from system ticks 2021-07-18 22:08:26 +02:00
TTY Kernel: Modify the IOCTL API to return KResult 2021-07-27 01:23:37 +04:30
VirtIO
VM Kernel: Improve some comments in Space 2021-07-27 15:04:36 +02:00
AddressSanitizer.cpp
AddressSanitizer.h
Assertions.h
AtomicEdgeAction.h
BootInfo.h Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
CMakeLists.txt Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
CMOS.cpp
CMOS.h
CommandLine.cpp Kernel: Un-unmap-after-init CommandLine::boot_mode() 2021-07-26 11:33:14 +02:00
CommandLine.h
ConsoleDevice.cpp
ConsoleDevice.h
CoreDump.cpp
CoreDump.h
Debug.h.in
DoubleBuffer.cpp Kernel: Rename Locker => MutexLocker 2021-07-18 01:53:04 +02:00
DoubleBuffer.h Kernel: Rename Lock to Mutex 2021-07-17 21:10:32 +02:00
embedmap.sh Kernel: Make new kernel build process work on macOS 2021-07-15 11:04:30 +02:00
Forward.h Kernel: Introduce ProcessorSpecific<T> for per-CPU data structures 2021-07-27 14:32:30 +02:00
FutexQueue.cpp
FutexQueue.h
GlobalProcessExposed.cpp Kernel/ProcFS: Make various things superuser-only once again 2021-07-28 18:59:53 +02:00
init.cpp Kernel: Mark the stack check guard as READONLY_AFTER_INIT 2021-07-27 14:50:10 +02:00
IO.h
KBuffer.h
KBufferBuilder.cpp Kernel: Remove KBufferBuilder's can_expand restriction 2021-07-20 18:05:05 +02:00
KBufferBuilder.h Kernel: Remove KBufferBuilder's can_expand restriction 2021-07-20 18:05:05 +02:00
KLexicalPath.cpp
KLexicalPath.h
kprintf.cpp
KResult.h
kstdio.h
KString.cpp
KString.h
KSyms.cpp Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
KSyms.h
linker.ld Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
LockMode.h
MiniStdLib.cpp Kernel: Introduce basic pre-kernel environment 2021-07-18 17:31:13 +02:00
mkmap.sh Kernel: Introduce basic pre-kernel environment 2021-07-18 17:31:13 +02:00
Module.h
Multiboot.h Prekernel: Export some multiboot parameters in our own BootInfo struct 2021-07-27 13:15:16 +02:00
Mutex.cpp Kernel: Rename Lock to Mutex 2021-07-17 21:10:32 +02:00
Mutex.h Kernel: Allow MutexLocker to be conditionally initialized 2021-07-20 03:21:14 +02:00
Panic.cpp Kernel: Shutdown on panic in self-test mode 2021-07-27 01:25:04 +04:30
Panic.h
PerformanceEventBuffer.cpp Kernel: Rename PerformanceEvent methods to be more ARCH independent 2021-07-19 08:46:55 +02:00
PerformanceEventBuffer.h Kernel: Rename PerformanceEvent methods to be more ARCH independent 2021-07-19 08:46:55 +02:00
PerformanceManager.h Kernel: Rename PerformanceEvent methods to be more ARCH independent 2021-07-19 08:46:55 +02:00
PhysicalAddress.h
Process.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
Process.h Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
ProcessExposed.cpp Kernel: Simplify ProcFS generated buffer caching 2021-07-20 18:05:05 +02:00
ProcessExposed.h Kernel/ProcFS: Make various things superuser-only once again 2021-07-28 18:59:53 +02:00
ProcessGroup.cpp
ProcessGroup.h Kernel: Rename Lock to Mutex 2021-07-17 21:10:32 +02:00
ProcessSpecificExposed.cpp Kernel: Make purgeable memory a VMObject level concept (again) 2021-07-25 17:28:05 +02:00
Random.cpp Kernel: Rename Locker => MutexLocker 2021-07-18 01:53:04 +02:00
Random.h Kernel: Rename Lock to Mutex 2021-07-17 21:10:32 +02:00
RTC.cpp
RTC.h
SanCov.cpp Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
Scheduler.cpp Kernel: Introduce ProcessorSpecific<T> for per-CPU data structures 2021-07-27 14:32:30 +02:00
Scheduler.h Kernel: Remove unused Scheduler::yield_from_critical() 2021-07-26 00:39:10 +02:00
Sections.h Kernel: Support loading the kernel at almost arbitrary virtual addresses 2021-07-27 13:15:16 +02:00
SpinLock.h
StdLib.cpp Kernel: Introduce basic pre-kernel environment 2021-07-18 17:31:13 +02:00
StdLib.h
Syscall.cpp Kernel+LibSystem: Add a 4th syscall argument 2021-07-25 14:08:50 +02:00
Thread.cpp Kernel: Add option to build with coverage instrumentation and KCOV 2021-07-26 17:40:28 +02:00
Thread.h Kernel: Push ARCH specific ifdef's down into RegisterState functions 2021-07-19 08:46:55 +02:00
ThreadBlockers.cpp Kernel: Fix bogus check in Thread::WaitBlockCondition::finalize() 2021-07-16 15:18:47 +02:00
ThreadTracer.cpp
ThreadTracer.h
TimerQueue.cpp
TimerQueue.h
UBSanitizer.cpp
UnixTypes.h Kernel: Support ioctl SIOCSARP and SIOCDARP 2021-07-25 17:57:08 +02:00
UnveilNode.h
UserOrKernelBuffer.cpp Kernel: Add an API for turning a UserOrKernelBuffer into a KString 2021-07-17 22:07:49 +02:00
UserOrKernelBuffer.h Kernel: Add an API for turning a UserOrKernelBuffer into a KString 2021-07-17 22:07:49 +02:00
VirtualAddress.h Kernel: Make VirtualAddress::page_base() work with 64-bit addresses 2021-07-18 17:31:13 +02:00
WaitQueue.cpp
WaitQueue.h
WorkQueue.cpp
WorkQueue.h