public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] elf: Remove excessive p_align check on PT_LOAD segments [BZ #28688]
Date: Wed, 22 Dec 2021 13:13:15 +0000 (GMT)	[thread overview]
Message-ID: <20211222131315.6D3DF3858D35@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=163f625cf9becbb82dfec63a29e566324129c0cd

commit 163f625cf9becbb82dfec63a29e566324129c0cd
Author: H.J. Lu <hjl.tools@gmail.com>
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 <fweimer@redhat.com>

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;
 	    }


                 reply	other threads:[~2021-12-22 13:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211222131315.6D3DF3858D35@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).