Skip to content

Commit 07881fd

Browse files
Update Fuzzing to run correctly (#67498)
1 parent 360e42c commit 07881fd

2 files changed

Lines changed: 69 additions & 69 deletions

File tree

.azure/pipelines/fuzzing/deploy-to-onefuzz.yml

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -46,66 +46,70 @@ extends:
4646
stages:
4747
- stage: Build
4848
jobs:
49-
- job: DeployToOneFuzz
50-
displayName: Build & Deploy to OneFuzz
51-
timeoutInMinutes: 120
52-
pool:
53-
name: $(DncEngInternalBuildPool)
54-
demands: ImageOverride -equals windows.vs2026.amd64
49+
- template: .azure/pipelines/jobs/default-build.yml@self
50+
parameters:
51+
jobName: DeployToOneFuzz
52+
jobDisplayName: Build & Deploy to OneFuzz
53+
timeoutInMinutes: 120
54+
agentOs: Windows
55+
steps:
56+
- script: git submodule update --init
57+
displayName: Update submodules
5558

56-
steps:
57-
- checkout: self
58-
clean: true
59-
fetchDepth: 1
60-
fetchTags: false
59+
# The SharpFuzz CLI currently targets .NET 10.0
60+
# Install a .NET 10.0 runtime.
61+
- task: UseDotNet@2
62+
displayName: Install .NET 10.0 (for SharpFuzz CLI)
63+
inputs:
64+
packageType: runtime
65+
version: 10.x
66+
installationPath: $(Build.SourcesDirectory)/.dotnet
6167

62-
# The SharpFuzz CLI currently targets .NET 9.0 and won't run under
63-
# the repo-local .NET SDK. Install a system-wide .NET 9.0 SDK.
64-
- powershell: |
65-
winget install -e --id Microsoft.DotNet.SDK.9 --accept-package-agreements --accept-source-agreements
66-
displayName: Install .NET 9.0 (for SharpFuzz CLI)
68+
- script: ./eng/build.cmd
69+
displayName: Build repo
6770

68-
# Restore and build the fuzzing project using the repo-local SDK.
69-
- powershell: |
70-
. $(Build.SourcesDirectory)/activate.ps1
71-
cd $(fuzzerProject)
72-
dotnet build-server shutdown
73-
dotnet build -c Release
74-
displayName: Build Fuzzing targets
71+
# Restore and build the fuzzing project using the repo-local SDK.
72+
- powershell: |
73+
. $(Build.SourcesDirectory)/activate.ps1
74+
cd $(fuzzerProject)
75+
dotnet build-server shutdown
76+
dotnet build -c Release
77+
displayName: Build Fuzzing targets
7578
76-
# Install SharpFuzz.CommandLine as a local tool for instrumenting assemblies.
77-
- powershell: |
78-
cd $(fuzzerProject)
79-
dotnet tool install --tool-path . SharpFuzz.CommandLine
80-
displayName: Install SharpFuzz.CommandLine
79+
# Install SharpFuzz.CommandLine as a local tool for instrumenting assemblies.
80+
- powershell: |
81+
cd $(fuzzerProject)
82+
dotnet tool install --tool-path . SharpFuzz.CommandLine --version 2.3.0
83+
displayName: Install SharpFuzz.CommandLine
8184
82-
# Run the prepare-onefuzz command to create per-fuzzer deployment directories
83-
# with instrumented assemblies, libfuzzer-dotnet.exe, and OneFuzzConfig.json.
84-
- powershell: |
85-
cd $(fuzzerProject)
86-
./run.bat
87-
displayName: Prepare OneFuzz deployment
85+
# Run the prepare-onefuzz command to create per-fuzzer deployment directories
86+
# with instrumented assemblies, libfuzzer-dotnet.exe, and OneFuzzConfig.json.
87+
- powershell: |
88+
. $(Build.SourcesDirectory)/activate.ps1
89+
cd $(fuzzerProject)
90+
./run.bat
91+
displayName: Prepare OneFuzz deployment
8892
89-
# OneFuzz can't currently handle a single deployment where multiple jobs
90-
# share similar assemblies/pdbs. As a workaround, we emit a task for every
91-
# fuzzing target individually.
92-
# https://fuzzfest.visualstudio.com/Onefuzz/_workitems/edit/191504/
93-
#
94-
# When the above issue is fixed, replace these individual tasks with:
95-
# - task: onefuzz-task@0
96-
# inputs:
97-
# onefuzzOSes: 'Windows'
98-
# env:
99-
# onefuzzDropDirectory: $(fuzzerProject)/deployment
100-
# SYSTEM_ACCESSTOKEN: $(System.AccessToken)
101-
# displayName: Send all fuzzers to OneFuzz
93+
# OneFuzz can't currently handle a single deployment where multiple jobs
94+
# share similar assemblies/pdbs. As a workaround, we emit a task for every
95+
# fuzzing target individually.
96+
# https://fuzzfest.visualstudio.com/Onefuzz/_workitems/edit/191504/
97+
#
98+
# When the above issue is fixed, replace these individual tasks with:
99+
# - task: onefuzz-task@0
100+
# inputs:
101+
# onefuzzOSes: 'Windows'
102+
# env:
103+
# onefuzzDropDirectory: $(fuzzerProject)/deployment
104+
# SYSTEM_ACCESSTOKEN: $(System.AccessToken)
105+
# displayName: Send all fuzzers to OneFuzz
102106

103107
# ONEFUZZ_TASK_WORKAROUND_START
104-
- task: onefuzz-task@0
105-
inputs:
106-
onefuzzOSes: 'Windows'
107-
env:
108-
onefuzzDropDirectory: $(fuzzerProject)/deployment/MultipartReaderFuzzer
109-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
110-
displayName: Send MultipartReaderFuzzer to OneFuzz
108+
- task: onefuzz-task@0
109+
inputs:
110+
onefuzzOSes: 'Windows'
111+
env:
112+
onefuzzDropDirectory: $(fuzzerProject)/deployment/MultipartReaderFuzzer
113+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
114+
displayName: Send MultipartReaderFuzzer to OneFuzz
111115
# ONEFUZZ_TASK_WORKAROUND_END

src/Fuzzing/AspNetCoreFuzzing/Program.cs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -260,10 +260,6 @@ private static void InstrumentAssemblies(IFuzzer fuzzer, string fuzzerDirectory)
260260
startInfo.EnvironmentVariables.Add("SHARPFUZZ_INSTRUMENT_MIXED_MODE_ASSEMBLIES", "1");
261261
}
262262

263-
// The sharpfuzz global tool may target a different runtime version than the repo's local SDK.
264-
// Clear DOTNET_ROOT so it can find system-installed runtimes instead of only the repo's local SDK.
265-
startInfo.EnvironmentVariables.Remove("DOTNET_ROOT");
266-
startInfo.EnvironmentVariables.Remove("DOTNET_MSBUILD_SDK_RESOLVER_CLI_DIR");
267263
startInfo.EnvironmentVariables["DOTNET_MULTILEVEL_LOOKUP"] = "1";
268264

269265
var processOutput = Process.RunAndCaptureText(startInfo);
@@ -341,11 +337,11 @@ private static string GenerateOneFuzzConfigJson(IFuzzer fuzzer)
341337
".\\*"
342338
],
343339
"AdoTemplate": {
344-
"Org": "devdiv",
345-
"Project": "DevDiv",
340+
"Org": "dnceng",
341+
"Project": "internal",
346342
"AssignedTo": "brecon@microsoft.com",
347-
"AreaPath": "DevDiv\\ASP.NET Core",
348-
"IterationPath": "DevDiv",
343+
"AreaPath": "internal\\ASP.NET Core",
344+
"IterationPath": "internal",
349345
"AdoFields": {
350346
"System.Title": "[{{ job.project }} {{ job.name }}]: {{ report.crash_site }}",
351347
"Custom.CustomField01": "{{ job.name }}-{{ report.minimized_stack_function_lines_sha256 }}"
@@ -408,13 +404,13 @@ private static void WorkaroundOneFuzzTaskNotAcceptingMultipleJobs(IFuzzer[] fuzz
408404
{
409405
return
410406
$$"""
411-
- task: onefuzz-task@0
412-
inputs:
413-
onefuzzOSes: 'Windows'
414-
env:
415-
onefuzzDropDirectory: $(fuzzerProject)/deployment/{{fuzzer.Name}}
416-
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
417-
displayName: Send {{fuzzer.Name}} to OneFuzz
407+
- task: onefuzz-task@0
408+
inputs:
409+
onefuzzOSes: 'Windows'
410+
env:
411+
onefuzzDropDirectory: $(fuzzerProject)/deployment/{{fuzzer.Name}}
412+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
413+
displayName: Send {{fuzzer.Name}} to OneFuzz
418414
""";
419415
}));
420416

0 commit comments

Comments
 (0)