Repository navigation
workloads/lnd: map coverage counters directly onto AFL's map - #261
Merged
Merged
Conversation
Member
Author
morehouse
reviewed
Sep 25, 2026
Remap Go's libfuzzer counter section onto the AFL shared memory instead of copying it on every sync. Startup coverage no longer pollutes every map, and crashing or timed-out inputs now report coverage. The trigger/ack pipes stay as a liveness handshake: try_wait still sees a just-crashed LND as running.
try_wait only sees a crashed multithreaded process once it is reapable, after the kernel has closed its sockets, so a scenario can see the connection drop while the target still looks alive. Also check PF_EXITING, which the kernel sets before closing any file. Teardown keeps waiting for the reap through has_exited().
Replaces the trigger/ack pipe handshake. The handler reports Go fatal errors before LND's sockets close, and reports now carry the Go traceback. ALLOW_HANDLER_OVERRIDE lets Go keep its own signal handlers, which it needs to recover nil dereferences.
erickcestari
force-pushed
the
lnd-direct-coverage-map
branch
from
September 27, 2026 00:59
6425c83 to
b31007d
Compare
morehouse
approved these changes
Sep 28, 2026
Collaborator
There was a problem hiding this comment.
This is great!
I tested both crash detection and coverage feedback as follows:
- Patched LND to crash when decoding a message that begins with "SMTE", with a separate branch for each letter.
- Fuzzed
encrypted_bytesfor ~1 hour, after which the crash was reported
The crash log:
caught signal: 6
panic: smite: injected crash
goroutine ... [running]:
panic(...)
/usr/local/go/src/runtime/panic.go:879
github.com/lightningnetwork/lnd/peer.(*Brontide).readNextMessage.func1(...)
/lnd/peer/brontide.go:1940 github.com/lightningnetwork/lnd/peer.(*Brontide).readNextMessage.(*Read).Submit.func2(...)
...
The lineage of the crashing input:
| Queue entry | Found at | Starts with |
|---|---|---|
id:000000 |
seed | AAAA |
id:000004 |
exec 94 | SAAA |
id:000559 |
9 min | SMMM |
id:000961 |
60 min | SMTM |
| crash | 60.1 min | SMTE |
Each input in the lineage adds a single letter and triggers a new branch, so it appears the coverage feedback is working correctly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Remap Go's libfuzzer counter section onto the AFL shared memory instead of copying it on every sync. Startup coverage no longer pollutes every map, and crashing or timed-out inputs now report coverage.
The trigger/ack pipes stay as a liveness handshake: try_wait still sees a just-crashed LND as running.
I didn't yet run an evaluation to see the coverage increasing, but this should align the coverage report with the others implementation. Where the startup coverage don't pollute every map, since each input will be started from a zeroed map.