llvm/compiler-rt/lib/ubsan_minimal/ubsan_minimal_handlers.cpp

#include "sanitizer_common/sanitizer_atomic.h"

#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>

#ifdef KERNEL_USE
extern "C" void ubsan_message(const char *msg);
static void message(const char *msg) { ubsan_message(msg); }
#else
static void message(const char *msg) {}
#endif

static const int kMaxCallerPcs =;
static __sanitizer::atomic_uintptr_t caller_pcs[kMaxCallerPcs];
// Number of elements in caller_pcs. A special value of kMaxCallerPcs + 1 means
// that "too many errors" has already been reported.
static __sanitizer::atomic_uint32_t caller_pcs_sz;

__attribute__((noinline)) static bool report_this_error(uintptr_t caller) {}

__attribute__((noinline)) static void decorate_msg(char *buf,
                                                   uintptr_t caller) {}

#if defined(__ANDROID__)
extern "C" __attribute__((weak)) void android_set_abort_message(const char *);
static void abort_with_message(const char *msg) {
  if (&android_set_abort_message) android_set_abort_message(msg);
  abort();
}
#else
static void abort_with_message(const char *) {}
#endif

#if SANITIZER_DEBUG
namespace __sanitizer {
// The DCHECK macro needs this symbol to be defined.
void NORETURN CheckFailed(const char *file, int, const char *cond, u64, u64) {
  message("Sanitizer CHECK failed: ");
  message(file);
  message(":?? : "); // FIXME: Show line number.
  message(cond);
  abort();
}
} // namespace __sanitizer
#endif

#define INTERFACE

// How many chars we need to reserve to print an address.
constexpr unsigned kAddrBuf =;
#define MSG_TMPL(msg)
#define MSG_TMPL_END(buf, msg)
// Reserve an additional byte for '\n'.
#define MSG_BUF_LEN(msg)

#define HANDLER_RECOVER(name, msg)

#define HANDLER_NORECOVER(name, msg)

#define HANDLER(name, msg)

HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER_RECOVER()
HANDLER_RECOVER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()
HANDLER()