{"repo":"retrage/svc-hook","free":true,"listed":false,"github":"https://github.com/retrage/svc-hook","clone":"git clone https://github.com/retrage/svc-hook.git","description":"System Call Hook for ARM64","language":"C","stars":225,"topics":["aarch64","android","linux","syscall-hook","binary-rewriting","tracing","freebsd","netbsd"],"license":"Apache-2.0","category":"mobile-apps","readme_excerpt":"svc-hook: System Call Hook for ARM64 svc-hook is a system call hook mechanism for ARM64. It is designed to be low performance overhead, independent of the target source code, without relying on kernel features. It utilizes binary rewriting, replacing every svc instruction with a b instruction in the loaded target binary code before the main function starts. Key Features - 1,000 times faster than ptrace - No need for target source code - Works without relying on kernel features Target Platform svc-hook supports ARM64 Linux, Android, FreeBSD, and NetBSD. Note that NetBSD support is not upstreamed yet. See: PR#29. Build svc-hook has no external dependencies. To build libsvchook.so , run the following command in the root directory on an ARM64 system: If you are building on x86 64 or another host architecture, provide an ARM64 cross compiler via the CC variable: To build a simple hook application libsvchook basic.so , use: Usage You need to set two environment variables: - LIBSVCHOOK : Path to the hook application e.g., apps/basic/libsvchook basic.so - LD PRELOAD : Path to libsvchook.so Example Replace [target] with the binary whose system calls you wish to hook. Example Output How It Works svc-hook has four stages during initialization: 1. It records the addresses of svc instructions in the target code and computes the range a b instruction can branch to (from pc - 0x8000000 to pc + 0x7fffffc ). 2. It instantiates a custom trampoline code for each svc instruction. The recorded ad","default_branch":null,"files":null,"tree":[],"storefront":"/r/retrage","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/retrage/svc-hook/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}