Skip to content

Commit

Permalink
Merge "Call __hwasan_init_static() during libc startup in statically …
Browse files Browse the repository at this point in the history
…linked executables."
  • Loading branch information
pcc authored and Gerrit Code Review committed Mar 20, 2019
2 parents 8b8e7d0 + d75e308 commit ebdf4c1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libc/bionic/libc_init_static.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ __noreturn static void __real_libc_init(void *raw_args,
exit(slingshot(args.argc, args.argv, args.envp));
}

extern "C" void __hwasan_init();
extern "C" void __hwasan_init_static();

__attribute__((no_sanitize("hwaddress")))
__noreturn void __libc_init(void* raw_args,
Expand All @@ -214,8 +214,9 @@ __noreturn void __libc_init(void* raw_args,
// Install main thread TLS early. It will be initialized later in __libc_init_main_thread. For now
// all we need is access to TLS_SLOT_SANITIZER.
__set_tls(&temp_tcb.tls_slot(0));
// Initialize HWASan. This sets up TLS_SLOT_SANITIZER, among other things.
__hwasan_init();
// Initialize HWASan enough to run instrumented code. This sets up TLS_SLOT_SANITIZER, among other
// things.
__hwasan_init_static();
// We are ready to run HWASan-instrumented code, proceed with libc initialization...
#endif
__real_libc_init(raw_args, onexit, slingshot, structors, &temp_tcb);
Expand Down

0 comments on commit ebdf4c1

Please sign in to comment.