mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 07:54:58 +00:00
Kernel: Unmapping a non-mapped region with munmap() should be a no-op
Not a regression per se from 0fcb9efd86
since we were crashing before that which is obviously worse.
This commit is contained in:
parent
c9395d7e9a
commit
bccdc08487
2 changed files with 3 additions and 4 deletions
|
@ -92,7 +92,7 @@ KResult Space::unmap_mmap_range(VirtualAddress addr, size_t size)
|
||||||
// Try again while checking multiple regions at a time.
|
// Try again while checking multiple regions at a time.
|
||||||
auto const& regions = find_regions_intersecting(range_to_unmap);
|
auto const& regions = find_regions_intersecting(range_to_unmap);
|
||||||
if (regions.is_empty())
|
if (regions.is_empty())
|
||||||
return EINVAL;
|
return KSuccess;
|
||||||
|
|
||||||
// Check if any of the regions is not mmap'ed, to not accidentally
|
// Check if any of the regions is not mmap'ed, to not accidentally
|
||||||
// error out with just half a region map left.
|
// error out with just half a region map left.
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
|
|
||||||
TEST_CASE(munmap_zero_page)
|
TEST_CASE(munmap_zero_page)
|
||||||
{
|
{
|
||||||
// munmap of the unmapped zero page should always fail.
|
// munmap of the unmapped zero page should always "succeed".
|
||||||
auto res = munmap(0x0, 0xF);
|
auto res = munmap(0x0, 0xF);
|
||||||
EXPECT_EQ(res, -1);
|
EXPECT_EQ(res, 0);
|
||||||
EXPECT_EQ(errno, EINVAL);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue