Skip to content

v0.15.0

Compare
Choose a tag to compare
@pgaskin pgaskin released this 17 Mar 01:19
· 3 commits to master since this release
653070c

Kobopatch v0.15.0 significantly improves symbol and offset-related functions.

New instructions/fields:

  • FlexAbsOffset can be used in place of wherever an absolute offset is taken (ReplaceBytes.Base, ReplaceBytes.FindInstBLX, ReplaceBytes.ReplaceInstBLX, ReplaceBytes.FindInstBW, ReplaceBytes.ReplaceInstBW, ReplaceBytes.ReplaceInstNOP, BaseAddress), with the exception of deprecated instructions/fields which need to retain compatibility regarding symbol offsets (see #31).
    • It can be used shorthand with an integer (for the Offset field) or a string (for the Sym field).
    • It has an Offset field for absolute offsets.
    • It has a Sym field for dynamic symbols.
    • It has a SymPLT field for their PLT entries.
    • It has a SymPLTTail field for matching the corresponding tail call stub.
    • It has a Rel field for adding/subtracting from the resulting absolute offset. Note that in general, it is preferred to use the Offset field of a more specific instruction, unless using the Rel field greatly simplifies the readability or maintainability of a patch.
    • All symbols can be matched using mangled or demangled names.
  • ReplaceBytes now has new generators:
    • InstBLX can find/replace BLX instructions and takes a FlexAbsOffset.
    • InstBW can find/replace B.W instructions and takes a FlexAbsOffset.
    • The branch generators above have simple sanity checks built-in.
    • InstNOP replaces with NOPs.
  • ReplaceBytes now has new fields:
    • CheckOnly skips replacements and instead just ensures the Find is present. This is mainly useful for multi-version patches made using the new symbol stuff which also needs to do things like ensure an argument is as expected.
    • Base overrides the current offset for that single instruction and takes a FlexAbsOffset. The Offset field is added to the resolved Base.
  • BaseAddress now accepts a FlexAbsOffset.

Deprecations (these will still remain indefinitely for compatibility with
the old patches):

  • ReplaceBytesAtSymbol is now deprecated in favour of ReplaceBytes.Base.Sym.
  • FindBaseAddressSymbol is now deprecated in favour of BaseAddress.Sym.
  • ReplaceBytesNOP is now deprecated in favour of ReplaceBytes.ReplaceNOP.
  • ReplaceBLX is now deprecated in favour of ReplaceBytes.FindInstBLX and ReplaceBytes.ReplaceInstBLX.

Bugfixes/improvements:

  • The log for ReplaceBytes is now a lot more useful and easier to understand, especially when using generators.
  • Instruction names in certain error messages have been corrected.
  • The bug where all symbol offsets were off by one has been fixed in the new instructions (the old ones are being left as-is to maintain backwards-compatibility (see #31).

I've tested the results of an updated version of the patches against the original ones, and everything is perfectly identical.

There is also a new symdump tool (which can be used on libnickel or any other dynamic library) based on the new symbol code.


653070c all: Updated dependencies
f1494c5 patchfile/kobopatch: Implemented new symbol instructions (fixes #31) (closes #32)
599ac1c kobopatch: Increase string width for ApplyFiles
5b5b541 tools/symdump: Added new tool to dump symbol offsets from ELF executable
db826a1 patchlib: Made ExtractDynsyms on Patcher public
f41bb0d patchlib: Added new symbol helpers to Patcher (#31, #32)
2f4342d patchlib: Rewrote B.W and BLX assembler funcs (#32)
9933b59 patchlib: Added helpers for better dynamic symbol extraction including PLT/GOT offsets (#32)
60a4318 patchlib: Added helpers for assembling B and BX instructions (#32)
71fa145 patchlib: Added Hook function