Skip to content

Commit 4efebe3

Browse files
committed
Fix compilation of sanitizers in Rust containers
It's not entertirely clear why this is necessary but this is carrying over an old `compiler-rt` patch to ensure that `compiler-rt` compiles in our super ancient containers that we build sanitizers in. This ideally isn't the worst thing to keep with us going forward, but we'll see!
1 parent 2c5656a commit 4efebe3

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

compiler-rt/lib/asan/asan_linux.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ void AsanCheckIncompatibleRT() {
215215
// the functions in dynamic ASan runtime instead of the functions in
216216
// system libraries, causing crashes later in ASan initialization.
217217
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
218-
char filename[PATH_MAX];
218+
char filename[4096];
219219
MemoryMappedSegment segment(filename, sizeof(filename));
220220
while (proc_maps.Next(&segment)) {
221221
if (IsDynamicRTName(segment.filename)) {

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc

+1-5
Original file line numberDiff line numberDiff line change
@@ -698,12 +698,8 @@ u32 GetNumberOfCPUs() {
698698
}
699699
internal_close(fd);
700700
return n_cpus;
701-
#elif SANITIZER_SOLARIS
702-
return sysconf(_SC_NPROCESSORS_ONLN);
703701
#else
704-
cpu_set_t CPUs;
705-
CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
706-
return CPU_COUNT(&CPUs);
702+
return sysconf(_SC_NPROCESSORS_ONLN);
707703
#endif
708704
}
709705

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ typedef struct user_fpregs elf_fpregset_t;
107107
#endif
108108

109109
#if SANITIZER_LINUX && !SANITIZER_ANDROID
110+
#include <stdio.h>
110111
#include <glob.h>
111112
#include <obstack.h>
112113
#include <mqueue.h>
@@ -1011,9 +1012,9 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
10111012
#endif
10121013

10131014
#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
1014-
CHECK_TYPE_SIZE(mmsghdr);
1015-
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
1016-
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
1015+
// CHECK_TYPE_SIZE(mmsghdr);
1016+
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
1017+
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
10171018
#endif
10181019

10191020
COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));

0 commit comments

Comments
 (0)