smitebot: implement smitebot stop command#145
Open
Ashish-Kumar-Dash wants to merge 1 commit into
Open
Conversation
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.
Summary
Adds
smitebot stop <campaign-id>: tears down a running campaign and reaps all of its processes, including the Nyx QEMU children that a plaintmux kill-sessionleaks.The problem
In Nyx mode each
afl-fuzzrunner spawns a QEMU child, andtmux kill-sessiononly sends SIGHUP to theafl-fuzzpanes, the QEMU children orphan (reparented away from tmux) and keep running.How it works
Verified against the live process tree and AFL++ source:
afl-fuzzpane is its own process-group leader. Its QEMU child is in the same process group and keeps that group id even after it orphans. So one group-directed kill reaps the QEMU too.afl-fuzzlingers as a zombie under tmuxremain-on-exituntil the session is torn down, so the "did everything die?" check ignores zombie (Z) states.stop:state.jsonfor the campaign (errors name the path + how to list campaigns).tmux list-panes) — not fromstate.json, whose PIDs can be missing (slow startup) or stale/recycled (after a reboot), killing a recycled PID's group could hit an unrelated process.pkill -TERM -g <pgid>each group → waits (polling, non-zombie only) →pkill -KILL -g <pgid>any straggler.tmux kill-sessionto remove windows and reap the zombie leaders.status = "stopped"+stop_timeinstate.json.state.json changes
stopped; new fieldstop_time: Option<u64>(#[serde(default)], so pre-existing state files still load).Live end-to-end test I ran (2-runner lnd campaign):
Before — 2 afl-fuzz, their 2 QEMU, 1 session:
Stop, then re-check — zero survivors:
Ref. #70