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. Setting this to true can find single "
21    "byte buffer-overflows for multibyte allocations at the cost of "
22    "performance, and may be incompatible with some architectures.")
23
24GWP_ASAN_OPTION(int, MaxSimultaneousAllocations, 16,
25                "Number of simultaneously-guarded allocations available in the "
26                "pool. Defaults to 16.")
27
28GWP_ASAN_OPTION(int, SampleRate, 5000,
29                "The probability (1 / SampleRate) that an allocation is "
30                "selected for GWP-ASan sampling. Default is 5000. Sample rates "
31                "up to (2^31 - 1) are supported.")
32
33GWP_ASAN_OPTION(
34    bool, InstallSignalHandlers, true,
35    "Install GWP-ASan signal handlers for SIGSEGV during dynamic loading. This "
36    "allows better error reports by providing stack traces for allocation and "
37    "deallocation when reporting a memory error. GWP-ASan's signal handler "
38    "will forward the signal to any previously-installed handler, and user "
39    "programs that install further signal handlers should make sure they do "
40    "the same. Note, if the previously installed SIGSEGV handler is SIG_IGN, "
41    "we terminate the process after dumping the error report.")
42