Dipanjan Das via llvm-dev
2017-Jun-16 11:11 UTC
[llvm-dev] How does sanitizers in compiler-rt work?
Can anybody give me any pointer on how compiler-rt, especially the sanitizers work? Do they operate on IR as any other LLVM pass? Or are they integral part of the frontend itself? I couldn't spot any documentation on the internals of compiler-rt project? What happens (sequence of actions) when I pass -fsanitizer=dataflow to clang? Precisely, I intend to alter the behaviour of DFSan to suit my need. Therefore, I need to know how it gets integrated in the tool-chain. Initially, my idea was to insert the dfsan_set_label() calls to the IR and pass it to DFSan. However, I am not sure if it's designed to run on the source only, not on IR. -- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/13288783/attachment.html>
Vedant Kumar via llvm-dev
2017-Jun-16 21:48 UTC
[llvm-dev] How does sanitizers in compiler-rt work?
> On Jun 16, 2017, at 4:11 AM, Dipanjan Das via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > Can anybody give me any pointer on how compiler-rt, especially the sanitizers work? Do they operate on IR as any other LLVM pass? Or are they integral part of the frontend itself? I couldn't spot any documentation on the internals of compiler-rt project? What happens (sequence of actions) when I pass -fsanitizer=dataflow to clang?Passing -fsanitize=dataflow tells clang to insert the dataflow sanitizer's instrumentation pass into the normal compilation pipeline. The instrumentation occurs at the LLVM IR level. The pass may insert calls into runtime functions which are provided by compiler-rt. Therefore, in order to link a program compiled with -fsanitize=dataflow, the appropriate runtime library from compiler-rt is required.> Precisely, I intend to alter the behaviour of DFSan to suit my need.What is your need, exactly?> Therefore, I need to know how it gets integrated in the tool-chain. Initially, my idea was to insert the dfsan_set_label() calls to the IR and pass it to DFSan. However, I am not sure if it's designed to run on the source only, not on IR.You should take a look at lib/Transforms/Instrumentation/DataFlowSanitizer.cpp. There doesn't appear to be much done at the source level. best, vedant> > -- > Thanks & Regards, > > Dipanjan > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/9c794095/attachment-0001.html>
Dipanjan Das via llvm-dev
2017-Jun-16 22:23 UTC
[llvm-dev] How does sanitizers in compiler-rt work?
Hi Vedant, Thanks for the pointers. Please find my replies inline. On 16 June 2017 at 14:48, Vedant Kumar <vsk at apple.com> wrote:> > On Jun 16, 2017, at 4:11 AM, Dipanjan Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > > > Can anybody give me any pointer on how compiler-rt, especially the > sanitizers work? Do they operate on IR as any other LLVM pass? Or are they > integral part of the frontend itself? I couldn't spot any documentation on > the internals of compiler-rt project? What happens (sequence of actions) > when I pass -fsanitizer=dataflow to clang? > > > Passing -fsanitize=dataflow tells clang to insert the dataflow sanitizer's > instrumentation pass into the normal compilation pipeline. The > instrumentation occurs at the LLVM IR level. The pass may insert calls into > runtime functions which are provided by compiler-rt. Therefore, in order to > link a program compiled with -fsanitize=dataflow, the appropriate runtime > library from compiler-rt is required. > > > Precisely, I intend to alter the behaviour of DFSan to suit my need. > > > What is your need, exactly? > >Instead of manually inserting the dfsan_create_label() and dfsan_set_label() calls in the source, I want to automatically insert those calls in the IR for all the input variables in scanf(). I intend to run the DFsan pass afterwards, thus instrumenting the IR further as required.> Therefore, I need to know how it gets integrated in the tool-chain. > Initially, my idea was to insert the dfsan_set_label() calls to the IR and > pass it to DFSan. However, I am not sure if it's designed to run on the > source only, not on IR. > > > You should take a look at lib/Transforms/Instrumentation/DataFlowSanitizer.cpp. > There doesn't appear to be much done at the source level. > > best, > vedant > > > -- > > Thanks & Regards, > Dipanjan > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-- Thanks & Regards, Dipanjan -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170616/b7325d95/attachment.html>