Patch and verify

glaurung patch

Write a byte patch to a separate output file.

writes files or project state 2 worked examples

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

short form
$ 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

from the engine checkout
$ glaurung patch samples/binaries/platforms/linux/amd64/export/native/clang/debug/hello-c-clang-debug /tmp/hello-patched --va 0x11e0 --nop --verify

output

captured result captured tutorial fixture
# 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

from the engine checkout
$ 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

captured result captured fixture output, 2026-08-31
{
  "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

--bytes HEX
Write the supplied byte sequence.
--nop
Replace one instruction with the same number of NOP bytes.
--jmp VA
Replace one instruction with a size-preserving jump.
--verify
Decode the patched bytes and print the resulting instruction.
--force
Allow overwrite of an existing output path.

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

related commands

← all 40 commands