summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorZhangjin Wu <falcon@tinylab.org>2023-07-07 23:07:13 +0800
committerWilly Tarreau <w@1wt.eu>2023-08-23 04:38:02 +0200
commitba3d0892be0e2d5a7d144c5519920130639524fc (patch)
tree5ef0d49d412b907deb8e25a2102c0f2582177707 /tools
parentd4a3b2b99810ef398c352585edff2c23b17ef86d (diff)
selftests/nolibc: add munmap_bad test case
The addr argument of munmap() must be a multiple of the page size, passing invalid (void *)1 addr expects failure with -EINVAL. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/nolibc/nolibc-test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 39c145b5e03d4..a11fec00fd017 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -670,6 +670,7 @@ int run_syscall(int min, int max)
CASE_TEST(lseek_0); EXPECT_SYSER(1, lseek(0, 0, SEEK_SET), -1, ESPIPE); break;
CASE_TEST(mkdir_root); EXPECT_SYSER(1, mkdir("/", 0755), -1, EEXIST); break;
CASE_TEST(mmap_bad); EXPECT_PTRER(1, mmap(NULL, 0, PROT_READ, MAP_PRIVATE, 0, 0), MAP_FAILED, EINVAL); break;
+ CASE_TEST(munmap_bad); EXPECT_SYSER(1, munmap((void *)1, 0), -1, EINVAL); break;
CASE_TEST(open_tty); EXPECT_SYSNE(1, tmp = open("/dev/null", 0), -1); if (tmp != -1) close(tmp); break;
CASE_TEST(open_blah); EXPECT_SYSER(1, tmp = open("/proc/self/blah", 0), -1, ENOENT); if (tmp != -1) close(tmp); break;
CASE_TEST(poll_null); EXPECT_SYSZR(1, poll(NULL, 0, 0)); break;