mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +00:00
Kernel: Send SIGBUS to threads that use after valid Inode mmaped range
According to Dr. POSIX, we should allow to call mmap on inodes even on ranges that currently don't map to any actual data. Trying to read or write to those ranges should result in SIGBUS being sent to the thread that did violating memory access.
This commit is contained in:
parent
3ad0e1a1d5
commit
0c675192c9
4 changed files with 57 additions and 33 deletions
|
@ -122,6 +122,11 @@ 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);
|
||||
|
@ -219,7 +224,7 @@ private:
|
|||
}
|
||||
|
||||
[[nodiscard]] PageFaultResponse handle_cow_fault(size_t page_index);
|
||||
[[nodiscard]] PageFaultResponse handle_inode_fault(size_t page_index);
|
||||
[[nodiscard]] PageFaultResponse handle_inode_fault(size_t page_index, size_t offset_in_page_in_region);
|
||||
[[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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue