[compiler-rt] [rtsan] Add ioctl interceptor (PR #117569)

Chris Apple via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 25 07:25:01 PST 2024


================
@@ -373,6 +375,57 @@ class RtsanOpenedFileTest : public RtsanFileTest {
   int fd = -1;
 };
 
+TEST(TestRtsanInterceptors, IoctlDiesWhenRealtime) {
+  auto Func = []() { ioctl(0, FIONREAD); };
+  ExpectRealtimeDeath(Func, "ioctl");
+  ExpectNonRealtimeSurvival(Func);
+}
+
+TEST_F(RtsanOpenedFileTest, IoctlBehavesWithOutputArg) {
+  int arg{};
+  ioctl(GetOpenFd(), FIONREAD, &arg);
+
+  EXPECT_THAT(arg, Ge(0));
+}
+
+TEST(TestRtsanInterceptors, IoctlBehavesWithOutputPointer) {
----------------
cjappl wrote:

This test (and the one above) exists to ensure we pass on the arg correctly. It's just a simple "lights on" test of ioctl getting info from a socket

https://github.com/llvm/llvm-project/pull/117569


More information about the llvm-commits mailing list