Skip to content

Commit

Permalink
Fix compilation of sanitizers in Rust containers
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
alexcrichton authored and nikic committed Feb 4, 2020
1 parent 19ea599 commit be4af5f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion compiler-rt/lib/asan/asan_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void AsanCheckIncompatibleRT() {
// the functions in dynamic ASan runtime instead of the functions in
// system libraries, causing crashes later in ASan initialization.
MemoryMappingLayout proc_maps(/*cache_enabled*/true);
char filename[PATH_MAX];
char filename[4096];
MemoryMappedSegment segment(filename, sizeof(filename));
while (proc_maps.Next(&segment)) {
if (IsDynamicRTName(segment.filename)) {
Expand Down
6 changes: 1 addition & 5 deletions compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,8 @@ u32 GetNumberOfCPUs() {
}
internal_close(fd);
return n_cpus;
#elif SANITIZER_SOLARIS
return sysconf(_SC_NPROCESSORS_ONLN);
#else
cpu_set_t CPUs;
CHECK_EQ(sched_getaffinity(0, sizeof(cpu_set_t), &CPUs), 0);
return CPU_COUNT(&CPUs);
return sysconf(_SC_NPROCESSORS_ONLN);
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ typedef struct user_fpregs elf_fpregset_t;
#endif

#if SANITIZER_LINUX && !SANITIZER_ANDROID
#include <stdio.h>
#include <glob.h>
#include <obstack.h>
#include <mqueue.h>
Expand Down Expand Up @@ -1012,9 +1013,9 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);

#if SANITIZER_LINUX && (__ANDROID_API__ >= 21 || __GLIBC_PREREQ (2, 14))
CHECK_TYPE_SIZE(mmsghdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
// CHECK_TYPE_SIZE(mmsghdr);
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
// CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);
#endif

COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
Expand Down

0 comments on commit be4af5f

Please sign in to comment.