mirror of
https://github.com/RGBCube/serenity
synced 2025-05-26 01:55:08 +00:00

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>
17 lines
368 B
C++
17 lines
368 B
C++
/*
|
|
* 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);
|
|
}
|