1//===-- options.inc ---------------------------------------------*- C++ -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9#ifndef GWP_ASAN_OPTION 10#error "Define GWP_ASAN_OPTION prior to including this file!" 11#endif 12 13GWP_ASAN_OPTION(bool, Enabled, true, "Is GWP-ASan enabled? Defaults to true.") 14 15GWP_ASAN_OPTION( 16 bool, PerfectlyRightAlign, false, 17 "When allocations are right-aligned, should we perfectly align them up to " 18 "the page boundary? By default (false), we round up allocation size to the " 19 "nearest power of two (1, 2, 4, 8, 16) up to a maximum of 16-byte " 20 "alignment for performance reasons. For Bionic, we use 8-byte alignment by " 21 "default. Setting this to true can find single byte buffer-overflows for " 22 "multibyte allocations at the cost of performance, and may be incompatible " 23 "with some architectures.") 24 25GWP_ASAN_OPTION(int, MaxSimultaneousAllocations, 16, 26 "Number of simultaneously-guarded allocations available in the " 27 "pool. Defaults to 16.") 28 29GWP_ASAN_OPTION(int, SampleRate, 5000, 30 "The probability (1 / SampleRate) that an allocation is " 31 "selected for GWP-ASan sampling. Default is 5000. Sample rates " 32 "up to (2^31 - 1) are supported.") 33 34// Developer note - This option is not actually processed by GWP-ASan itself. It 35// is included here so that a user can specify whether they want signal handlers 36// or not. The supporting allocator should inspect this value to see whether 37// signal handlers need to be installed, and then use 38// crash_handler::installSignalHandlers() in order to install the handlers. Note 39// that in order to support signal handlers, you will need to link against the 40// optional crash_handler component. 41GWP_ASAN_OPTION( 42 bool, InstallSignalHandlers, true, 43 "Install GWP-ASan signal handlers for SIGSEGV during dynamic loading. This " 44 "allows better error reports by providing stack traces for allocation and " 45 "deallocation when reporting a memory error. GWP-ASan's signal handler " 46 "will forward the signal to any previously-installed handler, and user " 47 "programs that install further signal handlers should make sure they do " 48 "the same. Note, if the previously installed SIGSEGV handler is SIG_IGN, " 49 "we terminate the process after dumping the error report.") 50 51GWP_ASAN_OPTION(bool, InstallForkHandlers, true, 52 "Install GWP-ASan atfork handlers to acquire internal locks " 53 "before fork and release them after.") 54