Skip to content

Commit

Permalink
hfuzz-cc: mark HonggfuzzNetDriver_main as undefined but don't define …
Browse files Browse the repository at this point in the history
…it in the netdriver
  • Loading branch information
robertswiecki committed May 15, 2019
1 parent 4321f93 commit bc7dea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 2 additions & 0 deletions hfuzz_cc/hfuzz-cc.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,11 @@ static int ldMode(int argc, char** argv) {

/* Pull modules defining the following symbols (if they exist) */
#ifdef _HF_ARCH_DARWIN
args[j++] = "-Wl,-U,_HonggfuzzNetDriver_main";
args[j++] = "-Wl,-U,_LIBHFUZZ_module_instrument";
args[j++] = "-Wl,-U,_LIBHFUZZ_module_memorycmp";
#else /* _HF_ARCH_DARWIN */
args[j++] = "-Wl,-u,HonggfuzzNetDriver_main";
args[j++] = "-Wl,-u,LIBHFUZZ_module_instrument";
args[j++] = "-Wl,-u,LIBHFUZZ_module_memorycmp";
#endif /* _HF_ARCH_DARWIN */
Expand Down
11 changes: 1 addition & 10 deletions libhfnetdriver/netdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ static struct {
.sa_family = AF_UNSPEC,
};

__attribute__((weak)) int HonggfuzzNetDriver_main(
int argc HF_ATTR_UNUSED, char **argv HF_ATTR_UNUSED) {
LOG_F("The HonggfuzzNetDriver_main function was not defined in your code");
return EXIT_FAILURE;
}
extern int HonggfuzzNetDriver_main(int argc, char **argv);

static void *netDriver_mainProgram(void *unused HF_ATTR_UNUSED) {
int ret = HonggfuzzNetDriver_main(hfnd_globals.argc_server, hfnd_globals.argv_server);
Expand Down Expand Up @@ -288,11 +284,6 @@ __attribute__((weak)) int LLVMFuzzerInitialize(int *argc, char ***argv) {
LOG_I(
"Honggfuzz Net Driver (pid=%d): '%s' is set, skipping fuzzing, calling main() directly",
getpid(), HFND_SKIP_FUZZING_ENV);
if (!HonggfuzzNetDriver_main) {
LOG_F("Honggfuzz Net Driver (pid=%d): HonggfuzzNetDriver_main was not defined in your "
"code",
getpid());
}
exit(HonggfuzzNetDriver_main(*argc, *argv));
}

Expand Down

0 comments on commit bc7dea2

Please sign in to comment.