| author | |
| committer | |
| log | 2d005827b874f27535cda72c80b6558d9d4cd30c |
| tree | 9080004df76b836ff98416e1779bdcd85677ffd9 |
| parent | 0cdccff51912359b7ec5afa57fbbd5bb69d8f3a2 |
This value is useful to help determine run uniqueness in the face of
recursion, however it is not valuable to expose to the fuzzing UI.6 files changed, 3 insertions(+), 17 deletions(-)
lib/fuzzer.zig+3-3| ... | ... | @@ -28,7 +28,8 @@ fn logOverride( |
| 28 | 28 | f.writer().print(prefix1 ++ prefix2 ++ format ++ "\n", args) catch @panic("failed to write to fuzzer log"); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | export threadlocal var __sancov_lowest_stack: usize = std.math.maxInt(usize); | |
| 31 | /// Helps determine run uniqueness in the face of recursion. | |
| 32 | export threadlocal var __sancov_lowest_stack: usize = 0; | |
| 32 | 33 | |
| 33 | 34 | export fn __sanitizer_cov_trace_const_cmp1(arg1: u8, arg2: u8) void { |
| 34 | 35 | handleCmp(@returnAddress(), arg1, arg2); |
| ... | ... | @@ -220,7 +221,6 @@ const Fuzzer = struct { |
| 220 | 221 | .n_runs = 0, |
| 221 | 222 | .unique_runs = 0, |
| 222 | 223 | .pcs_len = pcs.len, |
| 223 | .lowest_stack = std.math.maxInt(usize), | |
| 224 | 224 | }; |
| 225 | 225 | f.seen_pcs.appendSliceAssumeCapacity(std.mem.asBytes(&header)); |
| 226 | 226 | f.seen_pcs.appendNTimesAssumeCapacity(0, n_bitset_elems * @sizeOf(usize)); |
| ... | ... | @@ -261,8 +261,8 @@ const Fuzzer = struct { |
| 261 | 261 | f.input.appendSliceAssumeCapacity(run.input); |
| 262 | 262 | try f.mutate(); |
| 263 | 263 | |
| 264 | _ = @atomicRmw(usize, &header.lowest_stack, .Min, __sancov_lowest_stack, .monotonic); | |
| 265 | 264 | @memset(f.pc_counters, 0); |
| 265 | __sancov_lowest_stack = std.math.maxInt(usize); | |
| 266 | 266 | f.coverage.reset(); |
| 267 | 267 | |
| 268 | 268 | fuzzer_one(f.input.items.ptr, f.input.items.len); |
lib/fuzzer/web/index.html-1| ... | ... | @@ -147,7 +147,6 @@ |
| 147 | 147 | <li>Total Runs: <span id="statTotalRuns"></span></li> |
| 148 | 148 | <li>Unique Runs: <span id="statUniqueRuns"></span></li> |
| 149 | 149 | <li>Coverage: <span id="statCoverage"></span></li> |
| 150 | <li>Lowest Stack: <span id="statLowestStack"></span></li> | |
| 151 | 150 | <li>Entry Points: <ul id="entryPointsList"></ul></li> |
| 152 | 151 | </ul> |
| 153 | 152 | </div> |
lib/fuzzer/web/main.js-2| ... | ... | @@ -6,7 +6,6 @@ |
| 6 | 6 | const domStatTotalRuns = document.getElementById("statTotalRuns"); |
| 7 | 7 | const domStatUniqueRuns = document.getElementById("statUniqueRuns"); |
| 8 | 8 | const domStatCoverage = document.getElementById("statCoverage"); |
| 9 | const domStatLowestStack = document.getElementById("statLowestStack"); | |
| 10 | 9 | const domEntryPointsList = document.getElementById("entryPointsList"); |
| 11 | 10 | |
| 12 | 11 | let wasm_promise = fetch("main.wasm"); |
| ... | ... | @@ -158,7 +157,6 @@ |
| 158 | 157 | domStatTotalRuns.innerText = totalRuns; |
| 159 | 158 | domStatUniqueRuns.innerText = uniqueRuns + " (" + percent(uniqueRuns, totalRuns) + "%)"; |
| 160 | 159 | domStatCoverage.innerText = coveredSourceLocations + " / " + totalSourceLocations + " (" + percent(coveredSourceLocations, totalSourceLocations) + "%)"; |
| 161 | domStatLowestStack.innerText = unwrapString(wasm_exports.lowestStack()); | |
| 162 | 160 | |
| 163 | 161 | const entryPoints = unwrapInt32Array(wasm_exports.entryPoints()); |
| 164 | 162 | resizeDomList(domEntryPointsList, entryPoints.length, "<li></li>"); |
lib/fuzzer/web/main.zig-7| ... | ... | @@ -106,13 +106,6 @@ export fn decl_source_html(decl_index: Decl.Index) String { |
| 106 | 106 | return String.init(string_result.items); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | export fn lowestStack() String { | |
| 110 | const header: *abi.CoverageUpdateHeader = @ptrCast(recent_coverage_update.items[0..@sizeOf(abi.CoverageUpdateHeader)]); | |
| 111 | string_result.clearRetainingCapacity(); | |
| 112 | string_result.writer(gpa).print("0x{d}", .{header.lowest_stack}) catch @panic("OOM"); | |
| 113 | return String.init(string_result.items); | |
| 114 | } | |
| 115 | ||
| 116 | 109 | export fn totalSourceLocations() usize { |
| 117 | 110 | return coverage_source_locations.items.len; |
| 118 | 111 | } |
lib/std/Build/Fuzz/WebServer.zig-2| ... | ... | @@ -406,7 +406,6 @@ fn sendCoverageContext( |
| 406 | 406 | const seen_pcs = cov_header.seenBits(); |
| 407 | 407 | const n_runs = @atomicLoad(usize, &cov_header.n_runs, .monotonic); |
| 408 | 408 | const unique_runs = @atomicLoad(usize, &cov_header.unique_runs, .monotonic); |
| 409 | const lowest_stack = @atomicLoad(usize, &cov_header.lowest_stack, .monotonic); | |
| 410 | 409 | if (prev_unique_runs.* != unique_runs) { |
| 411 | 410 | // There has been an update. |
| 412 | 411 | if (prev_unique_runs.* == 0) { |
| ... | ... | @@ -431,7 +430,6 @@ fn sendCoverageContext( |
| 431 | 430 | const header: abi.CoverageUpdateHeader = .{ |
| 432 | 431 | .n_runs = n_runs, |
| 433 | 432 | .unique_runs = unique_runs, |
| 434 | .lowest_stack = lowest_stack, | |
| 435 | 433 | }; |
| 436 | 434 | const iovecs: [2]std.posix.iovec_const = .{ |
| 437 | 435 | makeIov(std.mem.asBytes(&header)), |
lib/std/Build/Fuzz/abi.zig-2| ... | ... | @@ -13,7 +13,6 @@ pub const SeenPcsHeader = extern struct { |
| 13 | 13 | n_runs: usize, |
| 14 | 14 | unique_runs: usize, |
| 15 | 15 | pcs_len: usize, |
| 16 | lowest_stack: usize, | |
| 17 | 16 | |
| 18 | 17 | /// Used for comptime assertions. Provides a mechanism for strategically |
| 19 | 18 | /// causing compile errors. |
| ... | ... | @@ -79,7 +78,6 @@ pub const CoverageUpdateHeader = extern struct { |
| 79 | 78 | flags: Flags = .{}, |
| 80 | 79 | n_runs: u64, |
| 81 | 80 | unique_runs: u64, |
| 82 | lowest_stack: u64, | |
| 83 | 81 | |
| 84 | 82 | pub const Flags = packed struct(u64) { |
| 85 | 83 | tag: ToClientTag = .coverage_update, |