From 26f63698697140fa0d12df5c9d0715b26a42f7cd Mon Sep 17 00:00:00 2001 From: Albert Hui Date: Tue, 4 Aug 2026 01:48:25 -0700 Subject: [PATCH] refactor(mem): use memf-core's RangedPhysMem instead of a local copy memf-core 0.2.4 exports `RangedPhysMem`, so the wrapper this crate grew for the netstat seam tests is redundant -- 23 lines, identical in shape to the one memf-windows carried privately until the same release deleted it. The wrapper exists because `SyntheticPhysMem` advertises no ranges and `PhysicalMemoryProvider::total_size` sums them, so it is zero and any physical scan traverses `(0, 0)`. Both netstat tests still pass against the exported type, including the one that needs a scan to actually run and find nothing. `cargo vet --locked` needed the publisher cache refreshed: the `[[trusted.memf-core]]` record was already present and correct, but imports.lock had no publisher entry for 0.2.4, and `--locked` forbids fetching one. Publishing a new version of one of our own crates reddens vet in every consumer until that cache is refreshed in the same commit as the bump. Full workspace: 212 suites, 0 failures; fmt, clippy and vet clean. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- crates/issen-mem/src/dispatch.rs | 31 ++++--------------------------- supply-chain/imports.lock | 4 ++-- 4 files changed, 9 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c87388d..cf62f9f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6597,9 +6597,9 @@ checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" [[package]] name = "memf-core" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0436ef3d5853012a75454f7c7e97315125d37e936d3d45adf590ca86941f4756" +checksum = "02d30d44a05a224e3f4a1a8c45ce99470eb24f58fa68396a3bb7c16694cdeba3" dependencies = [ "bytemuck", "lru 0.16.4", diff --git a/Cargo.toml b/Cargo.toml index ba3d9b9..b7ab31c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,7 +172,7 @@ winevt-analysis = "0.3" winevt-carver = "0.1" # Memory forensic crates (path dependencies into sibling workspace) -memf-core = "0.2.3" +memf-core = "0.2.4" memf-format = "0.3" memf-symbols = "0.2.3" memf-linux = "0.3.1" diff --git a/crates/issen-mem/src/dispatch.rs b/crates/issen-mem/src/dispatch.rs index 365d164..73534e7 100644 --- a/crates/issen-mem/src/dispatch.rs +++ b/crates/issen-mem/src/dispatch.rs @@ -1905,29 +1905,6 @@ mod tests { let _ = dispatch_windows_modules(&reader); } - /// `SyntheticPhysMem` reports no physical ranges, and the trait derives - /// `total_size()` by summing them — so it is zero, and any physical scan - /// traverses `(0, 0)` and sees nothing. A provider that advertises its extent - /// is therefore required to exercise a scan path at all. memf-windows carries - /// an identical private wrapper for its own tests; memf-core exporting one - /// would let both drop it. - struct RangedMem { - inner: memf_core::test_builders::SyntheticPhysMem, - ranges: Vec, - } - - impl memf_format::PhysicalMemoryProvider for RangedMem { - fn read_phys(&self, addr: u64, buf: &mut [u8]) -> memf_format::Result { - self.inner.read_phys(addr, buf) - } - fn ranges(&self) -> &[memf_format::PhysicalRange] { - &self.ranges - } - fn format_name(&self) -> &str { - "Synthetic(ranged)" - } - } - /// A reader whose build number *is* resolvable, with no TCP endpoints in it. /// /// `memf_windows::network::nt_build_number` falls back to scanning raw memory @@ -1947,13 +1924,13 @@ mod tests { let (cr3, mem) = PageTableBuilder::new() .write_phys(0x0004_0000, &page) .build(); - let ranged = RangedMem { - inner: mem, - ranges: vec![memf_format::PhysicalRange { + let ranged = memf_core::test_builders::RangedPhysMem::with_ranges( + mem, + vec![memf_format::PhysicalRange { start: 0, end: 1024 * 1024, }], - }; + ); let provider: Box = Box::new(ranged); let vas = VirtualAddressSpace::new(provider, cr3, TranslationMode::X86_64FourLevel); diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index ad0468e..6bb6045 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -133,8 +133,8 @@ user-login = "h4x0r" user-name = "Albert Hui" [[publisher.memf-core]] -version = "0.2.3" -when = "2026-07-23" +version = "0.2.4" +when = "2026-08-04" user-id = 347968 user-login = "h4x0r" user-name = "Albert Hui"