[V2 PATCH] an alignment bug when both LD_PRELOAD and HUGETLB_FORCE_ELFMAP are enabled
If program header's p_vaddr is aligned with hpage size, hugetlb_slice_end(vaddr) returns vaddr-1, and thus such a error appears, INFO: Segment 2's aligned memsz is too small: 0x485d4 < 0xffffffff slice_end should point to the correct end address of next slice. Signed-off-by: Lans Zhang <jia.zhang2...@gmail.com> --- elflink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/elflink.c +++ b/elflink.c @@ -765,14 +765,14 @@ */ vaddr = hugetlb_next_slice_start(info->dlpi_phdr[i].p_vaddr); gap = vaddr - info->dlpi_phdr[i].p_vaddr; - slice_end = hugetlb_slice_end(vaddr); + slice_end = hugetlb_slice_end(vaddr + 1); /* * we should stop remapping just before the slice * containing the end of the memsz portion (taking away * the gap of the memsz) */ memsz = info->dlpi_phdr[i].p_memsz; - if (memsz < gap) { + if (memsz <= gap) { INFO("Segment %d's unaligned memsz is too small: " "%#0lx < %#0lx\n", i, memsz, gap); ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel