summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2019-10-10 10:45:31 +0200
committerAndreas Schwab <schwab@suse.de>2019-10-10 13:01:38 +0200
commit8a3ca0fdd33629854a73ffd9251aa9d77e4766e4 (patch)
tree7183b5f3b6f64e406d98e52ca29b27a9095fc09e
parente027ddeff60932b6a17f7f7c8b5c0a044b85722d (diff)
downloadglibc-8a3ca0fdd33629854a73ffd9251aa9d77e4766e4.tar.gz
glibc-8a3ca0fdd33629854a73ffd9251aa9d77e4766e4.tar.xz
glibc-8a3ca0fdd33629854a73ffd9251aa9d77e4766e4.zip
Simplify note processing
This removes dead code during note processing.
-rw-r--r--ChangeLog4
-rw-r--r--elf/dl-load.c17
2 files changed, 7 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index ccb0949a1b..53ae72288f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-10  Andreas Schwab  <schwab@suse.de>
+
+	* elf/dl-load.c (open_verify): Remove dead code.
+
 2019-10-10  Dmitry V. Levin  <ldv@altlinux.org>
 
 	* sysdeps/unix/sysv/linux/syscall-names.list: Fix typos in comment,
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 24e2819345..1ed7a7bbd6 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1682,21 +1682,10 @@ open_verify (const char *name, int fd,
 
       /* Check .note.ABI-tag if present.  */
       for (ph = phdr; ph < &phdr[ehdr->e_phnum]; ++ph)
-	if (ph->p_type == PT_NOTE && ph->p_filesz >= 32 && ph->p_align >= 4)
+	if (ph->p_type == PT_NOTE && ph->p_filesz >= 32
+	    && (ph->p_align == 4 || ph->p_align == 8))
 	  {
 	    ElfW(Addr) size = ph->p_filesz;
-	    /* NB: Some PT_NOTE segment may have alignment value of 0
-	       or 1.  gABI specifies that PT_NOTE segments should be
-	       aligned to 4 bytes in 32-bit objects and to 8 bytes in
-	       64-bit objects.  As a Linux extension, we also support
-	       4 byte alignment in 64-bit objects.  If p_align is less
-	       than 4, we treate alignment as 4 bytes since some note
-	       segments have 0 or 1 byte alignment.   */
-	    ElfW(Addr) align = ph->p_align;
-	    if (align < 4)
-	      align = 4;
-	    else if (align != 4 && align != 8)
-	      continue;
 
 	    if (ph->p_offset + size <= (size_t) fbp->len)
 	      abi_note = (void *) (fbp->buf + ph->p_offset);
@@ -1727,7 +1716,7 @@ open_verify (const char *name, int fd,
 	      {
 		ElfW(Addr) note_size
 		  = ELF_NOTE_NEXT_OFFSET (abi_note[0], abi_note[1],
-					  align);
+					  ph->p_align);
 
 		if (size - 32 < note_size)
 		  {