The ring buffer size is a multiple of system page size, and now the page size can only be 4K.
It can not work well on other system that has different page size configure.
Depends on D123908
Differential D123910
[HWAsan] Support 4K/8K/16K/64K page size to ring buffer XiaodongLoong on Apr 17 2022, 5:50 AM. Authored by
Details
Diff Detail
Unit Tests Event TimelineComment Actions Generally, there is no way to tell the target page size in advance. And there is no need for that, too - just untie this value from the page size instead, and fix the munmap issue in the runtime library by up/down aligning the bounds to the runtime page size. You can also increase the default / minimal ring buffer size at runtime to be a multiple of the page size. Comment Actions Sorry, my expression may not be accurate at first. I want to support more kind of page size for HWAsan. I add a command option to custom page size in D123908. Thanks! Comment Actions I still think that my proposal in the comment above is way better than adding an ABI-breaking compiler flag. Comment Actions OK, I read the proposal https://github.com/google/sanitizers/issues/1446. Using pagesize here would be wasteful - ex. on Android we default to a single 4Kb page for the stack ring buffer. I'd rather replace the mmap in SavedStackAllocations with InternalAlloc , this should solve the problem. There is also an efficiency issue in HwasanThreadList::DontNeedThread - if the buffer is smaller than a page, it will never be able to release anything. That's a bit harder to fix, and I'm not sure how significant it actually is. I'm looking forward to your revision. Thanks! |