Patch and verify
glaurung patch
Write a byte patch to a separate output file.
use it for
The command never patches in place. --verify disassembles the changed bytes; it does not prove that the new program is safe or correct.
Run glaurung patch --help on your installed version before putting the command in a script.
Glaurung is still pre-1.0.
- input
- An input binary, a different output path, a VA, and exactly one patch operation.
- output
- A copied binary with changed bytes. The source file is never patched in place.
- mode
- writes state. Creates or overwrites the output path. --force is required to overwrite.
command shape
syntax
$ glaurung patch INPUT OUTPUT --va VA {--bytes HEX|--nop|--jmp VA|--force-branch BOOL}
The installed parser is authoritative: glaurung patch --help
run it
examples
NOP one instruction
The fixture address 0x11e0 begins a five-byte instruction.
run
$ glaurung patch samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug /tmp/hello-patched --va 0x11e0 --nop --verify output
# Patch applied
- output: /tmp/hello-patched
- VA: 0x11e0 (file offset 0x11e0)
before: 3d350e0000
after: 9090909090
patched 5 bytes at VA 0x11e0
verify: nop captured tutorial fixture.
Read the result: Verify proves that the new bytes decode as requested. It does not prove that the program still behaves safely.
Write explicit bytes
Use a separate output name and add --force only when overwriting that copy is intentional.
run
$ glaurung patch samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug /tmp/hello-int3 --va 0x11e0 --bytes cc --verify --json output
{
"output_path":"/tmp/hello-int3",
"va":4576,
"file_offset":4576,
"original_hex":"3d",
"patched_hex":"cc",
"notes":["patched 1 bytes at VA 0x11e0 (file offset 0x11e0)"],
"verify":"verify: int3"
} captured fixture output, 2026-08-31.
Read the result: The VA and file offset happen to be equal in this fixture. Do not assume that relationship for another binary; let the format mapper resolve it.
used above
important options
These are the flags used by the examples. Run glaurung patch --help for the complete parser help.
before you rely on it
checks
keep working