Add AddressSanitizer annotations to std::string

Mikhail Kashkarov m.kashkarov@partner.samsung.com
Tue May 29 06:53:00 GMT 2018


Hello,

I'd like to propose following features for the review:

[1] Add option to disable std::string small-string optimization usage.
Add _GLIBCXX_DISABLE_SSO_USAGE define that disables c++11 std::string
_M_local_buf usage to let AddressSanitizer poison string buffer correctly.

[2] Add AddressSanitizer annotations to std::string.
String annotations can be enabled with _GLIBCXX_ANNOTATE_STRING define.
For COW-strings annotation we need to align the beginning of string 
buffer by 8
(ASan requirements), so the layout change is applied if annotations in on.
This work is based on Ivan Baravy draft patches for string annotations.

Also, while testing annotations for older compiler versions I managed to 
find
libstdc++ bugs in std::regex/std::basic_stringbuf that are fixed in
upstream now so it could be useful not only for testing projects but for the
library itself.

-- 
Best regards,
Kashkarov Mikhail
Samsung R&D Institute Russia



More information about the Libstdc++ mailing list