Re: Having problems when trying to instrument all code of a specific UEFI driver (including the library code)


Andrew Fish
 

On Apr 13, 2021, at 2:38 PM, mick21@live.nl wrote:

Sure, currently I add the adjusted libraries like this:

MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.sanitizer.inf
TimerLib|OvmfPkg/Library/AcpiTimerLib/DxeAcpiTimerLib.sanitizer.inf
ResetSystemLib|OvmfPkg/Library/ResetSystemLib/DxeResetSystemLib.sanitizer.inf
MemoryAllocationLib|MdePkg/Library/SmmMemoryAllocationLib/SmmMemoryAllocationLib.sanitizer.inf
What compiler flags did you change to get the clang sanitizer working?

Thanks,

Andrew Fish

...

Then I copy all the original library.inf to library.sanitizer.inf and then append my [BuildOptions] section, depending on the instrumentation. You can then check the static_library_files.lst in the build directory for your driver to see if all libraries are replaced with the sanitized ones. This is only "one layer" though, I'm not sure whether this matters for my implementation, but libraries can use other libraries, which should also be instrumented, that is not the case with this.

Join discuss@edk2.groups.io to automatically receive all group messages.