mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
Tests: Validate unmapping 0x0 doesn't crash the Kernel
Previously unmapping any offset starting at 0x0 would assert in the kernel, add a regression test to validate the fix. Co-authored-by: Federico Guerinoni <guerinoni.federico@gmail.com>
This commit is contained in:
parent
0fcb9efd86
commit
c9395d7e9a
Notes:
sideshowbarker
2024-07-18 07:45:07 +09:00
Author: https://github.com/bgianfo
Commit: c9395d7e9a
Pull-request: https://github.com/SerenityOS/serenity/pull/9105
Issue: https://github.com/SerenityOS/serenity/issues/8483
Reviewed-by: https://github.com/gunnarbeutner ✅
1 changed files with 17 additions and 0 deletions
17
Tests/Kernel/TestMunMap.cpp
Normal file
17
Tests/Kernel/TestMunMap.cpp
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Brian Gianforcaro <bgianf@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibTest/TestCase.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
|
||||||
|
TEST_CASE(munmap_zero_page)
|
||||||
|
{
|
||||||
|
// munmap of the unmapped zero page should always fail.
|
||||||
|
auto res = munmap(0x0, 0xF);
|
||||||
|
EXPECT_EQ(res, -1);
|
||||||
|
EXPECT_EQ(errno, EINVAL);
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue