diff options
author | van Hauser <vh@thc.org> | 2019-05-28 16:40:24 +0200 |
---|---|---|
committer | van Hauser <vh@thc.org> | 2019-05-28 16:40:24 +0200 |
commit | f367728c4435670caf2e9cc5acad257e7766cc65 (patch) | |
tree | 5a4f587630b161f32a548f5c196032e2566741e2 /qemu_mode/patches/elfload2.diff | |
parent | 1b3d018d35d9091bda28e38e066a99491f2415b5 (diff) | |
download | afl++-f367728c4435670caf2e9cc5acad257e7766cc65.tar.gz |
afl++ 2.52c initial commit
Diffstat (limited to 'qemu_mode/patches/elfload2.diff')
-rw-r--r-- | qemu_mode/patches/elfload2.diff | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/qemu_mode/patches/elfload2.diff b/qemu_mode/patches/elfload2.diff new file mode 100644 index 00000000..e09d11c6 --- /dev/null +++ b/qemu_mode/patches/elfload2.diff @@ -0,0 +1,24 @@ +--- qemu-2.10.0/linux-user/elfload.c.after 2019-05-28 15:21:36.931618928 +0200 ++++ qemu-2.10.0/linux-user/elfload.c 2019-05-28 15:22:23.939617556 +0200 +@@ -2087,7 +2087,20 @@ + info->brk = 0; + info->elf_flags = ehdr->e_flags; + +- if (!afl_entry_point) afl_entry_point = info->entry; ++ if (!afl_entry_point) { ++ char *ptr; ++ if ((ptr = getenv("AFL_ENTRYPOINT")) != NULL) { ++ afl_entry_point = strtoul(ptr, NULL, 16); ++ } else { ++ if (!afl_entry_point) afl_entry_point = info->entry; ++ } ++#ifdef TARGET_ARM ++ /* The least significant bit indicates Thumb mode. */ ++ afl_entry_point = afl_entry_point & ~(target_ulong)1; ++#endif ++ if (getenv("AFL_DEBUG") != NULL) ++ fprintf(stderr, "AFL forkserver entrypoint: %p\n", (void*)afl_entry_point); ++ } while(0); + + for (i = 0; i < ehdr->e_phnum; i++) { + struct elf_phdr *eppnt = phdr + i; |