ELF loader ignores segment alignment
The ELF loader in drlibc ignores the ElfNN_Phdr.p_align flag entirely: instead it uses the page size only for alignment of the start and end of each segment. This doesn't matter for most ELF files, since they align their p_vaddr fields. But it does appear when loading AArch64 ELF files on x86 where the ELF expects 64K pages and aligns its segments to 64K. (This also raises the problem of how to handle cross-arch page sizes like that when we load cross-arch ELF files for drcachesim trace analysis and other purposes: right now using the host page size is working b/c we only run AArch64 on x86 where x86's page size is smaller.)
Getting into the details: it is a little murky as to which loaders honor p_align, and what p_align really means. I found a case where an ELF file's segments had 2MB p_align, but the kernel there completely ignored the p_align (slightly custom Linux kernel). DR not matching the kernel in this respect causes major problems when our early injection parses the libdynamorio.so headers for relocation.