`save_initial_snapshot` unconditionally hashes `debuginfo_source_directory`, and `save_symbolic_coverage` has an inverted `is_dir()` check

Open Beginner friendly
#511 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Both spots are in src/lib.rs: the SourceCache::new(&self.debuginfo_source_directory) call near lines 943-945 inside save_initial_snapshot, and the is_dir() check near lines 1188-1191 inside save_symbolic_coverage. Read both functions end to end first, then confirm where symbolic_coverage and symbolic_coverage_directory are set on self so the new guards are correct when coverage is enabled. Done means SourceCache::new only runs when symbolic coverage is on, and the directory is created only when it is missing; since the reporter could not run SIMICS, verify with cargo build/cargo test and note in the PR that runtime behaviour was not reproduced.

Written by the indexing model from the issue text.

Description

Where

Problem

  1. save_initial_snapshot calls SourceCache::new(&self.debuginfo_source_directory)? unconditionally on every run, even when self.symbolic_coverage is false. SourceCache::new walks the directory and hashes every file with MD5, SHA1, and SHA256, propagating any read error out of the stop HAP (which panics Simics).
  2. save_symbolic_coverage writes if self.symbolic_coverage_directory.is_dir() { create_dir_all(&self.symbolic_coverage_directory)?; } (missing !), making directory creation a no-op when the directory does not yet exist.

Impact
Non-symbolic fuzzing campaigns pay unnecessary startup I/O and abort Simics if debuginfo_source_directory contains an unreadable file. save_symbolic_coverage fails to create symbolic_coverage_directory itself when it does not exist.

Suggested fix
Gate SourceCache::new behind if self.symbolic_coverage, and negate line 1189 to if !self.symbolic_coverage_directory.is_dir().

Status
Found by reading the code at ed67e1c; not reproduced under SIMICS.

Dominant language
Rust
Stars
337
Forks
26
Avg merge
5h 33m
Merged PRs (30d)
30

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from intel/tsffs

All issues in intel/tsffs

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.