llvm/compiler-rt/lib/dfsan/dfsan_interceptors.cpp

//===-- dfsan_interceptors.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
//
//===----------------------------------------------------------------------===//
//
// This file is a part of DataFlowSanitizer.
//
// Interceptors for standard library functions.
//===----------------------------------------------------------------------===//

#include <sys/syscall.h>
#include <unistd.h>

#include "dfsan/dfsan.h"
#include "dfsan/dfsan_thread.h"
#include "interception/interception.h"
#include "sanitizer_common/sanitizer_allocator_dlsym.h"
#include "sanitizer_common/sanitizer_allocator_interface.h"
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_errno.h"
#include "sanitizer_common/sanitizer_platform_limits_posix.h"
#include "sanitizer_common/sanitizer_posix.h"
#include "sanitizer_common/sanitizer_tls_get_addr.h"

usingnamespace__dfsan;
usingnamespace__sanitizer;

static bool interceptors_initialized;

struct DlsymAlloc : public DlSymAllocator<DlsymAlloc> {};

INTERCEPTOR(void *, reallocarray, void *ptr, SIZE_T nmemb, SIZE_T size) {}

INTERCEPTOR(void *, __libc_memalign, SIZE_T alignment, SIZE_T size) {}

INTERCEPTOR(void *, aligned_alloc, SIZE_T alignment, SIZE_T size) {}

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

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

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

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

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

INTERCEPTOR(int, posix_memalign, void **memptr, SIZE_T alignment, SIZE_T size) {}

INTERCEPTOR(void *, memalign, SIZE_T alignment, SIZE_T size) {}

INTERCEPTOR(void *, valloc, SIZE_T size) {}

INTERCEPTOR(void *, pvalloc, SIZE_T size) {}

INTERCEPTOR(void, mallinfo, __sanitizer_struct_mallinfo *sret) {}

INTERCEPTOR(int, mallopt, int cmd, int value) {}

INTERCEPTOR(void, malloc_stats, void) {}

INTERCEPTOR(uptr, malloc_usable_size, void *ptr) {}

#define ENSURE_DFSAN_INITED()

#define COMMON_INTERCEPTOR_ENTER(func, ...)

INTERCEPTOR(void *, mmap, void *addr, SIZE_T length, int prot, int flags,
            int fd, OFF_T offset) {}

INTERCEPTOR(void *, mmap64, void *addr, SIZE_T length, int prot, int flags,
            int fd, OFF64_T offset) {}

INTERCEPTOR(int, munmap, void *addr, SIZE_T length) {}

#define COMMON_INTERCEPTOR_GET_TLS_RANGE(begin, end)
#define COMMON_INTERCEPTOR_INITIALIZE_RANGE(ptr, size)

INTERCEPTOR(void *, __tls_get_addr, void *arg) {}

void __dfsan::initialize_interceptors() {}