Hacking

Frida Hacking (Porting to New Architectures)

This page uses Linux/MIPS as a concrete example of porting Frida to an unsupported architecture.

Component Overview

Frida has two primary low-level components that require architecture-specific work:

ComponentRoleRepository
frida-gumLowest-level instrumentation engine (interceptor, stalker, memory)https://github.com/frida/frida-gum
frida-coreProcess injection and communication layerhttps://github.com/frida/frida-core

Step 1 — Understand the Build System

  1. Review releng/machine_spec.py for architecture-specific configuration and target triplet parsing.
  2. After running ./configure --host=<target>, inspect the generated machine file at build/frida-<os>-<arch>.txt (e.g., build/frida-linux-mips.txt) to verify toolchain and sysroot settings.

Step 2 — Port frida-gum

Clone and build for host (sanity check)

1git clone https://github.com/frida/frida-gum.git
2cd frida-gum
3make
4make test

Run a specific test

1FRIDA_TEST_OPTIONS="--test-args='-p /Core/Process/process_modules' -v" make test

Create the new backend directory

1cp -r gum/backend-arm64 gum/backend-mips

Reference for ARM64 backend: https://github.com/frida/frida-gum/tree/main/gum/backend-arm64

Files to port

FilePriorityNotes
guminterceptor-mips.cRequiredCore function hooking; must be fully ported
gumspinlock-mips.cRequiredAtomic spin-lock primitives
gumstalker-mips.cOptional stubCode tracing engine — leave as empty stub initially; significant effort to fully implement

Step 3 — Port frida-core (Injector)

The injector is the component that loads the Frida agent into a target process.

Porting Checklist

Key File Paths

PathDescription
releng/machine_spec.pyTarget triplet parsing and machine spec generation
build/frida-linux-mips.txtGenerated Meson machine file for the target
gum/backend-arm64/Reference backend to duplicate for a new arch
gum/backend-mips/guminterceptor-mips.cNew arch interceptor (to be created)
gum/backend-mips/gumspinlock-mips.cNew arch spinlock (to be created)
gum/backend-mips/gumstalker-mips.cNew arch stalker stub (to be created)
src/linux/frida-helper-backend.valaLinux injector — primary porting target in frida-core