1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-26 01:55:08 +00:00
serenity/Tests/Kernel/TestMunMap.cpp
Brian Gianforcaro c9395d7e9a 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>
2021-07-30 11:28:55 +02:00

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);
}