[llvm-dev] Where does the LLVM implement the Ubsan's instrumentations?

Shi, Steven via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 22 06:06:49 PDT 2017


> You might try compiling with '-fsanitize=undefined -fno-sanitize-

> Ubsan doesn't provide an option of using callbacks to implement its

> instrumentation. If the no-recovery mode won't work for you, it's pretty

> simply to write a custom ubsan runtime that fits in a single object file. That's

> what I ended up doing to sanitize our kernel (xnu), so I can offer help if you

> decide to go down that path.



Vedant,

Thank you. I'm OK to write customized runtime libs for Ubsan. In fact, I did in this way when I enable the Asan in my firmware. My problem is how to correctly implement the UBsan C++ runtime lib with pure C functions in my firmware. You know, the UBsan define the runtime interface in C++, which is different from the Asan extern "C" ones. Many UBsan RT lib input parameters type are mixed with C++ Class. I'm not sure how to correctly parse the C++ class with C structure. E.g. Many UBsan RT functions use the Class SourceLocation to pass the source location info. How should I parse or map the class SourceLocation layout to a C structure?





llvm\projects\compiler-rt\lib\ubsan\ubsan_value.h

class SourceLocation {

  const char *Filename;

  u32 Line;

  u32 Column;



public:

  SourceLocation() : Filename(), Line(), Column() {}

  SourceLocation(const char *Filename, unsigned Line, unsigned Column)

    : Filename(Filename), Lin

.... ....

}



I'd like to take a look at your XNU Ubsan runtime lib code, and if you have open-sourced them, please show me their links. Thank you!



Thanks

Steven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170722/eecec17c/attachment.html>


More information about the llvm-dev mailing list