lib/stabilizer/src/config.zig
daab053ee43316e1809a84551d573ddd1e5bf3d2
1 pub const default_seed: u64 = 0x57ab_1e12_2013;
2 pub const default_shuffle_slots: usize = 256;
3 pub const default_region_size: usize = 0x2000000;
4 pub const code_alignment: usize = 32;
5 pub const stack_alignment: usize = 16;
6 pub const rerandomize_interval_ms: u64 = 500;
7 pub const max_stack_pad_unit: u8 = 255;
8
9 pub const Config = struct {
10 seed: u64 = default_seed,
11 heap: HeapConfig = .{},
12 stack: StackConfig = .{},
13 code: CodeConfig = .{},
14 };
15
16 pub const HeapConfig = struct {
17 enabled: bool = true,
18 pointer_validation: bool = true,
19 shuffle_slots: usize = default_shuffle_slots,
20 min_class_size: usize = 16,
21 max_shuffled_size: usize = 64 * 1024,
22 };
23
24 pub const StackConfig = struct {
25 enabled: bool = true,
26 entries: usize = 256,
27 alignment: usize = stack_alignment,
28 };
29
30 pub const CodeConfig = struct {
31 enabled: bool = true,
32 shuffle_slots: usize = default_shuffle_slots,
33 alignment: usize = code_alignment,
34 interval_ms: u64 = rerandomize_interval_ms,
35 };
36
37 pub const Reference = struct {
38 pub const data_shuffle: usize = 256;
39 pub const data_size: usize = 0x2000000;
40 pub const code_shuffle: usize = 256;
41 pub const code_size: usize = 0x2000000;
42 pub const code_align: usize = 32;
43 pub const stack_align: usize = 16;
44 pub const interval_ms: u64 = 500;
45 };