-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
initial support for integrated fuzzing #20725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
54b7e14
initial support for integrated fuzzing
andrewrk 1741b82
add the build system API for enabling fuzzing
andrewrk 7802cf9
avoid depending on a zig1.wasm update
andrewrk b9225ae
add libfuzzer to linking
andrewrk 7930efc
libfuzzer: implement enough symbols for hello world
andrewrk 2519881
add new builtin: `@disableInstrumentation`
andrewrk bde8c4a
update start code to use `@disableInstrumentation`
andrewrk 105b91d
ZigLLVMTargetMachineEmitToFile: make sancov enable the options
andrewrk dbbe2f1
libfuzzer: log all the libcalls to stderr
andrewrk af7b671
update zig1.wasm
andrewrk ae09f9b
std.mem: delete workaround now that zig1.wasm is updated
andrewrk 1cb9948
Compilation: fix regression in addCCArgs
andrewrk 61ad1be
fix macho linker integration with libfuzzer
andrewrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const std = @import("std"); | ||
|
||
export threadlocal var __sancov_lowest_stack: usize = 0; | ||
|
||
export fn __sanitizer_cov_8bit_counters_init(start: [*]u8, stop: [*]u8) void { | ||
std.debug.print("__sanitizer_cov_8bit_counters_init start={*}, stop={*}\n", .{ start, stop }); | ||
} | ||
|
||
export fn __sanitizer_cov_pcs_init(pcs_beg: [*]const usize, pcs_end: [*]const usize) void { | ||
std.debug.print("__sanitizer_cov_pcs_init pcs_beg={*}, pcs_end={*}\n", .{ pcs_beg, pcs_end }); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_const_cmp1(arg1: u8, arg2: u8) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_cmp1(arg1: u8, arg2: u8) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_const_cmp2(arg1: u16, arg2: u16) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_cmp2(arg1: u16, arg2: u16) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_const_cmp4(arg1: u32, arg2: u32) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_cmp4(arg1: u32, arg2: u32) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_const_cmp8(arg1: u64, arg2: u64) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_cmp8(arg1: u64, arg2: u64) void { | ||
handleCmp(@returnAddress(), arg1, arg2); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_switch(val: u64, cases_ptr: [*]u64) void { | ||
const pc = @returnAddress(); | ||
const len = cases_ptr[0]; | ||
const val_size_in_bits = cases_ptr[1]; | ||
const cases = cases_ptr[2..][0..len]; | ||
std.debug.print("0x{x}: switch on value {d} ({d} bits) with {d} cases\n", .{ | ||
pc, val, val_size_in_bits, cases.len, | ||
}); | ||
} | ||
|
||
export fn __sanitizer_cov_trace_pc_indir(callee: usize) void { | ||
const pc = @returnAddress(); | ||
std.debug.print("0x{x}: indirect call to 0x{x}\n", .{ pc, callee }); | ||
} | ||
|
||
fn handleCmp(pc: usize, arg1: u64, arg2: u64) void { | ||
std.debug.print("0x{x}: comparison of {d} and {d}\n", .{ pc, arg1, arg2 }); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add this built-in to the langref?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it makes sense to leave out of the langref but include in the spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course
This not Meghan's Opinion Tracker. Provide technical arguments, or keep your opinion to yourself.