Skip to content

Commit 6d173f1

Browse files
authored
Fuzzilli: port to Windows (googleprojectzero#288)
Windows does not provide a `getpid` function, but the value is used for the name of the global mapping setup in libcoverage. This changes it to match the generation in libcoverge - use `GetCurrentProcessId`.
1 parent 3694164 commit 6d173f1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sources/Fuzzilli/Evaluation/ProgramCoverageEvaluator.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@ public class ProgramCoverageEvaluator: ComponentBase, ProgramEvaluator {
100100
guard libcoverage.cov_initialize(&context) == 0 else {
101101
fatalError("Could not initialize libcoverage")
102102
}
103+
#if os(Windows)
104+
runner.setEnvironmentVariable("SHM_ID", to: "shm_id_\(GetCurrentProcessId())_\(id)")
105+
#else
103106
runner.setEnvironmentVariable("SHM_ID", to: "shm_id_\(getpid())_\(id)")
107+
#endif
104108

105109
}
106110

0 commit comments

Comments
 (0)