Skip to content

Commit fa944f2

Browse files
Merge pull request #260 from microsoft/main
Fork Sync: Update from parent repository
2 parents a29918c + b8f0327 commit fa944f2

File tree

7 files changed

+35
-41
lines changed

7 files changed

+35
-41
lines changed

src/agent/onefuzz-task/src/tasks/report/dotnet/generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl AsanProcessor {
208208
input_blob,
209209
executable,
210210
crash_type: exception.exception,
211-
crash_site: exception.call_stack[0].clone(),
211+
crash_site: exception.call_stack.first().cloned().unwrap_or_default(),
212212
call_stack: exception.call_stack,
213213
call_stack_sha256,
214214
minimized_stack: None,

src/agent/onefuzz/src/input_tester.rs

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ use nix::sys::signal::{kill, Signal};
1616
use stacktrace_parser::CrashLog;
1717
#[cfg(any(target_os = "linux", target_family = "windows"))]
1818
use stacktrace_parser::StackEntry;
19+
use std::ffi::OsStr;
1920
#[cfg(target_os = "linux")]
2021
use std::process::Stdio;
2122
use std::{collections::HashMap, path::Path, time::Duration};
2223
use tempfile::tempdir;
2324

2425
const DEFAULT_TIMEOUT: Duration = Duration::from_secs(5);
25-
#[cfg(any(target_os = "linux", target_family = "windows"))]
26-
const CRASH_SITE_UNAVAILABLE: &str = "<crash site unavailable>";
2726

2827
pub struct Tester<'a> {
2928
setup_dir: &'a Path,
@@ -140,14 +139,14 @@ impl<'a> Tester<'a> {
140139
#[cfg(target_family = "windows")]
141140
async fn test_input_debugger(
142141
&self,
143-
argv: Vec<String>,
144-
env: HashMap<String, String>,
142+
argv: &[impl AsRef<OsStr>],
143+
env: &HashMap<String, String>,
145144
) -> Result<Option<CrashLog>> {
146145
const IGNORE_FIRST_CHANCE_EXCEPTIONS: bool = true;
147146
let report = input_tester::crash_detector::test_process(
148147
self.exe_path,
149-
&argv,
150-
&env,
148+
argv,
149+
env,
151150
self.timeout,
152151
IGNORE_FIRST_CHANCE_EXCEPTIONS,
153152
)?;
@@ -182,18 +181,11 @@ impl<'a> Tester<'a> {
182181
})
183182
.collect();
184183

185-
let crash_site = if let Some(frame) = call_stack.get(0) {
186-
frame.line.to_owned()
187-
} else {
188-
CRASH_SITE_UNAVAILABLE.to_owned()
189-
};
190-
191184
let fault_type = exception.description.to_string();
192185
let sanitizer = fault_type.to_string();
193-
let summary = crash_site;
194186

195187
Some(CrashLog::new(
196-
None, summary, sanitizer, fault_type, None, None, call_stack,
188+
None, None, sanitizer, fault_type, None, None, call_stack,
197189
)?)
198190
} else {
199191
None
@@ -205,12 +197,12 @@ impl<'a> Tester<'a> {
205197
#[cfg(target_os = "linux")]
206198
async fn test_input_debugger(
207199
&self,
208-
args: Vec<String>,
209-
env: HashMap<String, String>,
200+
args: &[impl AsRef<OsStr>],
201+
env: &HashMap<String, String>,
210202
) -> Result<Option<CrashLog>> {
211203
let mut cmd = std::process::Command::new(self.exe_path);
212204
cmd.args(args).stdin(Stdio::null());
213-
cmd.envs(&env);
205+
cmd.envs(env);
214206

215207
let (sender, receiver) = std::sync::mpsc::channel();
216208

@@ -265,19 +257,11 @@ impl<'a> Tester<'a> {
265257
.collect();
266258

267259
let crash_type = crash.signal.to_string();
268-
269-
let crash_site = if let Some(frame) = crash_thread.callstack.get(0) {
270-
frame.to_string()
271-
} else {
272-
CRASH_SITE_UNAVAILABLE.to_owned()
273-
};
274-
275-
let summary = crash_site;
276260
let sanitizer = crash_type.clone();
277261
let fault_type = crash_type;
278262

279263
Some(CrashLog::new(
280-
None, summary, sanitizer, fault_type, None, None, call_stack,
264+
None, None, sanitizer, fault_type, None, None, call_stack,
281265
)?)
282266
} else {
283267
None
@@ -301,9 +285,7 @@ impl<'a> Tester<'a> {
301285
.target_exe(self.exe_path)
302286
.target_options(self.arguments)
303287
.setup_dir(self.setup_dir)
304-
.set_optional(self.extra_dir.as_ref(), |expand, extra_dir| {
305-
expand.extra_dir(extra_dir)
306-
});
288+
.set_optional(self.extra_dir, Expand::extra_dir);
307289

308290
let argv = expand.evaluate(self.arguments)?;
309291
let mut env: HashMap<String, String> = HashMap::new();
@@ -317,6 +299,7 @@ impl<'a> Tester<'a> {
317299
Some(v) => update_path(v.clone().into(), setup_dir)?,
318300
None => get_path_with_directory(PATH, setup_dir)?,
319301
};
302+
320303
env.insert(PATH.to_string(), new_path.to_string_lossy().to_string());
321304
}
322305
if self.add_setup_to_ld_library_path {
@@ -343,7 +326,7 @@ impl<'a> Tester<'a> {
343326
let attempts = 1 + self.check_retry_count;
344327
for _ in 0..attempts {
345328
let result = if self.check_debugger {
346-
match self.test_input_debugger(argv.clone(), env.clone()).await {
329+
match self.test_input_debugger(&argv, &env).await {
347330
Ok(crash) => (crash, None, None),
348331
Err(error) => (None, Some(error), None),
349332
}

src/agent/stacktrace-parser/src/lib.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ fn filter_funcs(entry: &StackEntry, stack_filter: &RegexSet) -> Option<StackEntr
155155
impl CrashLog {
156156
pub fn new(
157157
text: Option<String>,
158-
summary: String,
158+
summary: Option<String>,
159159
sanitizer: String,
160160
fault_type: String,
161161
scariness_score: Option<u32>,
@@ -197,6 +197,15 @@ impl CrashLog {
197197
let minimized_stack_function_names = stack_names(&minimized_stack_details);
198198
let minimized_stack_function_lines = stack_function_lines(&minimized_stack_details);
199199

200+
// if summary was not supplied,
201+
// use first line of minimized stack
202+
// or else first line of stack,
203+
// or else nothing
204+
let summary = summary
205+
.or_else(|| minimized_stack.first().cloned())
206+
.or_else(|| call_stack.first().cloned())
207+
.unwrap_or_else(|| "<crash site unavailable>".to_string());
208+
200209
Ok(Self {
201210
text,
202211
sanitizer,
@@ -220,7 +229,7 @@ impl CrashLog {
220229
let (scariness_score, scariness_description) = parse_scariness(&text);
221230
Self::new(
222231
Some(text),
223-
summary,
232+
Some(summary),
224233
sanitizer,
225234
fault_type,
226235
scariness_score,
@@ -325,6 +334,8 @@ mod tests {
325334
if skip_files.contains(&file_name) {
326335
eprintln!("skipping file: {file_name}");
327336
continue;
337+
} else {
338+
eprintln!("parsing file: {file_name}");
328339
}
329340

330341
let data_raw =

src/cli/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ asciimatics~=1.13.0
77
pydantic~=1.8.1 --no-binary=pydantic
88
memoization~=0.4.0
99
msrestazure==0.6.4
10-
azure-storage-blob~=12.8
10+
azure-storage-blob==12.14.1
1111
azure-applicationinsights==0.1.0
1212
tenacity==8.0.1
1313
docstring_parser==0.8.1
1414
azure-identity==1.10.0
15-
azure-cli-core==2.46.0
15+
azure-cli-core==2.47.0
1616
PyJWT>=2.4.0
1717
# install rsa version >=4.7 to fix CVE-2020-25658
1818
rsa>=4.7

src/deployment/requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
azure-cli-core==2.46.0
2-
azure-cli==2.46.0
1+
azure-cli-core==2.47.0
2+
azure-cli==2.47.0
33
azure-identity==1.10.0
44
azure-cosmosdb-table==1.0.6
55
azure-mgmt-eventgrid==10.2.0b2
6-
azure-mgmt-resource==21.1.0b1
6+
azure-mgmt-resource==22.0.0
77
azure-mgmt-storage==21.0.0
8-
azure-storage-blob==12.13.1
8+
azure-storage-blob==12.14.1
99
pyfunctional==1.4.3
1010
pyopenssl==22.0.0
1111
adal~=1.2.7
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
azure-mgmt-storage~=19.0.0
2-
azure-cli-core==2.46.0
2+
azure-cli-core==2.47.0
33
azure-mgmt-eventgrid==3.0.0rc9
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
azure-common~=1.1.25
22
azure-identity==1.10.0
33
PyGithub==1.56
4-
azure-cli-core==2.46.0
4+
azure-cli-core==2.47.0
55
msgraph-core==0.2.2

0 commit comments

Comments
 (0)