Over write store instruction and purpose of -fsanitize=address

Skip to first unread message


Feb 9, 2024, 2:36:38 PMFeb 9
to address-sanitizer

I intend to over write the store instruction in similar manner as done address sanitizer.
In that quest, I want to know what exactly does option "-fsanitize=address" do and is there any way I can just pass on the custom code to store instruction.

I would really appreciate if someone could point me to appropriate documentation.


Alexander Potapenko

Feb 12, 2024, 5:39:32 AMFeb 12
to address-...@googlegroups.com
Hi Fakharu,

you don't mention the compiler you want to modify, but I advise you to
use Clang.
The instrumentation is implemented in AddressSanitizer.cpp
(https://llvm.org/doxygen/AddressSanitizer_8cpp_source.html), and the
function that actually adds instrumentation is called
You may also look at the loops in
AddressSanitizer::instrumentFunction() that collect the
instructions/operands to instrument based on their type.

Make sure to familiarize yourself with
https://llvm.org/docs/LangRef.html so that you understand how LLVM
intermediate representation is organized.

You can either construct your instrumentation code in the compiler
pass (especially if you need it to be fast), or you can put it into
the runtime library, and use out-of-line instrumentation based on
calls (enabled with `-mllvm
In the latter case, if you don't need the rest of ASan instrumentation
(e.g. redzones around global and stack objects), you may want to look
at -fsanitize=thread, which just adds calls to every memory load and

> --
> You received this message because you are subscribed to the Google Groups "address-sanitizer" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to address-saniti...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/address-sanitizer/390ebc47-e6a3-4744-b5fa-92f3337c3521n%40googlegroups.com.

Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg


Feb 12, 2024, 9:22:39 AMFeb 12
to address-sanitizer
Thanks a lot for the detailed instruction Alexander, but unfortunately I will have to stick with gcc as it is only the one currently supported on the system I am using.
I will try to find the equivalent information for gcc and work on that.

Thanks again,

Reply all
Reply to author
0 new messages