10b57cec5SDimitry Andric//===-- options.inc ---------------------------------------------*- C++ -*-===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric#ifndef GWP_ASAN_OPTION 100b57cec5SDimitry Andric#error "Define GWP_ASAN_OPTION prior to including this file!" 110b57cec5SDimitry Andric#endif 120b57cec5SDimitry Andric 130b57cec5SDimitry AndricGWP_ASAN_OPTION(bool, Enabled, true, "Is GWP-ASan enabled? Defaults to true.") 140b57cec5SDimitry Andric 150b57cec5SDimitry AndricGWP_ASAN_OPTION( 160b57cec5SDimitry Andric bool, PerfectlyRightAlign, false, 170b57cec5SDimitry Andric "When allocations are right-aligned, should we perfectly align them up to " 180b57cec5SDimitry Andric "the page boundary? By default (false), we round up allocation size to the " 190b57cec5SDimitry Andric "nearest power of two (1, 2, 4, 8, 16) up to a maximum of 16-byte " 200b57cec5SDimitry Andric "alignment for performance reasons. Setting this to true can find single " 210b57cec5SDimitry Andric "byte buffer-overflows for multibyte allocations at the cost of " 220b57cec5SDimitry Andric "performance, and may be incompatible with some architectures.") 230b57cec5SDimitry Andric 24*68d75effSDimitry AndricGWP_ASAN_OPTION(int, MaxSimultaneousAllocations, 16, 25*68d75effSDimitry Andric "Number of simultaneously-guarded allocations available in the " 26*68d75effSDimitry Andric "pool. Defaults to 16.") 270b57cec5SDimitry Andric 280b57cec5SDimitry AndricGWP_ASAN_OPTION(int, SampleRate, 5000, 290b57cec5SDimitry Andric "The probability (1 / SampleRate) that an allocation is " 300b57cec5SDimitry Andric "selected for GWP-ASan sampling. Default is 5000. Sample rates " 310b57cec5SDimitry Andric "up to (2^31 - 1) are supported.") 320b57cec5SDimitry Andric 330b57cec5SDimitry AndricGWP_ASAN_OPTION( 340b57cec5SDimitry Andric bool, InstallSignalHandlers, true, 350b57cec5SDimitry Andric "Install GWP-ASan signal handlers for SIGSEGV during dynamic loading. This " 360b57cec5SDimitry Andric "allows better error reports by providing stack traces for allocation and " 370b57cec5SDimitry Andric "deallocation when reporting a memory error. GWP-ASan's signal handler " 380b57cec5SDimitry Andric "will forward the signal to any previously-installed handler, and user " 390b57cec5SDimitry Andric "programs that install further signal handlers should make sure they do " 400b57cec5SDimitry Andric "the same. Note, if the previously installed SIGSEGV handler is SIG_IGN, " 410b57cec5SDimitry Andric "we terminate the process after dumping the error report.") 42