aboutsummaryrefslogtreecommitdiff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorRongwei Wang <rongwei.wang@linux.alibaba.com>2021-12-10 20:39:10 +0800
committerH.J. Lu <hjl.tools@gmail.com>2021-12-10 11:25:37 -0800
commit718fdd87b1b98ef88e883a37d9c18867256fa5a4 (patch)
treea6448e52abdd289a43acd8a0d77efc645a0668f7 /elf/dl-load.c
parent2e75604f8337fa4332977f72a8f6726309679edf (diff)
downloadglibc-718fdd87b1b98ef88e883a37d9c18867256fa5a4.zip
glibc-718fdd87b1b98ef88e883a37d9c18867256fa5a4.tar.gz
glibc-718fdd87b1b98ef88e883a37d9c18867256fa5a4.tar.bz2
elf: Properly align PT_LOAD segments [BZ #28676]
When PT_LOAD segment alignment > the page size, allocate enough space to ensure that the segment can be properly aligned. This change helps code segments use huge pages become simple and available. This fixes [BZ #28676]. Signed-off-by: Xu Yu <xuyu@linux.alibaba.com> Signed-off-by: Rongwei Wang <rongwei.wang@linux.alibaba.com>
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index bf8957e..7215931 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1,5 +1,6 @@
/* Map in a shared object's segments from the file.
Copyright (C) 1995-2021 Free Software Foundation, Inc.
+ Copyright The GNU Toolchain Authors.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -1150,6 +1151,7 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd,
c->mapend = ALIGN_UP (ph->p_vaddr + ph->p_filesz, GLRO(dl_pagesize));
c->dataend = ph->p_vaddr + ph->p_filesz;
c->allocend = ph->p_vaddr + ph->p_memsz;
+ c->mapalign = ph->p_align;
c->mapoff = ALIGN_DOWN (ph->p_offset, GLRO(dl_pagesize));
/* Determine whether there is a gap between the last segment