Compiling Chrome with Sanitizers

Skip to first unread message

Yizhuo Zhai

Jan 31, 2023, 12:37:52 PMJan 31
to Chromium-dev
Hi All:
I'm trying to compile Chrome with C++/C sanitizers, by adding -fsanitize options after flags in But the protoc is broken after doing so, if I understand correctly, protoc is used to generate some files, therefore, I do not need to instrument the instructions in it. 

I wonder which folder will finally compiled into the chrome binary, and I think it's ok to add the flag to those sub-modules in chrome. Could anyone give me the hint on the code that would finally compiled into the Chrome? And the correct location to add the flags? I appreciate any help you can give.

Peter Boström

Jan 31, 2023, 12:46:32 PMJan 31
to, Chromium-dev
Depending on what sanitizer you're interested in running we have gn arguments for is_asan, is_ubsan, is_msan and is_tsan. Maybe I've forgotten some, like is_lsan. 

For asan there's documentation here, I dunno where the rest are:

Good luck!

Chromium Developers mailing list:
View archives, change email options, or unsubscribe:
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

Peter Boström

Feb 1, 2023, 12:23:14 PMFeb 1
to Yizhuo Zhai, Chromium-dev
Maybe will help as well as using the sanitizer.gni as a base for your work.

On Tue, Jan 31, 2023 at 5:17 PM Yizhuo Zhai <> wrote:
Hi Peter:
Thanks for your suggestions, K. Moon also replied to me with a similar answer, sorry for the duplicated question. 
I actually need to use a research clang sanitizer which does not exist in the current building system.
I would refer to the document you show and I appreciate your help very much.
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside 

Yizhuo Zhai

Feb 1, 2023, 3:09:55 PMFeb 1
to Peter Boström, Chromium-dev
Hi Peter:
Thanks for the doc, configuring clang_base_path and adding the sanitizer options (-fsanitize=) to the are exactly the thing I did, there are a few troubles regarding flatc, cddl, protobuf, and some generators (returns error status -11, etc). 

I have written a bin/sh wrapper not to instrument c/c++ code under those submodules as I think the final chrome would not contain any code from those third party tools. But please let me know if you think this is incorrect.

 I'm also studying how to deploy the sanitizer from asan, if the previous approach fails, I would deploy the customized sanitizer as what asan did. It seems it needs to modify some configuration files(.gn or .gni as you pointed) to set up the sanitizer option and add some flags. 
Reply all
Reply to author
0 new messages