fix(scanner): keep the AOB scanner and SEH probe ASan-clean#103
Conversation
The scanner walks every committed readable region (its own stack and instrumented globals included) and seh_read_bytes copies from a caller-supplied address. Under MSVC AddressSanitizer those in-bounds, never-faulting reads land on memory ASan has poisoned for its own bookkeeping and are reported as false-positive overflows; the scenario cannot occur in production, where the target process is not ASan-built. Exclude only the deliberate foreign-memory readers, entirely under #if defined(__SANITIZE_ADDRESS__), so release and non-ASan builds are byte-for-byte unchanged. See docs/misc/asan-memory-scanner.md.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds AddressSanitizer (ASan) false-positive mitigation for the AOB memory scanner and SEH-guarded memory readers. The implementation uses preprocessor guards, compiler attributes, and platform-specific intrinsics to bypass ASan instrumentation in code paths that deliberately read foreign process memory. ChangesAddressSanitizer Mitigation for Foreign-Memory Reads
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
The AOB scanner (scan_readable_regions) and the SEH-guarded probe read deliberately read arbitrary mapped process memory. Under MSVC AddressSanitizer those in-bounds, never-faulting reads land on memory ASan has poisoned for its own bookkeeping and are reported as false-positive overflows. The scenario cannot occur in production, where the scanner targets a separate, non-instrumented process.
This excludes only the deliberate foreign-memory readers from ASan, entirely under
#if defined(__SANITIZE_ADDRESS__), so release and non-ASan builds are byte-for-byte unchanged. The full suite passes under the msvc-debug-asan preset with the scanner exercised, and the MinGW path is unchanged.Rationale, rejected alternatives, and the pattern for new foreign-memory primitives are in docs/misc/asan-memory-scanner.md.
Summary by CodeRabbit
Documentation
Bug Fixes