This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer_common] Several Solaris procmaps fixes

Authored by ro on Jul 14 2022, 11:36 PM.



Since the introduction of GoogleTest sharding in D122251, some of the Solaris sanitizer tests have been running extremly long (up to an hour) while they took mere seconds before. Initial investigation suggests that massive lock contention in Solaris procfs is involved here.

However, there's an easy way to somewhat reduce the impact: while the current ReadProcMaps uses ReadFileToBuffer to read /proc/self/xmap, that function primarily caters to Linux procfs reporting file sizes of 0 while the size on Solaris is accurate. This patch makes use of that, reducing the number of syscalls involved and reducing the runtime of affected tests by a factor of 4.

Besides, it handles shared mappings and doesn't call readlink for unnamed map entries.

Tested on sparcv9-sun-solaris2.11 and amd64-pc-solaris2.11.

Diff Detail