ladybird/Kernel/VM
Andreas Kling 9eef39d68a Kernel: Start implementing x86 SMAP support
Supervisor Mode Access Prevention (SMAP) is an x86 CPU feature that
prevents the kernel from accessing userspace memory. With SMAP enabled,
trying to read/write a userspace memory address while in the kernel
will now generate a page fault.

Since it's sometimes necessary to read/write userspace memory, there
are two new instructions that quickly switch the protection on/off:
STAC (disables protection) and CLAC (enables protection.)
These are exposed in kernel code via the stac() and clac() helpers.

There's also a SmapDisabler RAII object that can be used to ensure
that you don't forget to re-enable protection before returning to
userspace code.

THis patch also adds copy_to_user(), copy_from_user() and memset_user()
which are the "correct" way of doing things. These functions allow us
to briefly disable protection for a specific purpose, and then turn it
back on immediately after it's done. Going forward all kernel code
should be moved to using these and all uses of SmapDisabler are to be
considered FIXME's.

Note that we're not realizing the full potential of this feature since
I've used SmapDisabler quite liberally in this initial bring-up patch.
2020-01-05 18:14:51 +01:00
..
AnonymousVMObject.cpp Kernel: Use a FixedArray for VMObject::m_physical_pages 2019-08-07 20:12:50 +02:00
AnonymousVMObject.h Kernel: Start implementing purgeable memory support 2019-12-09 19:12:38 +01:00
InodeVMObject.cpp Kernel: InodeVMObject can't call Inode::size() with interrupts disabled 2020-01-03 15:40:03 +01:00
InodeVMObject.h Kernel: InodeVMObject can't call Inode::size() with interrupts disabled 2020-01-03 15:40:03 +01:00
MemoryManager.cpp Kernel: Start implementing x86 SMAP support 2020-01-05 18:14:51 +01:00
MemoryManager.h Kernel: Mask kernel addresses in backtraces and profiles 2020-01-02 20:51:31 +01:00
PageDirectory.cpp Kernel: Enable PAE (Physical Address Extension) 2019-12-25 13:35:57 +01:00
PageDirectory.h Kernel: Enable PAE (Physical Address Extension) 2019-12-25 13:35:57 +01:00
PhysicalAddress.h Kernel: Add LogStream operator<< for PhysicalAddress 2019-09-15 20:47:49 +02:00
PhysicalPage.cpp Kernel: Move kmalloc() into a Kernel/Heap/ directory 2019-09-16 09:01:44 +02:00
PhysicalPage.h Kernel: Add a simple slab allocator for small allocations 2019-09-16 10:33:27 +02:00
PhysicalRegion.cpp Kernel: Fix returning pages to regions >= 2GB 2019-09-17 09:27:23 +02:00
PhysicalRegion.h Kernel: Move PhysicalAddress.h into VM/ 2019-07-09 15:04:45 +02:00
PurgeableVMObject.cpp Kernel: When physical page allocation fails, try to purge something 2019-12-26 11:45:36 +01:00
PurgeableVMObject.h Kernel: When physical page allocation fails, try to purge something 2019-12-26 11:45:36 +01:00
RangeAllocator.cpp Kernel: Make it possible to turn off VM guard pages at compile time 2019-09-30 17:22:16 +02:00
RangeAllocator.h AK: Rename <AK/AKString.h> to <AK/String.h> 2019-09-06 15:36:54 +02:00
Region.cpp Kernel: Start implementing x86 SMAP support 2020-01-05 18:14:51 +01:00
Region.h Kernel: Share code between Region::map() and Region::remap_page() 2020-01-01 19:32:55 +01:00
VirtualAddress.h Kernel: Add LogStream operator<< for VirtualAddress 2019-08-06 10:28:46 +02:00
VMObject.cpp Kernel: Rename vmo => vmobject everywhere 2019-12-19 19:15:27 +01:00
VMObject.h Kernel: Start implementing purgeable memory support 2019-12-09 19:12:38 +01:00