8000 submodules: Pin frida-core to the modulate arch-detection fix · Issue #3811 · frida/frida · GitHub
[go: up one dir, main page]

Skip to content

submodules: Pin frida-core to the modulate arch-detection fix #3811

Open

Description

@neomafo88

modulate: Detect arch via lipo instead of file(1)
fix: the arm64 slice of frida-agent.dylib ships a corrupted __DATA,__mod_init_func and every injection into an arm64 target process crashes it.

diff --git a/tools/modulate.py b/tools/modulate.py
index 7c520f57..fbcab85f 100644
--- a/tools/modulate.py
+++ b/tools/modulate.py
@@ -319,9 +319,9 @@ class Layout(object):
             output = subprocess.check_output(toolchain.otool + ["-l", binary_path],
                                              env=env).decode('utf-8')
 
-            arch_name = subprocess.check_output(["file", binary_path],
-                                                env=env).decode('utf-8').rstrip().split(" ")[-1]
-            if arch_name.startswith("arm_"):
+            arch_name = subprocess.check_output(["lipo", "-archs", binary_path],
+                                                env=env).decode('utf-8').split()[0]
+            if arch_name.startswith("arm") and arch_name not in ("arm64", "arm64e"):
                 arch_name = 'arm'
             pointer_size = 8 if "64" in arch_name else 4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0