xref: /freebsd/contrib/llvm-project/compiler-rt/lib/scudo/standalone/flags.inc (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
10b57cec5SDimitry Andric//===-- flags.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 SCUDO_FLAG
100b57cec5SDimitry Andric#error "Define SCUDO_FLAG prior to including this file!"
110b57cec5SDimitry Andric#endif
120b57cec5SDimitry Andric
130b57cec5SDimitry AndricSCUDO_FLAG(int, quarantine_size_kb, 0,
140b57cec5SDimitry Andric           "Size (in kilobytes) of quarantine used to delay the actual "
150b57cec5SDimitry Andric           "deallocation of chunks. Lower value may reduce memory usage but "
160b57cec5SDimitry Andric           "decrease the effectiveness of the mitigation.")
170b57cec5SDimitry Andric
180b57cec5SDimitry AndricSCUDO_FLAG(int, thread_local_quarantine_size_kb, 0,
190b57cec5SDimitry Andric           "Size (in kilobytes) of per-thread cache used to offload the global "
200b57cec5SDimitry Andric           "quarantine. Lower value may reduce memory usage but might increase "
210b57cec5SDimitry Andric           "the contention on the global quarantine.")
220b57cec5SDimitry Andric
230b57cec5SDimitry AndricSCUDO_FLAG(int, quarantine_max_chunk_size, 0,
240b57cec5SDimitry Andric           "Size (in bytes) up to which chunks will be quarantined (if lower "
250b57cec5SDimitry Andric           "than or equal to).")
260b57cec5SDimitry Andric
270b57cec5SDimitry AndricSCUDO_FLAG(bool, dealloc_type_mismatch, false,
280b57cec5SDimitry Andric           "Terminate on a type mismatch in allocation-deallocation functions, "
290b57cec5SDimitry Andric           "eg: malloc/delete, new/free, new/delete[], etc.")
300b57cec5SDimitry Andric
310b57cec5SDimitry AndricSCUDO_FLAG(bool, delete_size_mismatch, true,
320b57cec5SDimitry Andric           "Terminate on a size mismatch between a sized-delete and the actual "
330b57cec5SDimitry Andric           "size of a chunk (as provided to new/new[]).")
340b57cec5SDimitry Andric
350b57cec5SDimitry AndricSCUDO_FLAG(bool, zero_contents, false, "Zero chunk contents on allocation.")
360b57cec5SDimitry Andric
375ffd83dbSDimitry AndricSCUDO_FLAG(bool, pattern_fill_contents, false,
385ffd83dbSDimitry Andric           "Pattern fill chunk contents on allocation.")
395ffd83dbSDimitry Andric
400b57cec5SDimitry AndricSCUDO_FLAG(bool, may_return_null, true,
410b57cec5SDimitry Andric           "Indicate whether the allocator should terminate instead of "
420b57cec5SDimitry Andric           "returning NULL in otherwise non-fatal error scenarios, eg: OOM, "
430b57cec5SDimitry Andric           "invalid allocation alignments, etc.")
440b57cec5SDimitry Andric
45*0fca6ea1SDimitry AndricSCUDO_FLAG(int, release_to_os_interval_ms, 5000,
460b57cec5SDimitry Andric           "Interval (in milliseconds) at which to attempt release of unused "
470b57cec5SDimitry Andric           "memory to the OS. Negative values disable the feature.")
48bdd1243dSDimitry Andric
49bdd1243dSDimitry AndricSCUDO_FLAG(int, allocation_ring_buffer_size, 32768,
505f757f3fSDimitry Andric           "Entries to keep in the allocation ring buffer for scudo. "
515f757f3fSDimitry Andric           "Values less or equal to zero disable the buffer.")
52