[compiler-rt] r230318 - Fix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On

Kuba Brecka kuba.brecka at gmail.com
Tue Feb 24 02:10:25 PST 2015


Author: kuba.brecka
Date: Tue Feb 24 04:10:25 2015
New Revision: 230318

URL: http://llvm.org/viewvc/llvm-project?rev=230318&view=rev
Log:
Fix the ASan ioctl.cc test when using COMPILER_RT_DEBUG=On

In debug mode (COMPILER_RT_DEBUG=On), we still build with -fomit-frame-pointer and wrap_ioctl doesn't set up a proper stack frame.  In release mode it does, because ioctl_common_pre gets inlined into wrap_ioctl and it uses the COMMON_INTERCEPTOR_READ_RANGE macro which in the end calls GET_CURRENT_FRAME and that forces the compiler to generate a stack frame for the function.

Not having a proper stack frame breaks the unwinder.  This patch forces to generate a frame pointer (via ENABLE_FRAME_POINTER macro).

Reviewed at http://reviews.llvm.org/D7815


Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=230318&r1=230317&r2=230318&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Tue Feb 24 04:10:25 2015
@@ -1034,6 +1034,12 @@ FORMAT_INTERCEPTOR_IMPL(__isoc99_snprint
 #if SANITIZER_INTERCEPT_IOCTL
 #include "sanitizer_common_interceptors_ioctl.inc"
 INTERCEPTOR(int, ioctl, int d, unsigned long request, ...) {
+  // We need a frame pointer, because we call into ioctl_common_[pre|post] which
+  // can trigger a report and we need to be able to unwind through this
+  // function.  On Mac in debug mode we might not have a frame pointer, because
+  // ioctl_common_[pre|post] doesn't get inlined here.
+  ENABLE_FRAME_POINTER;
+
   void *ctx;
   va_list ap;
   va_start(ap, request);





More information about the llvm-commits mailing list