Add Device.fix_execute_only_memory() to fix app crashes on execute-only-memory (XOM) ROMs - #156
Open
leeduin wants to merge 73 commits into
Open
Add Device.fix_execute_only_memory() to fix app crashes on execute-only-memory (XOM) ROMs#156leeduin wants to merge 73 commits into
leeduin wants to merge 73 commits into
Conversation
Added all-llms.txt containing complete FIRERPA documentation extracted from https://device-farm.com/doc/en/ including: - Complete installation guide (APK, Magisk, Manual methods) - 160+ API reference with code examples - Built-in Frida integration and anti-detection features - Persistent script injection and RPC capabilities - Binary patching and debugging tools - Network deployment (FRP, OpenVPN) - Packet capture and security features - Device discovery and distributed management - OCR and image matching operations - Interface monitoring and automation - All commands, parameters, and technical details This documentation is formatted for easy consumption by LLMs and AI assistants to help developers integrate FIRERPA automation capabilities. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Add comprehensive English documentation for LLMs
Some OEM ROMs (e.g. MIUI) map system libraries in zygote as
execute-only memory (--x, XOM). When the frida runtime embedded in
the server hooks the zygote fork path, reading target memory to
build trampolines fails with SEGV_ACCERR, so every application
spawned/injected afterwards crashes at startup (stuck on splash
screen, or process dies right after resume()).
This adds a client-side helper that attaches to zygote (64/32-bit)
via the embedded frida runtime and mprotect()s every --x range
backed by /system, /apex or /vendor back to r-x, so processes
forked from zygote inherit readable segments again.
Usage: call once after each device/server reboot, before spawning:
d = Device("192.168.22.0.x")
d.fix_execute_only_memory()
# -> {"zygote64": {"fixed": 294, "failed": 0}}
Co-Authored-By: Claude Code <noreply@anthropic.com>
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.
问题
在启用 execute-only memory (XOM) 的 ROM 上(如 MIUI),lamda server 内嵌的 frida 运行时 hook zygote fork 路径后,所有 spawn / 注入的目标 app 都会在启动时崩溃:
spawn()+resume()后进程数秒内死亡(SIGSEGV)根因
MIUI 等 ROM 将 zygote 内的系统库映射为
--x(只执行、禁读)段。frida gum 在 zygote fork 特化路径上构建 trampoline 时需要读取目标内存(如libmedia.so的.text),触发 SEGV_ACCERR:zygote 内段权限被 app 继承,因此每个 fork 出的进程都会崩,与具体 app 无关。
修复
新增
Device.fix_execute_only_memory():通过 server 内嵌的 frida 运行时 attachzygote/zygote64,将后备文件位于/system、/apex、/vendor的全部--x段mprotect()回r-x,fork 出的进程恢复可读,注入恢复正常。实测
--x系统库段恢复r-x,目标 app(含 Unity/cocos 混合引擎、带 native 反调试的 app)正常 spawn 存活到主界面也建议后续考虑在 server 端注入前自动执行该恢复逻辑(本 PR 先提供客户端工具方法,不改变 server 行为)。