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
AddressSanitizer::instrumentAddress().
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
-asan-instrumentation-with-call-threshold=0`).
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
store.

HTH,
Alex

On Fri, Feb 9, 2024 at 8:36 PM fakharu <[email protected]> wrote:
>
> Hi,
>
> 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.
>
> Thanks,
> Fakharu
>
> --
> 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 [email protected].
> 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

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/address-sanitizer/CAG_fn%3DWuEoFSy4NUCQ-Ai3OQJX82Yb6PDk%2BN0yqgyGSj_MZYAA%40mail.gmail.com.

Reply via email to