Skip to content

Commit 9670dbb

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 accc618 commit 9670dbb

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

compiler-rt/lib/asan/asan_linux.cc

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.cc

Lines changed: 1 addition & 5 deletions
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

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

108108
#if SANITIZER_LINUX && !SANITIZER_ANDROID
109+
#include <stdio.h>
109110
#include <glob.h>
110111
#include <obstack.h>
111112
#include <mqueue.h>
@@ -1010,9 +1011,9 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
10101011
#endif
10111012

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

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

0 commit comments

Comments
 (0)