llvm/compiler-rt/lib/nsan/nsan_malloc_linux.cpp

//===- nsan_malloc_linux.cpp ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Interceptors for memory allocation functions on ELF OSes.
//
//===----------------------------------------------------------------------===//

#include "interception/interception.h"
#include "nsan.h"
#include "nsan_allocator.h"
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_platform.h"
#include "sanitizer_common/sanitizer_platform_interceptors.h"
#include "sanitizer_common/sanitizer_stacktrace.h"

#if !SANITIZER_APPLE && !SANITIZER_WINDOWS
usingnamespace__sanitizer;
usingnamespace__nsan;

namespace {
struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {};
} // namespace

INTERCEPTOR(void *, aligned_alloc, uptr align, uptr size) {}

INTERCEPTOR(void *, calloc, uptr nmemb, uptr size) {}

INTERCEPTOR(void, free, void *ptr) {}

INTERCEPTOR(void *, malloc, uptr size) {}

INTERCEPTOR(void *, realloc, void *ptr, uptr size) {}

#if SANITIZER_INTERCEPT_REALLOCARRAY
INTERCEPTOR(void *, reallocarray, void *ptr, uptr nmemb, uptr size) {}
#endif // SANITIZER_INTERCEPT_REALLOCARRAY

INTERCEPTOR(int, posix_memalign, void **memptr, uptr align, uptr size) {}

// Deprecated allocation functions (memalign, etc).
#if SANITIZER_INTERCEPT_MEMALIGN
INTERCEPTOR(void *, memalign, uptr align, uptr size) {}

INTERCEPTOR(void *, __libc_memalign, uptr align, uptr size) {}
#endif

void __nsan::InitializeMallocInterceptors() {}

#endif