Skip to main content

Crate r2smt_patch

Crate r2smt_patch 

Source
Expand description

Safe binary patching for r2SMT.

Phase 10 closes the loop from solver verdict → committed binary change. Every applied patch is recorded in a PatchManifest and a full-file backup is taken before any byte is written, so the pipeline can roll back to a known-good state even if the host process is killed mid-flight.

The crate is sample-agnostic: it never inspects sample-specific values or branches on opcode signatures from a single family. Strategies are defined in terms of the abstract finding kinds produced by r2smt-core.

Re-exports§

pub use apply::ApplyConfig;
pub use apply::apply_plan;
pub use apply::rollback_from_manifest;
pub use arm_encoding::ARM_INSTRUCTION_BYTES;
pub use arm_encoding::arm_nop_buffer;
pub use arm_encoding::arm_nop_bytes;
pub use digest::sha256_hex;
pub use manifest::PatchManifest;
pub use manifest::PatchRecord;
pub use plan::PatchPlan;
pub use plan::PlanOperation;
pub use plan::build_plan;
pub use x86_encoding::nop_buffer;
pub use x86_encoding::patch_cmovcc_to_mov;
pub use x86_encoding::patch_setcc;

Modules§

aarch64_encoding
Operand-aware helpers for the AArch64 cset / csel / csinc / csinv / csneg family.
apply
Apply a PatchPlan through a BytePatcher and produce the durable PatchManifest.
arm_encoding
Byte-level rewrites for ARM conditional branches.
digest
SHA-256 wrapper used by crate::manifest to record before / after integrity hashes of the binary being patched.
manifest
Patch manifest: the durable record of every byte r2SMT has changed.
plan
Build a PatchPlan from r2SMT findings.
x86_encoding
Byte-level rewrites for setcc / cmovcc on x86 / x86_64.