diff options
author | Liav A <liavalb@gmail.com> | 2022-09-24 14:31:32 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-09-24 13:49:40 +0200 |
commit | 6e26e9fb29adb193f9375a8e18067df8554639be (patch) | |
tree | 9a125e2878976598803dfeda46a75583e957589d /Kernel/Memory | |
parent | 4d7e4e5da8d6a889b912813186e2d398343b757c (diff) | |
download | serenity-6e26e9fb29adb193f9375a8e18067df8554639be.zip |
Revert "Kernel: Send SIGBUS to threads that use after valid Inode mmaped range"
This reverts commit 0c675192c91999cc2b60cbbea708dbf7b5637897.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r-- | Kernel/Memory/PageFaultResponse.h | 1 | ||||
-rw-r--r-- | Kernel/Memory/Region.cpp | 11 | ||||
-rw-r--r-- | Kernel/Memory/Region.h | 7 |
3 files changed, 3 insertions, 16 deletions
diff --git a/Kernel/Memory/PageFaultResponse.h b/Kernel/Memory/PageFaultResponse.h index 0a5c473230..56297f6268 100644 --- a/Kernel/Memory/PageFaultResponse.h +++ b/Kernel/Memory/PageFaultResponse.h @@ -10,7 +10,6 @@ namespace Kernel { enum class PageFaultResponse { ShouldCrash, - BusError, OutOfMemory, Continue, }; diff --git a/Kernel/Memory/Region.cpp b/Kernel/Memory/Region.cpp index 0a794e2e16..a5ecc22fe6 100644 --- a/Kernel/Memory/Region.cpp +++ b/Kernel/Memory/Region.cpp @@ -362,7 +362,7 @@ PageFaultResponse Region::handle_fault(PageFault const& fault) } if (vmobject().is_inode()) { dbgln_if(PAGE_FAULT_DEBUG, "NP(inode) fault in Region({})[{}]", this, page_index_in_region); - return handle_inode_fault(page_index_in_region, offset_in_page_from_address(fault.vaddr())); + return handle_inode_fault(page_index_in_region); } SpinlockLocker vmobject_locker(vmobject().m_lock); @@ -462,7 +462,7 @@ PageFaultResponse Region::handle_cow_fault(size_t page_index_in_region) return response; } -PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region, size_t offset_in_page_in_region) +PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region) { VERIFY(vmobject().is_inode()); VERIFY(!g_scheduler_lock.is_locked_by_current_processor()); @@ -475,13 +475,6 @@ PageFaultResponse Region::handle_inode_fault(size_t page_index_in_region, size_t { // NOTE: The VMObject lock is required when manipulating the VMObject's physical page slot. SpinlockLocker locker(inode_vmobject.m_lock); - if (inode_vmobject.inode().size() == 0) - return PageFaultResponse::BusError; - auto fault_vaddr = vaddr_from_page_index(page_index_in_vmobject).offset(offset_in_page_in_region); - auto inode_last_valid_address = vaddr().offset(inode_vmobject.inode().size()); - if (inode_last_valid_address < fault_vaddr) - return PageFaultResponse::BusError; - if (!vmobject_physical_page_slot.is_null()) { dbgln_if(PAGE_FAULT_DEBUG, "handle_inode_fault: Page faulted in by someone else before reading, remapping."); if (!remap_vmobject_page(page_index_in_vmobject, *vmobject_physical_page_slot)) diff --git a/Kernel/Memory/Region.h b/Kernel/Memory/Region.h index 1ef83b03fc..aabceef63d 100644 --- a/Kernel/Memory/Region.h +++ b/Kernel/Memory/Region.h @@ -122,11 +122,6 @@ public: return (vaddr - m_range.base()).get() / PAGE_SIZE; } - [[nodiscard]] unsigned offset_in_page_from_address(VirtualAddress vaddr) const - { - return (vaddr - m_range.base()).get() % PAGE_SIZE; - } - [[nodiscard]] VirtualAddress vaddr_from_page_index(size_t page_index) const { return vaddr().offset(page_index * PAGE_SIZE); @@ -224,7 +219,7 @@ private: } [[nodiscard]] PageFaultResponse handle_cow_fault(size_t page_index); - [[nodiscard]] PageFaultResponse handle_inode_fault(size_t page_index, size_t offset_in_page_in_region); + [[nodiscard]] PageFaultResponse handle_inode_fault(size_t page_index); [[nodiscard]] PageFaultResponse handle_zero_fault(size_t page_index, PhysicalPage& page_in_slot_at_time_of_fault); [[nodiscard]] bool map_individual_page_impl(size_t page_index); |