diff --git a/compiler-rt/lib/msan/tests/msan_test.cpp b/compiler-rt/lib/msan/tests/msan_test.cpp --- a/compiler-rt/lib/msan/tests/msan_test.cpp +++ b/compiler-rt/lib/msan/tests/msan_test.cpp @@ -99,7 +99,8 @@ # include # include # if defined(__linux__) -# include +# include +# include # endif #endif @@ -706,6 +707,15 @@ EXPECT_NOT_POISONED(ws.ws_col); } +#if defined(__linux__) +TEST(MemorySanitizer, DISABLED_ioctl_BLKSSZGET) { + int arg; + EXPECT_POISONED(arg); + EXPECT_EQ(ioctl(0, BLKSSZGET, &arg), 0); + EXPECT_NOT_POISONED(arg); +} +#endif /* defined(__linux__) */ + TEST(MemorySanitizer, readlink) { char *x = new char[1000]; readlink(SYMLINK_TO_READ, x, 1000); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc --- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -104,6 +104,7 @@ #endif #if SANITIZER_LINUX +# include // Conflicting request ids. // _(CDROMAUDIOBUFSIZ, NONE, 0); // _(SNDCTL_TMR_CONTINUE, NONE, 0); @@ -593,6 +594,10 @@ unsigned size = desc->size ? desc->size : IOC_SIZE(request); COMMON_INTERCEPTOR_WRITE_RANGE(ctx, arg, size); } +#if SANITIZER_LINUX + if (request == BLKSSZGET) + COMMON_INTERCEPTOR_WRITE_RANGE(ctx, arg, sizeof(int)); +#endif /* SANITIZER_LINUX */ if (desc->type != ioctl_desc::CUSTOM) return; if (request == IOCTL_SIOCGIFCONF) {