Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 1 | //===-- scudo_flags.inc -----------------------------------------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 58d4360 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | /// |
| 9 | /// Hardened Allocator runtime flags. |
| 10 | /// |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | #ifndef SCUDO_FLAG |
| 14 | # error "Define SCUDO_FLAG prior to including this file!" |
| 15 | #endif |
| 16 | |
Kostya Kortchinsky | 044cfea | 2017-02-03 20:49:42 +0000 | [diff] [blame] | 17 | SCUDO_FLAG(int, QuarantineSizeMb, -1, |
Kostya Kortchinsky | 5884a66 | 2017-07-24 15:29:38 +0000 | [diff] [blame] | 18 | "Deprecated. Please use QuarantineSizeKb.") |
| 19 | |
| 20 | // Default value is set in scudo_flags.cpp based on architecture. |
| 21 | SCUDO_FLAG(int, QuarantineSizeKb, -1, |
| 22 | "Size in KB of quarantine used to delay the actual deallocation of " |
| 23 | "chunks. Lower value may reduce memory usage but decrease the " |
| 24 | "effectiveness of the mitigation. Defaults to 64KB (32-bit) or " |
| 25 | "256KB (64-bit)") |
Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 26 | |
Kostya Kortchinsky | 044cfea | 2017-02-03 20:49:42 +0000 | [diff] [blame] | 27 | // Default value is set in scudo_flags.cpp based on architecture. |
| 28 | SCUDO_FLAG(int, ThreadLocalQuarantineSizeKb, -1, |
Kostya Kortchinsky | 5884a66 | 2017-07-24 15:29:38 +0000 | [diff] [blame] | 29 | "Size in KB of per-thread cache used to offload the global " |
Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 30 | "quarantine. Lower value may reduce memory usage but might increase " |
Kostya Kortchinsky | 5884a66 | 2017-07-24 15:29:38 +0000 | [diff] [blame] | 31 | "the contention on the global quarantine. Defaults to 16KB (32-bit) " |
| 32 | "or 64KB (64-bit)") |
| 33 | |
| 34 | // Default value is set in scudo_flags.cpp based on architecture. |
| 35 | SCUDO_FLAG(int, QuarantineChunksUpToSize, -1, |
| 36 | "Size in bytes up to which chunks will be quarantined (if lower than" |
| 37 | "or equal to). Defaults to 256 (32-bit) or 2048 (64-bit)") |
Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 38 | |
Kostya Kortchinsky | d6524c1 | 2019-01-24 15:56:54 +0000 | [diff] [blame] | 39 | // Disable the deallocation type check by default on Android, it causes too many |
| 40 | // issues with third party libraries. |
| 41 | SCUDO_FLAG(bool, DeallocationTypeMismatch, !SANITIZER_ANDROID, |
Kostya Serebryany | a8e7154 | 2016-06-07 01:20:26 +0000 | [diff] [blame] | 42 | "Report errors on malloc/delete, new/free, new/delete[], etc.") |
| 43 | |
| 44 | SCUDO_FLAG(bool, DeleteSizeMismatch, true, |
| 45 | "Report errors on mismatch between size of new and delete.") |
| 46 | |
| 47 | SCUDO_FLAG(bool, ZeroContents, false, |
| 48 | "Zero chunk contents on allocation and deallocation.") |