qemu ld_preload support and added socket_fuzzing ld_preload library

This commit is contained in:
van Hauser
2019-12-24 20:56:10 +01:00
parent 3122790295
commit 67b6298895
13 changed files with 230 additions and 42 deletions

View File

@ -705,10 +705,37 @@ int main(int argc, char** argv) {
if (dumb_mode == 2 && no_forkserver)
FATAL("AFL_DUMB_FORKSRV and AFL_NO_FORKSRV are mutually exclusive");
if (getenv("LD_PRELOAD"))
WARNF(
"LD_PRELOAD is set, are you sure that is want to you want to do "
"instead of using AFL_PRELOAD?");
if (getenv("AFL_PRELOAD")) {
setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1);
setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1);
if (qemu_mode) {
char* qemu_preload = getenv("QEMU_SET_ENV");
char buf[4096];
if (qemu_preload) {
snprintf(buf, sizeof(buf), "%s,LD_PRELOAD=%s", qemu_preload,
getenv("AFL_PRELOAD"));
} else {
snprintf(buf, sizeof(buf), "LD_PRELOAD=%s", getenv("AFL_PRELOAD"));
}
setenv("QEMU_SET_ENV", buf, 1);
} else {
setenv("LD_PRELOAD", getenv("AFL_PRELOAD"), 1);
setenv("DYLD_INSERT_LIBRARIES", getenv("AFL_PRELOAD"), 1);
}
}