Prevent IndirectReferenceTable from being outside of kPageAlignment

Due to how we resized the IndirectReferenceTable it could end up being
an unaligned size. On some architectures, this could sometimes cause
issues we would try to madvise a negative length region, causing
crashes. To fix this we changed the IRT to avoid ever having non-page
aligned lengths and changed how we calculate what to madvise slightly.

Test: ./test.py --host
Test: ./test.py --host --debuggable --64 --with-agent $ANDROID_HOST_OUT/lib64/libtifastd.so=ClassFileLoadHook
Test: Manual checks on emulator
Bug: 152421535
Change-Id: I9eb99c750e6b6230998bf8ba314be426ad8c228c
2 files changed