diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-11-19 12:55:17 +0000 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-11-20 10:42:20 +0000 |
| commit | 010dcd6a9b64d5bd13579a4b0c4c70a5aee5c967 (patch) | |
| tree | 06b820caa177d8ea5dd0b6d19302b7535af054ae /lib/std/debug/SelfInfo/Windows.zig | |
| parent | 0a330d4f947c1b05ac9f7d624443e2f80db2912f (diff) | |
| download | zig-010dcd6a9b64d5bd13579a4b0c4c70a5aee5c967.tar.gz zig-010dcd6a9b64d5bd13579a4b0c4c70a5aee5c967.zip | |
fuzzer: account for runtime address slide
This is relevant to PIEs, which are notably enabled by default on macOS.
The build system needs to only see virtual addresses, that is, those
which do not have the slide applied; but the fuzzer itself naturally
sees relocated addresses (i.e. with the slide applied). We just need to
subtract the slide when we communicate addresses to the build system.
Diffstat (limited to 'lib/std/debug/SelfInfo/Windows.zig')
| -rw-r--r-- | lib/std/debug/SelfInfo/Windows.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/debug/SelfInfo/Windows.zig b/lib/std/debug/SelfInfo/Windows.zig index 70009217db..306287a9e7 100644 --- a/lib/std/debug/SelfInfo/Windows.zig +++ b/lib/std/debug/SelfInfo/Windows.zig @@ -33,6 +33,12 @@ pub fn getModuleName(si: *SelfInfo, gpa: Allocator, address: usize) Error![]cons const module = try si.findModule(gpa, address); return module.name; } +pub fn getModuleSlide(si: *SelfInfo, gpa: Allocator, address: usize) Error!usize { + si.mutex.lock(); + defer si.mutex.unlock(); + const module = try si.findModule(gpa, address); + return module.base_address; +} pub const can_unwind: bool = switch (builtin.cpu.arch) { else => true, |
