[libc-commits] [libc] [libc] disable mlockall w/ MCL_ONFAULT (PR #80075)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Jan 30 14:55:35 PST 2024


https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/80075

I suspect this is a bug in linux 4.19, as the test passes as written on my
linux 6.5 machine.

Let's revisit this after the build bots are upgraded.

Link: #80073


>From 70b485fd0406ee8587dcbcb131976046e557449b Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 30 Jan 2024 14:54:16 -0800
Subject: [PATCH] [libc] disable mlockall w/ MCL_ONFAULT

I suspect this is a bug in linux 4.19, as the test passes as written on my
linux 6.5 machine.

Let's revisit this after the build bots are upgraded.

Link: #80073
---
 libc/test/src/sys/mman/linux/mlock_test.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libc/test/src/sys/mman/linux/mlock_test.cpp b/libc/test/src/sys/mman/linux/mlock_test.cpp
index a182a00d12f44..a4e1682ff32bc 100644
--- a/libc/test/src/sys/mman/linux/mlock_test.cpp
+++ b/libc/test/src/sys/mman/linux/mlock_test.cpp
@@ -131,7 +131,13 @@ TEST(LlvmLibcMlockTest, InvalidFlag) {
 
   // Invalid mlockall flags.
   EXPECT_THAT(LIBC_NAMESPACE::mlockall(1234), Fails(EINVAL));
-  EXPECT_THAT(LIBC_NAMESPACE::mlockall(MCL_ONFAULT), Fails(EINVAL));
+
+  // man 2 mlockall says EINVAL is a valid return code when MCL_ONFAULT was
+  // specified without MCL_FUTURE or MCL_CURRENT, but this seems to fail on
+  // Linux 4.19.y (EOL).
+  // TODO(ndesaulniers) re-enable after
+  // https://github.com/llvm/llvm-project/issues/80073 is fixed.
+  // EXPECT_THAT(LIBC_NAMESPACE::mlockall(MCL_ONFAULT), Fails(EINVAL));
 
   LIBC_NAMESPACE::munmap(addr, alloc_size);
 }



More information about the libc-commits mailing list