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

//===-- dfsan_allocator.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.
//
// DataflowSanitizer allocator.
//===----------------------------------------------------------------------===//

#include "dfsan_allocator.h"

#include "dfsan.h"
#include "dfsan_flags.h"
#include "dfsan_thread.h"
#include "sanitizer_common/sanitizer_allocator.h"
#include "sanitizer_common/sanitizer_allocator_checks.h"
#include "sanitizer_common/sanitizer_allocator_interface.h"
#include "sanitizer_common/sanitizer_allocator_report.h"
#include "sanitizer_common/sanitizer_errno.h"

usingnamespace__dfsan;

namespace {

struct Metadata {};

struct DFsanMapUnmapCallback {};

// Note: to ensure that the allocator is compatible with the application memory
// layout (especially with high-entropy ASLR), kSpaceBeg and kSpaceSize must be
// duplicated as MappingDesc::ALLOCATOR in dfsan_platform.h.
#if defined(__aarch64__)
const uptr kAllocatorSpace = 0xE00000000000ULL;
#else
const uptr kAllocatorSpace =;
#endif
const uptr kMaxAllowedMallocSize =;

struct AP64 {};

PrimaryAllocator;

Allocator;
AllocatorCache;

static Allocator allocator;
static AllocatorCache fallback_allocator_cache;
static StaticSpinMutex fallback_mutex;

static uptr max_malloc_size;
}  // namespace

void __dfsan::dfsan_allocator_init() {}

static AllocatorCache *GetAllocatorCache(DFsanThreadLocalMallocStorage *ms) {}

void DFsanThreadLocalMallocStorage::CommitBack() {}

static void *DFsanAllocate(uptr size, uptr alignment, bool zeroise) {}

void __dfsan::dfsan_deallocate(void *p) {}

static void *DFsanReallocate(void *old_p, uptr new_size, uptr alignment) {}

static void *DFsanCalloc(uptr nmemb, uptr size) {}

static const void *AllocationBegin(const void *p) {}

static uptr AllocationSize(const void *p) {}

static uptr AllocationSizeFast(const void *p) {}

void *__dfsan::dfsan_malloc(uptr size) {}

void *__dfsan::dfsan_calloc(uptr nmemb, uptr size) {}

void *__dfsan::dfsan_realloc(void *ptr, uptr size) {}

void *__dfsan::dfsan_reallocarray(void *ptr, uptr nmemb, uptr size) {}

void *__dfsan::dfsan_valloc(uptr size) {}

void *__dfsan::dfsan_pvalloc(uptr size) {}

void *__dfsan::dfsan_aligned_alloc(uptr alignment, uptr size) {}

void *__dfsan::dfsan_memalign(uptr alignment, uptr size) {}

int __dfsan::dfsan_posix_memalign(void **memptr, uptr alignment, uptr size) {}

extern "C" {
uptr __sanitizer_get_current_allocated_bytes() {}

uptr __sanitizer_get_heap_size() {}

uptr __sanitizer_get_free_bytes() {}

uptr __sanitizer_get_unmapped_bytes() {}

uptr __sanitizer_get_estimated_allocated_size(uptr size) {}

int __sanitizer_get_ownership(const void *p) {}

const void *__sanitizer_get_allocated_begin(const void *p) {}

uptr __sanitizer_get_allocated_size(const void *p) {}

uptr __sanitizer_get_allocated_size_fast(const void *p) {}
}