This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Implement GetRSS on Windows
ClosedPublic

Authored by cryptoad on Feb 1 2018, 3:01 PM.

Details

Summary

Pretty straightforward, returning the WorkingSetSize of a
PROCESS_MEMORY_COUNTERS structure. AFAIU, GetProcessMemoryInfo is in
kernel32.lib for Windows 7 and above. Support for earlier Windows versions
would require psapi.lib, but I don't think those are supported by ASan?

Diff Detail

Event Timeline

cryptoad created this revision.Feb 1 2018, 3:01 PM
Herald added subscribers: Restricted Project, delcypher, kubamracek. · View Herald TranscriptFeb 1 2018, 3:01 PM

@rnk, could you please take a look? Thanks!

vitalybuka added a subscriber: vitalybuka.EditedFeb 9 2018, 11:25 AM

They fail if I break GetRSS on Linux.
I didn't check if anything else is missing on windows to support soft_rss_limit_mb=

They fail if I break GetRSS on Linux.
I didn't check if anything else is missing on windows to support soft_rss_limit_mb=

Currently Windows doesn't have a background thread that is needed for the RSS check (launched by MaybeStartBackgroundThread).
GetRSS here is implemented for Scudo support. The larger current WIP CL is at https://reviews.llvm.org/D42519, which includes the RSS test support (but it needs a lot of other stuff to land).
Scudo uses a per deallocation check as opposed to a background thread to not have to start a new thread.

vitalybuka accepted this revision.Feb 9 2018, 1:09 PM
This revision is now accepted and ready to land.Feb 9 2018, 1:09 PM
This revision was automatically updated to reflect the committed changes.