Skip to content

Commit c3bd7f5

Browse files
committed
Use rustls to avoid openssl dependency
1 parent a3a71ec commit c3bd7f5

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Cargo.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ windows = { version = "0.57.0", features = [
8686
"Win32_System_SystemInformation",
8787
"Win32_System_Kernel",
8888
] }
89-
reqwest = { version = "0.12.5", features = ["blocking"] }
89+
reqwest = { version = "0.12.5", features = [
90+
"blocking",
91+
# NOTE: rustls is used because native-tls does not build with the
92+
# compatibility builder and we don't need any advanced features
93+
"rustls-tls",
94+
], default-features = false }
9095
pdb = "0.8.0"
9196
intervaltree = "0.2.7"
9297
lending-iterator = "0.1.7"
9398
rustc-demangle = "0.1.24"
94-
symbolic = { version = "12.9.2", features = ["demangle"] }
99+
cpp_demangle = "0.4.3"
95100

96101
[dev-dependencies]
97102
simics-test = "0.1.0"

src/os/windows/debug_info.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,7 @@ impl ProcessModule {
360360
if let Some(rva) = p.offset.to_rva(&address_map) {
361361
let info = SymbolInfo::new(
362362
rva.0 as u64,
363+
self.base,
363364
0,
364365
p.name.to_string().to_string(),
365366
self.full_name.clone(),
@@ -372,6 +373,7 @@ impl ProcessModule {
372373
if let Some(rva) = p.offset.to_rva(&address_map) {
373374
let info = SymbolInfo::new(
374375
rva.0 as u64,
376+
self.base,
375377
p.len as u64,
376378
p.name.to_string().to_string(),
377379
self.full_name.clone(),
@@ -422,15 +424,17 @@ pub struct Process {
422424
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
423425
pub struct SymbolInfo {
424426
pub rva: u64,
427+
pub base: u64,
425428
pub size: u64,
426429
pub name: String,
427430
pub module: String,
428431
}
429432

430433
impl SymbolInfo {
431-
pub fn new(rva: u64, size: u64, name: String, module: String) -> Self {
434+
pub fn new(rva: u64, base: u64, size: u64, name: String, module: String) -> Self {
432435
Self {
433436
rva,
437+
base,
434438
size,
435439
name,
436440
module,
@@ -470,6 +474,7 @@ impl Module {
470474
if let Some(rva) = p.offset.to_rva(&address_map) {
471475
let info = SymbolInfo::new(
472476
rva.0 as u64,
477+
self.base,
473478
1,
474479
p.name.to_string().to_string(),
475480
self.full_name.clone(),
@@ -482,6 +487,7 @@ impl Module {
482487
if let Some(rva) = p.offset.to_rva(&address_map) {
483488
let info = SymbolInfo::new(
484489
rva.0 as u64,
490+
self.base,
485491
p.len as u64,
486492
p.name.to_string().to_string(),
487493
self.full_name.clone(),

src/tracer/mod.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
use anyhow::{anyhow, bail, Error, Result};
5+
use cpp_demangle::{DemangleOptions, Symbol};
56
use ffi::ffi;
67
use libafl::prelude::CmpValues;
78
use libafl_bolts::{AsMutSlice, AsSlice};
89
use libafl_targets::{AFLppCmpLogOperands, AFL_CMP_TYPE_INS, CMPLOG_MAP_H};
10+
use rustc_demangle::try_demangle;
911
use serde::{Deserialize, Serialize};
1012
use simics::{
1113
api::{
@@ -18,7 +20,6 @@ use std::{
1820
collections::HashMap, ffi::c_void, fmt::Display, hash::Hash, num::Wrapping,
1921
slice::from_raw_parts, str::FromStr,
2022
};
21-
use symbolic::demangle::Demangle;
2223
use typed_builder::TypedBuilder;
2324

2425
use crate::{arch::ArchitectureOperations, Tsffs};
@@ -397,9 +398,15 @@ impl Tsffs {
397398
.get(&processor_number)
398399
.and_then(|lookup_tree| {
399400
lookup_tree.query(pc..pc + 1).next().map(|q| {
400-
let offset = pc - q.range.start;
401-
let symbol_demangled = symbolic::common::Name::from(&q.value.name)
402-
.demangle(symbolic::demangle::DemangleOptions::complete());
401+
let offset = pc - q.value.base + q.value.rva;
402+
let symbol_demangled = try_demangle(&q.value.name)
403+
.map(|d| d.to_string())
404+
.ok()
405+
.or_else(|| {
406+
Symbol::new(&q.value.name)
407+
.ok()
408+
.and_then(|s| s.demangle(&DemangleOptions::new()).ok())
409+
});
403410
ExecutionTraceSymbol {
404411
symbol: q.value.name.clone(),
405412
symbol_demangled,

0 commit comments

Comments
 (0)