Repository navigation
Sync with upstream MemorySlice/memslicer v0.5.2 - #19
Merged
Merged
Conversation
…d with LLDB and GDB backend support - still untested
…egions which are most likely relevant
…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.
# Conflicts: # CHANGELOG.md
…tream-0.5.2 # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs the fork with upstream
MemorySlice/memslicerv0.5.2 (13 commits behind, 61 ahead before this PR).How the merge was resolved
pr/fixes): GDB "set automatically" arch parsing + publish only on a real version bump.pr/thread-context): canonical register names, OS thread pointer, Windows TEB, LLDB vector registers.memslicer-emu,memslicer-symbex,memslicer-behavior) are kept and adapted to upstream's API (REG_ROLE_*,TC_FLAG_*,ThreadState.STOPPED,ThreadRegister(name, width, flags, value)).AnalysisFindings = 0x1B70is kept inBlockType(fork-only constant).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
pytestwith[dev,emu,graph]: 2868 passed, 23 skipped (1 macOS-only upstream test deselected: Homebrew framework Python path).ruff check src tests: clean.memslicer verifyVALID →memslicer-emu --steps 2runs.Merge note
The version goes 0.2.7 → 0.5.2, which would make
publish.ymltry to publish 0.5.2 (already on PyPI) andchangelog.ymlprepend a duplicate 0.5.2 entry. Merge with[skip ci]in the merge commit subject.