| ... | @@ -40,6 +40,7 @@ const maybe_have_wipe_on_fork = builtin.os.isAtLeast(.linux, .{ | ... | @@ -40,6 +40,7 @@ const maybe_have_wipe_on_fork = builtin.os.isAtLeast(.linux, .{ |
| 40 | .major = 4, | 40 | .major = 4, |
| 41 | .minor = 14, | 41 | .minor = 14, |
| 42 | }) orelse true; | 42 | }) orelse true; |
| | 43 | const is_haiku = builtin.os.tag == .haiku; |
| 43 | | 44 | |
| 44 | const Context = struct { | 45 | const Context = struct { |
| 45 | init_state: enum(u8) { uninitialized = 0, initialized, failed }, | 46 | init_state: enum(u8) { uninitialized = 0, initialized, failed }, |
| ... | @@ -72,7 +73,7 @@ fn tlsCsprngFill(_: *c_void, buffer: []u8) void { | ... | @@ -72,7 +73,7 @@ fn tlsCsprngFill(_: *c_void, buffer: []u8) void { |
| 72 | | 73 | |
| 73 | if (wipe_mem.len == 0) { | 74 | if (wipe_mem.len == 0) { |
| 74 | // Not initialized yet. | 75 | // Not initialized yet. |
| 75 | if (want_fork_safety and maybe_have_wipe_on_fork) { | 76 | if (want_fork_safety and maybe_have_wipe_on_fork or is_haiku) { |
| 76 | // Allocate a per-process page, madvise operates with page | 77 | // Allocate a per-process page, madvise operates with page |
| 77 | // granularity. | 78 | // granularity. |
| 78 | wipe_mem = os.mmap( | 79 | wipe_mem = os.mmap( |