Skip to content

Build a MemorySanitizer binary alongside the ASan one - #208

Open
benjub wants to merge 1 commit into
metamath:masterfrom
benjub:fuzz-msan
Open

benjub wants to merge 1 commit into
metamath:masterfrom
benjub:fuzz-msan

Conversation

@benjub

@benjub benjub commented Sep 27, 2026

Copy link
Copy Markdown
Collaborator

build-sanitizer.sh now also builds fuzz/metamath-msan with MemorySanitizer, which reports reads of uninitialized memory that AddressSanitizer cannot see. It needs clang on Linux or a BSD. run-cases.sh runs the cases against both binaries.

It found a bug: parseProof() copies an uninitialized proofString element on tests/explicit.mm. Added as the case open-msan-parseproof-uninit.

run-cases.sh and fuzz.py now recognize MemorySanitizer reports, which exit with status 1 like an ordinary error. fuzz.py also accepts a relative --binary, as in the README's example.

The FIXED? note for open-assignvar-undeclared-var predates this PR: that case stopped reproducing with #198.

Written with help from Claude code.

build-sanitizer.sh also builds ./metamath-msan with MemorySanitizer, which
reports reads of uninitialized memory.  run-cases.sh runs the cases
against it too; an open case is checked only against the binary whose
sanitizer found it.

MemorySanitizer finds a bug that AddressSanitizer misses:
parseProof() copies an uninitialized proofString element.  It is added as
the case open-msan-parseproof-uninit.

run-cases.sh and fuzz.py now recognize MemorySanitizer reports: this build
exits with status 1, as metamath does on an ordinary error, so the status
alone does not show them.  Also fix a bug where fuzz.py could not run a
binary given by a relative path, as in the README's own example, because
each run happens in a temporary directory.
@benjub

benjub commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@david-a-wheeler can you have a look at this ? It builds on your fuzzing suite, so I think you're the right person to review.

Also, PR #209 builds on it (and I have another local branch that builds on #209), so it would be helpful to be able to merge both.

@david-a-wheeler

Copy link
Copy Markdown
Member

Hi, I'm not dead but I'm on travel. I won't be able to sit down and review seriously for a bit longer, but I will do so. Thanks so much for your work!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants