mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 18:14:59 +00:00
Kernel: Fix off-by-one in Memory::is_user_range() check
This function was checking 1 byte after the provided range, which caused it to reject valid userspace ranges that happened to end exactly at the top of the user address space. This fixes a long-standing issue with mysterious Optional errors in Coredump::write_regions(). (It happened when trying to add a memory region at the very top of the address space to a coredump.)
This commit is contained in:
parent
2116fb5be9
commit
890c647e0f
1 changed files with 5 additions and 1 deletions
|
@ -302,7 +302,11 @@ inline bool is_user_range(VirtualAddress vaddr, size_t size)
|
||||||
{
|
{
|
||||||
if (vaddr.offset(size) < vaddr)
|
if (vaddr.offset(size) < vaddr)
|
||||||
return false;
|
return false;
|
||||||
return is_user_address(vaddr) && is_user_address(vaddr.offset(size));
|
if (!is_user_address(vaddr))
|
||||||
|
return false;
|
||||||
|
if (size <= 1)
|
||||||
|
return true;
|
||||||
|
return is_user_address(vaddr.offset(size - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_user_range(VirtualRange const& range)
|
inline bool is_user_range(VirtualRange const& range)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue