From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1039) id 6D3DF3858D35; Wed, 22 Dec 2021 13:13:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6D3DF3858D35 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: H.J. Lu To: glibc-cvs@sourceware.org Subject: [glibc] elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688] X-Act-Checkin: glibc X-Git-Author: H.J. Lu X-Git-Refname: refs/heads/master X-Git-Oldrev: d3e4f5a1014db09ff1c62c6506f92cba469e193d X-Git-Newrev: 163f625cf9becbb82dfec63a29e566324129c0cd Message-Id: <20211222131315.6D3DF3858D35@sourceware.org> Date: Wed, 22 Dec 2021 13:13:15 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2021 13:13:15 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=163f625cf9becbb82dfec63a29e566324129c0cd commit 163f625cf9becbb82dfec63a29e566324129c0cd Author: H.J. Lu Date: Tue Dec 21 12:35:47 2021 -0800 elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688] p_align does not have to be a multiple of the page size. Only PT_LOAD segment layout should be aligned to the page size. 1: Remove p_align check against the page size. 2. Use the page size, instead of p_align, to check PT_LOAD segment layout. Reviewed-by: Florian Weimer Diff: --- elf/dl-load.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/elf/dl-load.c b/elf/dl-load.c index 721593135e..2a1443387f 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1133,16 +1133,11 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, case PT_LOAD: /* A load command tells us to map in part of the file. We record the load commands and process them all later. */ - if (__glibc_unlikely ((ph->p_align & (GLRO(dl_pagesize) - 1)) != 0)) - { - errstring = N_("ELF load command alignment not page-aligned"); - goto lose; - } if (__glibc_unlikely (((ph->p_vaddr - ph->p_offset) - & (ph->p_align - 1)) != 0)) + & (GLRO(dl_pagesize) - 1)) != 0)) { errstring - = N_("ELF load command address/offset not properly aligned"); + = N_("ELF load command address/offset not page-aligned"); goto lose; }