diff options
author | Your Name <you@example.com> | 2022-07-29 17:23:30 +0100 |
---|---|---|
committer | Your Name <you@example.com> | 2022-07-29 17:23:30 +0100 |
commit | f2b7104cd6c808c2caceb1314a19f4dbcfd087d7 (patch) | |
tree | 782205d6e3a91d71692bd24bf08b7cb1917068d9 | |
parent | c6af98bc355dbd828e2e6b332ab743a6c2f4ce4c (diff) | |
download | afl++-f2b7104cd6c808c2caceb1314a19f4dbcfd087d7.tar.gz |
Fix endianness of coverage data on big endian systems
-rw-r--r-- | frida_mode/README.md | 3 | ||||
-rw-r--r-- | frida_mode/src/instrument/instrument_coverage.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/frida_mode/README.md b/frida_mode/README.md index 4025dba5..1ed368d4 100644 --- a/frida_mode/README.md +++ b/frida_mode/README.md @@ -151,6 +151,7 @@ instances run CMPLOG mode and instrumentation of the binary is less frequent * `AFL_FRIDA_INST_DEBUG_FILE` - File to write raw assembly of original blocks and their instrumented counterparts during block compilation. +``` Creating block for 0x7ffff7953313: 0x7ffff7953313 mov qword ptr [rax], 0 0x7ffff795331a add rsp, 8 @@ -166,7 +167,7 @@ Generated block 0x7ffff75e98e2 *** - ``` +``` * `AFL_FRIDA_INST_CACHE_SIZE` - Set the size of the instrumentation cache used as a look-up table to cache real to instrumented address block translations. Default is 256Mb. diff --git a/frida_mode/src/instrument/instrument_coverage.c b/frida_mode/src/instrument/instrument_coverage.c index 68842feb..07d4d622 100644 --- a/frida_mode/src/instrument/instrument_coverage.c +++ b/frida_mode/src/instrument/instrument_coverage.c @@ -317,6 +317,12 @@ static void coverage_write_events(void *key, void *value, void *user_data) { }; +#if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) + evt.offset = __builtin_bswap32(evt.offset); + evt.length = __builtin_bswap16(evt.length); + evt.module = __builtin_bswap16(evt.module); +#endif + coverage_write(fd, &evt, sizeof(coverage_event_t)); } |