serenity/Kernel
Andreas Kling 90c0f9664e Kernel: Don't keep protected Process data in a separate allocation
The previous architecture had a huge flaw: the pointer to the protected
data was itself unprotected, allowing you to overwrite it at any time.

This patch reorganizes the protected data so it's part of the Process
class itself. (Actually, it's a new ProcessBase helper class.)

We use the first 4 KB of Process objects themselves as the new storage
location for protected data. Then we make Process objects page-aligned
using MAKE_ALIGNED_ALLOCATED.

This allows us to easily turn on/off write-protection for everything in
the ProcessBase portion of Process. :^)

Thanks to @bugaevc for pointing out the flaw! This is still not perfect
but it's an improvement.
2021-03-11 14:21:49 +01:00
..
ACPI Kernel: Move Kernel CommandLine parsing to strongly typed API. 2021-03-03 11:05:16 +01:00
API Kernel+UserspaceEmulator: Add sys$emuctl() system call 2021-03-09 08:58:26 +01:00
Arch Everywhere: Remove unnecessary whitespace at the end of some lines. 2021-03-08 09:20:53 +01:00
Devices Kernel: Convert klog() => dmesgln() in VMWareBackdoor 2021-03-09 22:10:41 +01:00
FileSystem Kernel: Silence debug spam about chown and symlink during boot 2021-03-11 14:21:49 +01:00
Heap Kernel: Add MAKE_ALIGNED_ALLOCATED helper macro 2021-03-11 14:21:49 +01:00
Interrupts Everywhere: Remove unnecessary clang-format offs 2021-03-04 11:01:48 +01:00
Modules
Net Kernel: Convert klog() => dmesgln() in TCPSocket 2021-03-09 23:06:47 +01:00
PCI Everywhere: Remove unnecessary clang-format offs 2021-03-04 11:01:48 +01:00
Storage Kernel: Implement ScatterList for handling scattered DMA pages 2021-03-05 11:29:34 +01:00
Syscalls Kernel: Don't keep protected Process data in a separate allocation 2021-03-11 14:21:49 +01:00
Tasks Kernel: Make Thread use AK::Time internally 2021-03-02 08:36:08 +01:00
Time Kernel: Convert klog() => dmesgln() in HPET 2021-03-09 22:10:41 +01:00
TTY Kernel: Make kgettimeofday use AK::Time 2021-03-02 08:36:08 +01:00
VM Kernel: Add MemoryManager::set_page_writable_direct() 2021-03-11 14:21:49 +01:00
.gitignore
AddressSanitizer.cpp Kernel: Initial integration of Kernel Address Sanitizer (KASAN) 2021-02-15 11:41:53 +01:00
AddressSanitizer.h Kernel: Initial integration of Kernel Address Sanitizer (KASAN) 2021-02-15 11:41:53 +01:00
Assertions.h Everywhere: Remove unused RELEASE_ASSERT macro 2021-02-23 21:11:53 +01:00
CMakeLists.txt Kernel: Build with -Wvla 2021-03-10 16:33:55 +01:00
CMOS.cpp
CMOS.h
CommandLine.cpp Kernel: Add 'boot_prof' option to enable full system profiling on boot 2021-03-03 11:05:16 +01:00
CommandLine.h Kernel: Add 'boot_prof' option to enable full system profiling on boot 2021-03-03 11:05:16 +01:00
Console.cpp Kernel: Slap UNMAP_AFTER_INIT on a bunch more functions 2021-02-19 21:42:18 +01:00
Console.h
CoreDump.cpp Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
CoreDump.h Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
Debug.h.in Kernel: Remove ancient FIFO_DEBUG code 2021-03-09 22:10:41 +01:00
DMI.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
DMI.h Kernel: Set file size for smbios_entry_point and DMI blobs in ProcFS 2021-02-01 17:13:23 +01:00
DoubleBuffer.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
DoubleBuffer.h Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
Forward.h Kernel: Factor address space management out of the Process class 2021-02-08 18:27:28 +01:00
FutexQueue.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
FutexQueue.h
init.cpp Kernel: Convert klog() => dmesgln() in init() 2021-03-09 22:10:41 +01:00
IO.h Kernel: Remove repeated_{in,out}16() 2021-03-04 18:25:01 +01:00
KBuffer.h Kernel: Add non-const KBuffer::impl() getter 2021-03-10 22:30:02 +01:00
KBufferBuilder.cpp Kernel: Assert if rounding-up-to-page-size would wrap around to 0 2021-02-14 10:01:50 +01:00
KBufferBuilder.h Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
kprintf.cpp Kernel: Don't take debug logging lock in sprintf() 2021-02-20 17:21:53 +01:00
KResult.h Everywhere: Remove unnecessary clang-format offs 2021-03-04 11:01:48 +01:00
kstdio.h Kernel: Remove kprintf() 2021-02-17 16:33:43 +01:00
KSyms.cpp Kernel: Turn a VLA into a statically-sized array in dump_backtrace() 2021-03-10 16:23:11 +01:00
KSyms.h Kernel: Take some baby steps towards x86_64 2021-02-25 16:27:12 +01:00
linker.ld Kernel: Define a KERNEL_VIRTUAL_BASE in the linker script 2021-03-04 18:25:01 +01:00
Lock.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
Lock.h Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
LockMode.h
mkmap.sh
Module.h
Multiboot.h
Panic.cpp Kernel: Add a PANIC() function 2021-02-14 09:36:58 +01:00
Panic.h Kernel: Add a PANIC() function 2021-02-14 09:36:58 +01:00
PerformanceEventBuffer.cpp Kernel+Profiler: Capture metadata about all profiled processes 2021-03-02 22:38:06 +01:00
PerformanceEventBuffer.h Kernel+Profiler: Capture metadata about all profiled processes 2021-03-02 22:38:06 +01:00
PhysicalAddress.h Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
Process.cpp Kernel: Don't keep protected Process data in a separate allocation 2021-03-11 14:21:49 +01:00
Process.h Kernel: Don't keep protected Process data in a separate allocation 2021-03-11 14:21:49 +01:00
ProcessGroup.cpp
ProcessGroup.h
Random.cpp Kernel: Convert klog() => dmesgln() in KernelRng 2021-03-09 22:10:41 +01:00
Random.h Kernel: Make clang(?) happy about templates(?) 2021-03-02 08:36:08 +01:00
RTC.cpp Kernel: Don't assert if RTC believes we're in the past 2021-02-11 20:58:39 +01:00
RTC.h
Scheduler.cpp Kernel+Profiler: Capture metadata about all profiled processes 2021-03-02 22:38:06 +01:00
Scheduler.h Kernel: Remove ancient unused Scheduler::beep() declaration 2021-02-07 20:45:09 +01:00
SpinLock.h AK+Kernel: Remove NO_DISCARD macro hack 2021-03-03 23:08:42 +01:00
StdLib.cpp Kernel: Implement 'copy_time_from_user' functions to sanitize arguments 2021-03-02 08:36:08 +01:00
StdLib.h Kernel: Prevent using copy_from_user() for timespec/timeval 2021-03-02 08:36:08 +01:00
Syscall.cpp Kernel: Make the kernel compile & link for x86_64 2021-03-04 18:25:01 +01:00
Thread.cpp Kernel: Use dbgln_if() and PANIC() in Thread.cpp 2021-03-09 22:35:51 +01:00
Thread.h Kernel: Add bitwise operators for Thread::FileBlocker::BlockFlags enum 2021-03-08 18:47:40 +01:00
ThreadBlockers.cpp Kernel: Add bitwise operators for Thread::FileBlocker::BlockFlags enum 2021-03-08 18:47:40 +01:00
ThreadTracer.cpp Kernel: Reorganize ptrace implementation a bit 2021-02-08 19:34:41 +01:00
ThreadTracer.h Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
TimerQueue.cpp Kernel: Make TimeManagement use AK::Time internally 2021-03-02 08:36:08 +01:00
TimerQueue.h Kernel: Make TimerQueue use AK::Time in interface 2021-03-02 08:36:08 +01:00
UBSanitizer.cpp Kernel: Expose sysctl 'ubsan_is_deadly' to panic the Kernel on UB 2021-03-07 17:31:25 +01:00
UBSanitizer.h Kernel: Expose sysctl 'ubsan_is_deadly' to panic the Kernel on UB 2021-03-07 17:31:25 +01:00
UnixTypes.h Everywhere: Remove unnecessary clang-format offs 2021-03-04 11:01:48 +01:00
UnveilNode.h Everywhere: Remove a bunch of redundant 'AK::' namespace prefixes 2021-02-26 16:59:56 +01:00
UserOrKernelBuffer.cpp
UserOrKernelBuffer.h Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
VirtualAddress.h Kernel: Use default con/de-structors 2021-02-28 18:09:12 +01:00
WaitQueue.cpp Everywhere: Rename ASSERT => VERIFY 2021-02-23 20:56:54 +01:00
WaitQueue.h Kernel: Add WaitQueue::wait_forever and it use it for all infinite waits. 2021-02-15 08:28:57 +01:00