llvm/compiler-rt/lib/gwp_asan/guarded_pool_allocator.cpp

//===-- guarded_pool_allocator.cpp ------------------------------*- C++ -*-===//
//
// 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
//
//===----------------------------------------------------------------------===//

#include "gwp_asan/guarded_pool_allocator.h"

#include "gwp_asan/crash_handler.h"
#include "gwp_asan/options.h"
#include "gwp_asan/utilities.h"

#include <assert.h>
#include <stddef.h>

AllocationMetadata;
Error;

namespace gwp_asan {
namespace {
// Forward declare the pointer to the singleton version of this class.
// Instantiated during initialisation, this allows the signal handler
// to find this class in order to deduce the root cause of failures. Must not be
// referenced by users outside this translation unit, in order to avoid
// init-order-fiasco.
GuardedPoolAllocator *SingletonPtr =;

size_t roundUpTo(size_t Size, size_t Boundary) {}

uintptr_t getPageAddr(uintptr_t Ptr, uintptr_t PageSize) {}

bool isPowerOfTwo(uintptr_t X) {}
} // anonymous namespace

// Gets the singleton implementation of this class. Thread-compatible until
// init() is called, thread-safe afterwards.
GuardedPoolAllocator *GuardedPoolAllocator::getSingleton() {}

void GuardedPoolAllocator::init(const options::Options &Opts) {}

void GuardedPoolAllocator::disable() {}

void GuardedPoolAllocator::enable() {}

void GuardedPoolAllocator::iterate(void *Base, size_t Size, iterate_callback Cb,
                                   void *Arg) {}

void GuardedPoolAllocator::uninitTestOnly() {}

// Note, minimum backing allocation size in GWP-ASan is always one page, and
// each slot could potentially be multiple pages (but always in
// page-increments). Thus, for anything that requires less than page size
// alignment, we don't need to allocate extra padding to ensure the alignment
// can be met.
size_t GuardedPoolAllocator::getRequiredBackingSize(size_t Size,
                                                    size_t Alignment,
                                                    size_t PageSize) {}

uintptr_t GuardedPoolAllocator::alignUp(uintptr_t Ptr, size_t Alignment) {}

uintptr_t GuardedPoolAllocator::alignDown(uintptr_t Ptr, size_t Alignment) {}

void *GuardedPoolAllocator::allocate(size_t Size, size_t Alignment) {}

void GuardedPoolAllocator::raiseInternallyDetectedError(uintptr_t Address,
                                                        Error E) {}

void GuardedPoolAllocator::deallocate(void *Ptr) {}

// Thread-compatible, protected by PoolMutex.
static bool PreviousRecursiveGuard;

void GuardedPoolAllocator::preCrashReport(void *Ptr) {}

void GuardedPoolAllocator::postCrashReportRecoverableOnly(void *SignalPtr) {}

size_t GuardedPoolAllocator::getSize(const void *Ptr) {}

AllocationMetadata *GuardedPoolAllocator::addrToMetadata(uintptr_t Ptr) const {}

size_t GuardedPoolAllocator::reserveSlot() {}

void GuardedPoolAllocator::freeSlot(size_t SlotIndex) {}

uint32_t GuardedPoolAllocator::getRandomUnsigned32() {}
} // namespace gwp_asan