Native self-modifying code on Android
问题 I am trying to make some self-modifing native code on Android and run it in the emulator. My sample is based on the HelloJNI sample from the android-ndk. It looks like this: #define NOPE_LENGTH 4 typedef void (*FUNC) (void); // 00000be4 <nope>: // be4: 46c0 nop (mov r8, r8) // be6: 4770 bx lr void nope(void) { __asm__ __volatile__ ("nop"); } void execute(void){ void *code = mmap(NULL, NOPE_LENGTH, PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (code != MAP_FAILED) { memcpy