mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 20:58:06 +00:00
Add salvo telemetry (#619)
Adds telemetry fields for Salvo. This PR should not be merged until approved by CELA. Note: This PR includes #586
This commit is contained in:
@ -1,10 +1,14 @@
|
||||
// Copyright (c) Microsoft Corporation.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
use iced_x86::{Code as IntelInstructionCode, Mnemonic as IntelInstructionMnemonic};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use std::sync::{LockResult, RwLockReadGuard, RwLockWriteGuard};
|
||||
use uuid::Uuid;
|
||||
#[cfg(feature = "z3")]
|
||||
use z3_sys::ErrorCode as Z3ErrorCode;
|
||||
|
||||
pub use appinsights::telemetry::SeverityLevel::{Critical, Error, Information, Verbose, Warning};
|
||||
|
||||
@ -31,6 +35,25 @@ impl InstanceTelemetryKey {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "z3")]
|
||||
pub fn z3_error_as_str(code: &Z3ErrorCode) -> &'static str {
|
||||
match code {
|
||||
Z3ErrorCode::OK => "OK",
|
||||
Z3ErrorCode::SortError => "SortError",
|
||||
Z3ErrorCode::IOB => "IOB",
|
||||
Z3ErrorCode::InvalidArg => "InvalidArg",
|
||||
Z3ErrorCode::ParserError => "ParserError",
|
||||
Z3ErrorCode::NoParser => "NoParser",
|
||||
Z3ErrorCode::InvalidPattern => "InvalidPattern",
|
||||
Z3ErrorCode::MemoutFail => "MemoutFail",
|
||||
Z3ErrorCode::FileAccessError => "FileAccessError",
|
||||
Z3ErrorCode::InternalFatal => "InternalFatal",
|
||||
Z3ErrorCode::InvalidUsage => "InvalidUsage",
|
||||
Z3ErrorCode::DecRefError => "DecRefError",
|
||||
Z3ErrorCode::Exception => "Exception",
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for InstanceTelemetryKey {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
@ -124,6 +147,37 @@ pub enum EventData {
|
||||
ToolName(String),
|
||||
Region(String),
|
||||
Role(Role),
|
||||
InputsFuzzed(u64),
|
||||
SatConstraints(u64),
|
||||
UnsatConstraints(u64),
|
||||
AverageVarsPerConstraint(u64),
|
||||
MaxConstraintVars(u64),
|
||||
AverageSymexTime(f64),
|
||||
MaxSymexTime(u64),
|
||||
AverageSolvingTime(f64),
|
||||
MaxSolvingTime(u64),
|
||||
UniqueCodeLocationCount(u64),
|
||||
AverageInstructionsExecuted(f64),
|
||||
MaxInstructionsExecuted(u64),
|
||||
AverageTaintedInstructions(f64),
|
||||
MaxTaintedInstructions(u64),
|
||||
AverageMemoryTaintedInstructions(f64),
|
||||
MaxMemoryTaintedInstructions(u64),
|
||||
AveragePathLength(f64),
|
||||
MaxPathLength(u64),
|
||||
DivergenceRate(f64),
|
||||
DivergencePathLength(u32),
|
||||
DivergencePathExpectedIndex(u32),
|
||||
DivergencePathActualIndex(u32),
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
MissedInstructionCode(IntelInstructionCode),
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
MissedInstructionMnemonic(IntelInstructionMnemonic),
|
||||
#[cfg(feature = "z3")]
|
||||
Z3ErrorCode(Z3ErrorCode),
|
||||
#[cfg(feature = "z3")]
|
||||
Z3ErrorString(String),
|
||||
SymexTimeout(u64),
|
||||
}
|
||||
|
||||
impl EventData {
|
||||
@ -161,6 +215,47 @@ impl EventData {
|
||||
Self::ToolName(x) => ("tool_name", x.to_owned()),
|
||||
Self::Region(x) => ("region", x.to_owned()),
|
||||
Self::Role(x) => ("role", x.as_str().to_owned()),
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
Self::MissedInstructionCode(x) => ("missed_instruction_code", format!("{:?}", x)),
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
Self::MissedInstructionMnemonic(x) => {
|
||||
("missed_instruction_mnemonic", format!("{:?}", x))
|
||||
}
|
||||
Self::InputsFuzzed(x) => ("inputs_fuzzed", x.to_string()),
|
||||
Self::SatConstraints(x) => ("sat_constraints", x.to_string()),
|
||||
Self::UnsatConstraints(x) => ("unsat_constraints", x.to_string()),
|
||||
Self::AverageVarsPerConstraint(x) => ("average_vars_per_constraint", x.to_string()),
|
||||
Self::MaxConstraintVars(x) => ("max_constraint_vars", x.to_string()),
|
||||
Self::AverageSymexTime(x) => ("average_symex_time", x.to_string()),
|
||||
Self::MaxSymexTime(x) => ("max_symex_time", x.to_string()),
|
||||
Self::AverageSolvingTime(x) => ("average_solving_time", x.to_string()),
|
||||
Self::MaxSolvingTime(x) => ("max_solving_time", x.to_string()),
|
||||
Self::UniqueCodeLocationCount(x) => ("unique_code_locations_count", x.to_string()),
|
||||
Self::AverageInstructionsExecuted(x) => {
|
||||
("average_instructions_executed", x.to_string())
|
||||
}
|
||||
Self::MaxInstructionsExecuted(x) => ("max_instructions_executed", x.to_string()),
|
||||
Self::AverageTaintedInstructions(x) => ("average_tainted_instructions", x.to_string()),
|
||||
Self::MaxTaintedInstructions(x) => ("max_tainted_instructions", x.to_string()),
|
||||
Self::AverageMemoryTaintedInstructions(x) => {
|
||||
("average_memory_tainted_instructions", x.to_string())
|
||||
}
|
||||
Self::MaxMemoryTaintedInstructions(x) => {
|
||||
("max_memory_tainted_instructions", x.to_string())
|
||||
}
|
||||
Self::AveragePathLength(x) => ("average_path_length", x.to_string()),
|
||||
Self::MaxPathLength(x) => ("max_path_length", x.to_string()),
|
||||
Self::DivergenceRate(x) => ("divergence_rate", x.to_string()),
|
||||
Self::DivergencePathLength(x) => ("divergence_path_length", x.to_string()),
|
||||
Self::DivergencePathExpectedIndex(x) => {
|
||||
("divergence_path_expected_index", x.to_string())
|
||||
}
|
||||
Self::DivergencePathActualIndex(x) => ("divergence_path_actual_index", x.to_string()),
|
||||
#[cfg(feature = "z3")]
|
||||
Self::Z3ErrorCode(x) => ("z3_error_code", z3_error_as_str(x).to_owned()),
|
||||
#[cfg(feature = "z3")]
|
||||
Self::Z3ErrorString(x) => ("z3_error_string", x.to_owned()),
|
||||
Self::SymexTimeout(x) => ("symex_timeout", x.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,6 +293,37 @@ impl EventData {
|
||||
Self::ToolName(_) => true,
|
||||
Self::Region(_) => false,
|
||||
Self::Role(_) => true,
|
||||
Self::InputsFuzzed(_) => true,
|
||||
Self::SatConstraints(_) => true,
|
||||
Self::UnsatConstraints(_) => true,
|
||||
Self::AverageVarsPerConstraint(_) => true,
|
||||
Self::MaxConstraintVars(_) => true,
|
||||
Self::AverageSymexTime(_) => true,
|
||||
Self::MaxSymexTime(_) => true,
|
||||
Self::AverageSolvingTime(_) => true,
|
||||
Self::MaxSolvingTime(_) => true,
|
||||
Self::UniqueCodeLocationCount(_) => true,
|
||||
Self::AverageInstructionsExecuted(_) => true,
|
||||
Self::MaxInstructionsExecuted(_) => true,
|
||||
Self::AverageTaintedInstructions(_) => true,
|
||||
Self::MaxTaintedInstructions(_) => true,
|
||||
Self::AverageMemoryTaintedInstructions(_) => true,
|
||||
Self::MaxMemoryTaintedInstructions(_) => true,
|
||||
Self::AveragePathLength(_) => true,
|
||||
Self::MaxPathLength(_) => true,
|
||||
Self::DivergenceRate(_) => true,
|
||||
Self::DivergencePathLength(_) => true,
|
||||
Self::DivergencePathExpectedIndex(_) => true,
|
||||
Self::DivergencePathActualIndex(_) => true,
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
Self::MissedInstructionCode(_) => true,
|
||||
#[cfg(feature = "intel_instructions")]
|
||||
Self::MissedInstructionMnemonic(_) => true,
|
||||
#[cfg(feature = "z3")]
|
||||
Self::Z3ErrorCode(_) => true,
|
||||
#[cfg(feature = "z3")]
|
||||
Self::Z3ErrorString(_) => false,
|
||||
Self::SymexTimeout(_) => true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user