Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Capture crash dumps from libfuzzer, when provided #2793

Merged
merged 80 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
fa6737f
WIP
Porges Feb 2, 2023
ecd1c78
Fix test
Porges Feb 2, 2023
6e5800d
Update docs
Porges Feb 2, 2023
3c95ed7
Server side changes
Porges Feb 2, 2023
3a9b160
Doh
Porges Feb 3, 2023
0d37c41
Update integration tests
Porges Feb 3, 2023
96a1ced
WIP
Porges Feb 3, 2023
8b848c0
Merge branch 'main' into asan_dumps
Porges Feb 6, 2023
9c6485d
Include Crashdumps container in BuildTaskConfig
Porges Feb 6, 2023
217a667
Add target_env support to AFL template
Porges Feb 6, 2023
fcd508c
Merge branch 'main' into asan_dumps
Porges Feb 7, 2023
c053d79
Merge branch 'main' into asan_dumps
Porges Feb 13, 2023
413c3ea
Merge branch 'main' into asan_dumps
Porges Feb 15, 2023
977d9d2
Merge remote-tracking branch 'origin/main' into HEAD
Porges Feb 19, 2023
fbcdde4
Add support to generic supervisor
Porges Feb 15, 2023
7002cea
Fixup
Porges Feb 19, 2023
f09666b
Merge branch 'main' into asan_dumps
Porges Feb 20, 2023
6bcbb9d
Add monitor_results for crashdumps
Porges Feb 20, 2023
003d0d5
Update run.sh
Porges Feb 20, 2023
b17a3c7
Merge branch 'main' into asan_dumps
Porges Feb 20, 2023
3277147
Remove changes from setup.sh
Porges Feb 20, 2023
6d5bee4
Thinko
Porges Feb 21, 2023
4698485
Add unmap_shadow_on_exit
Porges Feb 21, 2023
235fb1e
Merge branch 'main' into asan_dumps
Porges Feb 22, 2023
55e8921
Merge branch 'main' into asan_dumps
Porges Feb 26, 2023
cc82b2c
Merge branch 'main' into asan_dumps
Porges Feb 27, 2023
939b056
Merge remote-tracking branch 'origin/main' into asan_dumps
Porges Mar 20, 2023
3382270
Windows impl
Porges Mar 20, 2023
23e5b59
Fix Windows build
Porges Mar 21, 2023
f1544d9
Merge branch 'main' into asan_dumps
Porges Mar 22, 2023
10fdd5d
Merge branch 'main' into asan_dumps
Porges Mar 28, 2023
fa626bd
Make Windows wait for dump
Porges Mar 28, 2023
61002af
Merge branch 'main' into asan_dumps
Porges Apr 2, 2023
8a4de92
Merge branch 'main' into asan_dumps
Porges Apr 4, 2023
5ca1617
Merge branch 'main' into asan_dumps
Porges Apr 4, 2023
5a4929e
Merge branch 'main' into asan_dumps
Porges Apr 25, 2023
850102b
Merge branch 'main' into asan_dumps
Porges Apr 25, 2023
ad7f488
Merge branch 'main' into asan_dumps
Porges Apr 28, 2023
70d6e9d
Merge remote-tracking branch 'origin/main' into asan_dumps
Porges May 8, 2023
b895abd
Merge remote-tracking branch 'origin/main' into asan_dumps
Porges May 14, 2023
319e443
Correct Windows dump parameter in integration test
Porges May 14, 2023
6e165f8
Remove leading dot of extension
Porges May 15, 2023
719f948
Improve integration test logs
Porges May 15, 2023
473bb08
Merge branch 'main' into asan_dumps
Porges May 16, 2023
a143532
...
Porges May 15, 2023
5352b48
Expand valid scaleset names (#3045)
Porges May 16, 2023
2c57f27
Increase lock wait timeout for qemu_user setup (#3114)
Porges May 17, 2023
f862b3f
Merge remote-tracking branch 'origin/main' into asan_dumps
Porges May 21, 2023
5de3502
Remove unused import
Porges May 21, 2023
024bdb5
Merge branch 'main' into asan_dumps
Porges May 25, 2023
e57eba6
Merge remote-tracking branch 'origin/main' into asan_dumps
Porges Jun 6, 2023
4ab6737
add comment
Porges Jun 6, 2023
b27fd3e
Merge branch 'main' into asan_dumps
Porges Jun 27, 2023
b88dbc1
post-merge fix
Porges Jun 27, 2023
e09e815
Rename crashdumps appropriately
Porges Jun 27, 2023
70e9b6e
Restrict failure types during test
Porges Jun 27, 2023
b3d8e11
Merge branch 'main' into asan_dumps
Porges Jul 3, 2023
007b28d
add more logging
Porges Jul 3, 2023
832798a
more logging
Porges Jul 4, 2023
51118d0
Yet more logging
Porges Jul 4, 2023
9c2e77d
logging again
Porges Jul 4, 2023
af528a8
Fix path concatenation
Porges Jul 4, 2023
0cacbe5
Merge branch 'main' into asan_dumps
Porges Jul 5, 2023
6e46588
Merge branch 'main' into asan_dumps
Porges Jul 5, 2023
04a7b92
Merge branch 'main' into asan_dumps
Porges Jul 11, 2023
c194887
Try removing "workaround"
Porges Jul 11, 2023
4a8364e
Update cache keys
Porges Jul 11, 2023
2e319fb
Compile libfuzzer test using cl.exe
Porges Jul 11, 2023
5e57ebf
Change pinned commit
Porges Jul 11, 2023
93f850b
Bump Windows image version
Porges Jul 11, 2023
9cbc116
Update Makefile again
Porges Jul 11, 2023
338f38c
Merge branch 'main' into asan_dumps
Porges Jul 12, 2023
d32c8a0
Merge branch 'main' into asan_dumps
Porges Jul 18, 2023
31bf877
Merge branch 'main' into asan_dumps
Porges Aug 1, 2023
f65c2b6
Post-merge update
Porges Aug 1, 2023
bf2fe3a
Disable crashdump check for Linux in test
Porges Aug 1, 2023
7ada9ac
Merge branch 'main' into asan_dumps
Porges Aug 1, 2023
6906dc2
Merge branch 'main' into asan_dumps
Porges Aug 8, 2023
919ffbf
Produce message when no crash dump was found
Porges Aug 8, 2023
09a7ec8
Merge branch 'main' into asan_dumps
Porges Aug 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 5 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ jobs:
uses: actions/cache@v3
with:
path: src/integration-tests/artifacts
key: integration-tests|linux|${{ hashFiles('src/integration-tests/**/*') }}
key: integration-tests|linux|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/integration-tests/**/*') }}
- name: Build integration tests
if: steps.cache-integration-tests.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -590,15 +590,17 @@ jobs:
name: artifact-integration-tests-linux
path: src/integration-tests/artifacts
build-integration-tests-windows:
runs-on: windows-2019
runs-on: windows-2022
steps:
- uses: actions/checkout@v3
- name: Cache integration tests
id: cache-integration-tests
uses: actions/cache@v3
with:
path: src/integration-tests/artifacts
key: integration-tests|windows|${{ hashFiles('src/integration-tests/**/*') }}
key: integration-tests|windows|${{ env.ACTIONS_CACHE_KEY_DATE }}|${{ hashFiles('src/integration-tests/**/*') }}
- name: Setup C/C++ environment
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # pinned to v1.12.1
- name: Build integration tests
if: steps.cache-integration-tests.outputs.cache-hit != 'true'
run: |
Expand All @@ -609,33 +611,6 @@ jobs:
choco install make
$env:Path += ";C:\Program Files\LLVM\bin;C:\ProgramData\chocolatey\bin"

# WORKAROUND: effectively downgrade the default Windows 10 SDK version.
#
# This ensures we link against a version of the SDK which won't trigger a
# startup bug in the LLVM-shipped ASAN runtime.

# Assume a default MSVC 2019 install path.
$MsvcDir = 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC'

# Assume that `$MsvcDir` only contains version-named subdirectories.
$MsvcVersion = ((Get-ChildItem $MsvcDir).name | Sort-Object -Descending)[0]
$MsvcLib = "${MsvcDir}/${MsvcVersion}/lib/x64"

# Known "good" (non-bug-surfacing) version.
$WindowsSdkVersion = '10.0.18362.0'

# Assume default install path.
$WindowsSdkDir = 'C:/Program Files (x86)/Windows Kits/10'
$WindowsSdkLib = "${WindowsSdkDir}/Lib/${WindowsSdkVersion}"
$WindowsSdkInclude = "${WindowsSdkDir}/Include/${WindowsSdkVersion}"

# Used by `clang.exe`.
$env:CPATH = $WindowsSdkInclude
$env:LIBRARY_PATH = "${MsvcLib};${WindowsSdkLib}/ucrt/x64;${WindowsSdkLib}/um/x64"

# Used by `link.exe`.
$env:LIB = $env:LIBRARY_PATH

cd src/integration-tests

mkdir artifacts/windows-libfuzzer
Expand Down
8 changes: 8 additions & 0 deletions docs/webhook_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -1956,6 +1957,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -2867,6 +2869,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -3358,6 +3361,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -3867,6 +3871,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -4324,6 +4329,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -4808,6 +4814,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down Expand Up @@ -5422,6 +5429,7 @@ If webhook is set to have Event Grid message format then the payload will look a
"coverage",
"crashes",
"inputs",
"crashdumps",
"no_repro",
"readonly_inputs",
"reports",
Expand Down
1 change: 1 addition & 0 deletions src/ApiService/ApiService/OneFuzzTypes/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public enum ContainerType {
Analysis,
Coverage,
Crashes,
Crashdumps,
Inputs,
NoRepro,
ReadonlyInputs,
Expand Down
1 change: 1 addition & 0 deletions src/ApiService/ApiService/OneFuzzTypes/Model.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ Dictionary<string, string> Tags
public IContainerDef? Analysis { get; set; }
public IContainerDef? Coverage { get; set; }
public IContainerDef? Crashes { get; set; }
public IContainerDef? Crashdumps { get; set; }
public IContainerDef? Inputs { get; set; }
public IContainerDef? NoRepro { get; set; }
public IContainerDef? ReadonlyInputs { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions src/ApiService/ApiService/onefuzzlib/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ await _containers.GetContainerSasUrl(container.Name, StorageType.Corpus, Convert
case ContainerType.Crashes:
config.Crashes = def;
break;
case ContainerType.Crashdumps:
config.Crashdumps = def;
break;
case ContainerType.Inputs:
config.Inputs = def;
break;
Expand Down
12 changes: 12 additions & 0 deletions src/ApiService/ApiService/onefuzzlib/Defs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ public static class Defs {
Value: 1,
Permissions: ContainerPermission.Write
),
new ContainerDefinition(
Type:ContainerType.Crashdumps,
Compare: Compare.Equal,
Value:1,
Permissions: ContainerPermission.Write
),
new ContainerDefinition(
Type: ContainerType.Inputs,
Compare: Compare.Equal,
Expand Down Expand Up @@ -279,6 +285,12 @@ public static class Defs {
Value: 1,
Permissions: ContainerPermission.Write
),
new ContainerDefinition(
Type:ContainerType.Crashdumps,
Compare: Compare.Equal,
Value:1,
Permissions: ContainerPermission.Write
),
new ContainerDefinition(
Type: ContainerType.Inputs,
Compare: Compare.Equal,
Expand Down
1 change: 1 addition & 0 deletions src/agent/onefuzz-task/src/local/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use crate::tasks::utils::parse_key_value;
pub const SETUP_DIR: &str = "setup_dir";
pub const INPUTS_DIR: &str = "inputs_dir";
pub const CRASHES_DIR: &str = "crashes_dir";
pub const CRASHDUMPS_DIR: &str = "crashdumps_dir";
pub const TARGET_WORKERS: &str = "target_workers";
pub const REPORTS_DIR: &str = "reports_dir";
pub const NO_REPRO_DIR: &str = "no_repro_dir";
Expand Down
11 changes: 9 additions & 2 deletions src/agent/onefuzz-task/src/local/libfuzzer_fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::path::PathBuf;
use crate::{
local::common::{
build_local_context, get_cmd_arg, get_cmd_env, get_cmd_exe, get_synced_dir, CmdType,
SyncCountDirMonitor, UiEvent, CHECK_FUZZER_HELP, CRASHES_DIR, INPUTS_DIR, TARGET_ENV,
TARGET_EXE, TARGET_OPTIONS, TARGET_WORKERS,
SyncCountDirMonitor, UiEvent, CHECK_FUZZER_HELP, CRASHDUMPS_DIR, CRASHES_DIR, INPUTS_DIR,
TARGET_ENV, TARGET_EXE, TARGET_OPTIONS, TARGET_WORKERS,
},
tasks::{
config::CommonConfig,
Expand All @@ -27,6 +27,8 @@ pub fn build_fuzz_config(
) -> Result<Config> {
let crashes = get_synced_dir(CRASHES_DIR, common.job_id, common.task_id, args)?
.monitor_count(&event_sender)?;
let crashdumps = get_synced_dir(CRASHDUMPS_DIR, common.job_id, common.task_id, args)?
.monitor_count(&event_sender)?;
let inputs = get_synced_dir(INPUTS_DIR, common.job_id, common.task_id, args)?
.monitor_count(&event_sender)?;

Expand All @@ -49,6 +51,7 @@ pub fn build_fuzz_config(
inputs,
readonly_inputs,
crashes,
crashdumps,
target_exe,
target_env,
target_options,
Expand Down Expand Up @@ -85,6 +88,10 @@ pub fn build_shared_args() -> Vec<Arg> {
.long(CRASHES_DIR)
.required(true)
.value_parser(value_parser!(PathBuf)),
Arg::new(CRASHDUMPS_DIR)
.long(CRASHDUMPS_DIR)
.required(true)
.value_parser(value_parser!(PathBuf)),
Arg::new(TARGET_WORKERS)
.long(TARGET_WORKERS)
.value_parser(value_parser!(u64)),
Expand Down
2 changes: 2 additions & 0 deletions src/agent/onefuzz-task/src/local/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct LibFuzzer {
inputs: PathBuf,
readonly_inputs: Vec<PathBuf>,
crashes: PathBuf,
crashdumps: PathBuf,
target_exe: PathBuf,
target_env: HashMap<String, String>,
target_options: Vec<String>,
Expand Down Expand Up @@ -143,6 +144,7 @@ impl TaskConfig {
inputs: context.to_monitored_sync_dir("inputs", &config.inputs)?,
readonly_inputs: Some(ri?),
crashes: context.to_monitored_sync_dir("crashes", &config.crashes)?,
crashdumps: context.to_monitored_sync_dir("crashdumps", &config.crashdumps)?,
target_exe: config.target_exe.clone(),
target_env: config.target_env.clone(),
target_options: config.target_options.clone(),
Expand Down
Loading