1 //===-- hwasan_flags.inc ----------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // Hwasan runtime flags.
11 //===----------------------------------------------------------------------===//
13 # error "Define HWASAN_FLAG prior to including this file!"
16 // HWASAN_FLAG(Type, Name, DefaultValue, Description)
17 // See COMMON_FLAG in sanitizer_flags.inc for more details.
19 HWASAN_FLAG(bool, verbose_threads, false,
20 "inform on thread creation/destruction")
21 HWASAN_FLAG(bool, tag_in_malloc, true, "")
22 HWASAN_FLAG(bool, tag_in_free, true, "")
23 HWASAN_FLAG(bool, print_stats, false, "")
24 HWASAN_FLAG(bool, halt_on_error, true, "")
25 HWASAN_FLAG(bool, atexit, false, "")
27 // Test only flag to disable malloc/realloc/free memory tagging on startup.
28 // Tagging can be reenabled with __hwasan_enable_allocator_tagging().
29 HWASAN_FLAG(bool, disable_allocator_tagging, false, "")
31 // If false, use simple increment of a thread local counter to generate new
33 HWASAN_FLAG(bool, random_tags, true, "")
36 int, max_malloc_fill_size, 0,
37 "HWASan allocator flag. max_malloc_fill_size is the maximal amount of "
38 "bytes that will be filled with malloc_fill_byte on malloc.")
40 HWASAN_FLAG(bool, free_checks_tail_magic, 1,
41 "If set, free() will check the magic values "
42 "to the right of the allocated object "
43 "if the allocation size is not a divident of the granule size")
45 int, max_free_fill_size, 0,
46 "HWASan allocator flag. max_free_fill_size is the maximal amount of "
47 "bytes that will be filled with free_fill_byte during free.")
48 HWASAN_FLAG(int, malloc_fill_byte, 0xbe,
49 "Value used to fill the newly allocated memory.")
50 HWASAN_FLAG(int, free_fill_byte, 0x55,
51 "Value used to fill deallocated memory.")
52 HWASAN_FLAG(int, heap_history_size, 1023,
53 "The number of heap (de)allocations remembered per thread. "
54 "Affects the quality of heap-related reports, but not the ability "
56 HWASAN_FLAG(bool, export_memory_stats, true,
57 "Export up-to-date memory stats through /proc")
58 HWASAN_FLAG(int, stack_history_size, 1024,
59 "The number of stack frames remembered per thread. "
60 "Affects the quality of stack-related reports, but not the ability "
63 // Malloc / free bisection. Only tag malloc and free calls when a hash of
64 // allocation size and stack trace is between malloc_bisect_left and
65 // malloc_bisect_right (both inclusive). [0, 0] range is special and disables
66 // bisection (i.e. everything is tagged). Once the range is narrowed down
67 // enough, use malloc_bisect_dump to see interesting allocations.
68 HWASAN_FLAG(uptr, malloc_bisect_left, 0,
69 "Left bound of malloc bisection, inclusive.")
70 HWASAN_FLAG(uptr, malloc_bisect_right, 0,
71 "Right bound of malloc bisection, inclusive.")
72 HWASAN_FLAG(bool, malloc_bisect_dump, false,
73 "Print all allocations within [malloc_bisect_left, "
74 "malloc_bisect_right] range ")
77 // Exit if we fail to enable the AArch64 kernel ABI relaxation which allows
78 // tagged pointers in syscalls. This is the default, but being able to disable
79 // that behaviour is useful for running the testsuite on more platforms (the
80 // testsuite can run since we manually ensure any pointer arguments to syscalls
81 // are untagged before the call.
82 HWASAN_FLAG(bool, fail_without_syscall_abi, true,
83 "Exit if fail to request relaxed syscall ABI.")