Index: compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp +++ compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp @@ -348,9 +348,11 @@ internal_snprintf(shmname, sizeof(shmname), "/dev/shm/%zu [%s]", internal_getpid(), name); int fd = ReserveStandardFds( - internal_open(shmname, O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRWXU)); + internal_open(shmname, O_RDWR | O_CREAT | O_TRUNC, S_IRWXU)); CHECK_GE(fd, 0); - int res = internal_ftruncate(fd, size); + int res = fcntl(fd, F_SETFD, FD_CLOEXEC); + CHECK_EQ(0, res); + res = internal_ftruncate(fd, size); CHECK_EQ(0, res); res = internal_unlink(shmname); CHECK_EQ(0, res);