Skip to content

Commit be4af5f

Browse files
alexcrichtonnikic
authored andcommitted
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 19ea599 commit be4af5f

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

compiler-rt/lib/asan/asan_linux.cpp

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

compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,8 @@ u32 GetNumberOfCPUs() {
690690
}
691691
internal_close(fd);
692692
return n_cpus;
693-
#elif SANITIZER_SOLARIS
694-
return sysconf(_SC_NPROCESSORS_ONLN);
695693
#else
696-
cpu_set_t CPUs;
697-
CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
698-
return CPU_COUNT(&CPUs);
694+
return sysconf(_SC_NPROCESSORS_ONLN);
699695
#endif
700696
}
701697

compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ typedef struct user_fpregs elf_fpregset_t;
110110
#endif
111111

112112
#if SANITIZER_LINUX && !SANITIZER_ANDROID
113+
#include <stdio.h>
113114
#include <glob.h>
114115
#include <obstack.h>
115116
#include <mqueue.h>
@@ -1012,9 +1013,9 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
10121013
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
10131014

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

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

0 commit comments

Comments
 (0)