This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][test] Don't hard-code page size in leak_check_segv.cpp
ClosedPublic

Authored by tangyouling on Dec 9 2022, 12:24 AM.

Details

Reviewers
vitalybuka
SixWeining
xen0n
xry111
MaskRay
XiaodongLoong
Group Reviewers
Restricted Project
Summary

Don't hard code the page in leak_check_segv.cpp, this breaks on
e.g. LoongArch which defaults to a 16KiB page size.

Diff Detail

Event Timeline

tangyouling created this revision.Dec 9 2022, 12:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2022, 12:24 AM
tangyouling requested review of this revision.Dec 9 2022, 12:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2022, 12:24 AM

This change is actually platform-agnostic. While it looks good to me (minus one nit) I'd like to leave the approval to someone else more familiar with this code.

compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cpp
14

Given you're touching this code and the use sites below all subtract 1 from the page size for use as bitmask, why not kPageBitsMask = GetPageSize() - 1? We're not going to see non-power-of-2 page sizes anytime soon.

tangyouling added inline comments.Dec 22 2022, 7:19 PM
compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cpp
14

Ok, i will modify it.

Address @xen0n's comments.

This revision is now accepted and ready to land.Dec 26 2022, 6:34 PM
XiaodongLoong added inline comments.Dec 27 2022, 3:54 AM
compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cpp
14

As @MaskRay said in D140607,

getpagesize is not recommended. Linux can use getauxval(AT_PAGESZ).

Maybe, you also need to change here.

tangyouling added inline comments.Dec 27 2022, 4:00 AM
compiler-rt/test/asan/TestCases/Linux/leak_check_segv.cpp
14

Yes, will wait for discussion on D140607.

SixWeining closed this revision.Apr 24 2023, 12:31 AM

This test has been moved from ASAN to LSAN and the issue was fixed in D148407.