1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00
serenity/Kernel/Memory
Liav A 026687816d Kernel: Fix restrictions in is_allowed_to_mmap_to_userspace function
This small change simplifies the function a bit but also fixes a problem
with it.
Let's take an example to see this:
Let's say we have a reserved range between 0xe0000 to 0xfffff (EBDA),
then we want to map from the memory device (/dev/mem) the entire
EBDA to a program. If a program tries to map more than 131072 bytes,
the current logic will work - the start address is 0xe0000, and ofcourse
it's below the limit, hence it passes the first two restrictions.
Then, the third if statement will fail if we try to mmap more than
the said allowed bytes.
However, let's take another scenario, where we try to mmap from
0xf0000 - but we try to mmap less than 131072 - but more than 65536.
In such case, we again pass the first two if statements, but the third
one is passed two, because it doesn't take into account the offseted
address from the start of the reserved range (0xe0000). In such case,
a user can easily mmap 65535 bytes above 0x100000. This might
seem negligible. However, it's still a severe bug that can theoretically
be exploited into a info leak or tampering with important kernel
structures.
2021-10-22 13:13:00 +02:00
..
AddressSpace.cpp Kernel: Fetch range once for each iteration of find_regions_intersecting 2021-09-16 17:17:13 +02:00
AddressSpace.h Kernel: Make AddressSpace::add_region() return KResultOr<Region*> 2021-09-06 02:02:06 +02:00
AllocationStrategy.h Kernel: Rename Kernel/VM/ to Kernel/Memory/ 2021-08-06 14:05:58 +02:00
AnonymousVMObject.cpp Kernel: Split SmapDisabler so header is platform independent 2021-10-15 21:48:45 +01:00
AnonymousVMObject.h Kernel: Make all Spinlocks use u8 for storage, remove template 2021-09-05 20:46:02 +02:00
InodeVMObject.cpp Kernel: Rename ScopedSpinlock => SpinlockLocker 2021-08-22 03:34:10 +02:00
InodeVMObject.h Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
MappedROM.h Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
MemoryManager.cpp Kernel: Fix restrictions in is_allowed_to_mmap_to_userspace function 2021-10-22 13:13:00 +02:00
MemoryManager.h Kernel: Fix off-by-one in Memory::is_user_range() check 2021-09-11 02:34:55 +02:00
PageDirectory.cpp AK+Kernel: Reduce the number of template parameters of IntrusiveRBTree 2021-09-10 18:05:46 +03:00
PageDirectory.h Kernel: Use an IntrusiveRedBlackTree for storing the cr3 mappings 2021-09-08 19:17:07 +03:00
PageFaultResponse.h Kernel: Rename Kernel/VM/ to Kernel/Memory/ 2021-08-06 14:05:58 +02:00
PhysicalPage.cpp Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
PhysicalPage.h Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
PhysicalRegion.cpp Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
PhysicalRegion.h Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
PhysicalZone.cpp Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
PhysicalZone.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
PrivateInodeVMObject.cpp Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject 2021-09-06 13:06:05 +02:00
PrivateInodeVMObject.h Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject 2021-09-06 13:06:05 +02:00
Region.cpp Kernel: Access MemoryManager static functions statically 2021-10-02 18:16:15 +02:00
Region.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
RingBuffer.cpp Kernel: Make UserOrKernelBuffer return KResult from read/write/memset 2021-09-07 13:53:14 +02:00
RingBuffer.h Kernel: Make all Spinlocks use u8 for storage, remove template 2021-09-05 20:46:02 +02:00
ScatterGatherList.cpp Kernel: Make kernel region allocators return KResultOr<NOP<Region>> 2021-09-06 01:55:27 +02:00
ScatterGatherList.h Kernel: Move Kernel/Memory/ code into Kernel::Memory namespace 2021-08-06 14:05:58 +02:00
ScopedAddressSpaceSwitcher.cpp Kernel: Access MemoryManager static functions statically 2021-10-02 18:16:15 +02:00
ScopedAddressSpaceSwitcher.h Kernel: Rename ProcessPagingScope => ScopedAddressSpaceSwitcher 2021-09-06 18:56:51 +02:00
SharedInodeVMObject.cpp Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject 2021-09-06 13:06:05 +02:00
SharedInodeVMObject.h Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject 2021-09-06 13:06:05 +02:00
TypedMapping.h Kernel: Make kernel region allocators return KResultOr<NOP<Region>> 2021-09-06 01:55:27 +02:00
VirtualRange.cpp Kernel: Rename Range => VirtualRange 2021-08-06 14:05:58 +02:00
VirtualRange.h AK+Kernel: Move KResult.h to Kernel/API for userspace access 2021-09-05 12:54:48 +02:00
VirtualRangeAllocator.cpp Kernel: Use find_largest_not_above in VirtualRangeAllocator 2021-10-07 22:10:45 +02:00
VirtualRangeAllocator.h Kernel: Use find_largest_not_above in VirtualRangeAllocator 2021-10-07 22:10:45 +02:00
VMObject.cpp Kernel: Rename SpinLock => Spinlock 2021-08-22 03:34:10 +02:00
VMObject.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00