Skip to content

Sync with upstream MemorySlice/memslicer v0.5.2 - #19

Merged
ricardojrdez merged 25 commits into
mainfrom
sync/upstream-0.5.2
Nov 20, 2026
Merged

ricardojrdez merged 25 commits into
mainfrom
sync/upstream-0.5.2

Conversation

@ricardojrdez

Copy link
Copy Markdown
Member

Syncs the fork with upstream MemorySlice/memslicer v0.5.2 (13 commits behind, 61 ahead before this PR).

How the merge was resolved

On-disk format

Checked by cross-reading slices written by each side: block layouts are identical. Upstream writes compressed payloads unpadded (spec Table 9) and fills EoC BlockCount; both readers accept both variants.

Verification

  • pytest with [dev,emu,graph]: 2868 passed, 23 skipped (1 macOS-only upstream test deselected: Homebrew framework Python path).
  • With angr 9.2.223: 2884 passed, 17 skipped.
  • ruff check src tests: clean.
  • Smoke: slice written by the upstream writer (LZ4) → memslicer verify VALID → memslicer-emu --steps 2 runs.

Merge note

The version goes 0.2.7 → 0.5.2, which would make publish.yml try to publish 0.5.2 (already on PyPI) and changelog.yml prepend a duplicate 0.5.2 entry. Merge with [skip ci] in the merge commit subject.

monkeywave and others added 25 commits August 16, 2026 13:24
…d with LLDB and GDB backend support - still untested
…xt blocks; changes regarding the new specification)
Spec 1.1.1 producer rule 42 forbids writing debugger aliases: ARM64
fp/lr/cpsr/tpidr, ARM32 r13-r15 and x86_64 eflags are now written as
x29/x30/pstate/tpidr_el0, sp/lr/pc and rflags. The rename happens once,
in the engine, so every bridge benefits; on a collision (a backend that
reports both an alias and the canonical name) the first entry wins.

Table 19g gives the TLS role only to the register the OS uses as thread
pointer. With the target OS known, the engine keeps REG_ROLE_TLS on that
register alone (fs_base on Linux x86_64, gs_base on Windows/macOS x64,
tpidr_el0 / tpidrro_el0 / x18 on ARM64, ...) instead of on every segment
base, and adds it to thread pointers the arch-level table does not know
(x18 on Windows ARM64, tpidrro_el0 on Apple).
A Frida CpuContext carries no segment base, so Windows captures had no
thread pointer and consumers could not resolve TEB/PEB or TLS accesses
(fs:[0x30], gs:[0x60]). On Windows x86/x64 the agent now reads each
thread's TEB with OpenThread + NtQueryInformationThread
(ThreadBasicInformation) and reports it as gs_base (x64) / fs_base
(ia32), unless the context already carries that register.
Spec Table 19b stores vector registers in a Thread Context block (Width
16/32/64, value in the target's lane order), but the LLDB bridge skipped
every register wider than 8 bytes. Registers wider than a GPR are now
read as raw bytes from their SBData; one that cannot be read marks the
thread Partial, and only registers wider than the u8 Width field (e.g.
2048-bit SVE z registers) are left out.
parse_gdb_architecture only matched the quoted phrasing
('set to "auto" (currently "i386")'). Newer/Windows GDB emits
'The target architecture is set automatically (currently i386)' (no quotes),
so 'show architecture' detection raised 'Cannot parse GDB architecture output'
and the gdb backend was unusable there. Accept both phrasings with optional
quotes; .search() already tolerates interleaved async MI records.
The version-change gate derived the previous version from the removed lines of
the pyproject.toml diff. When pyproject changed without touching the version
line, that left PREV_VERSION empty and "" != "0.2.7" wrongly reported a bump,
so a publish was attempted on every such push to main (and failed at the PyPI
OIDC step). Read the version from the full file at HEAD and HEAD~1 instead, and
require both values present and different before publishing.
Shared acquirer, MSL and CLI code (and their tests) are taken from upstream, which now implements Thread Context capture and the spec 1.1.1 format itself; this fork's earlier implementations are dropped. Fork-only tools (emu, symbex, behavior) are kept.
@ricardojrdez
ricardojrdez merged commit 63a5d2a into main Nov 20, 2026
7 checks passed
@ricardojrdez
ricardojrdez deleted the sync/upstream-0.5.2 branch November 20, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants