about summary refs log tree commit diff
path: root/elf/dl-load.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-03-16 23:34:59 -0700
committerUlrich Drepper <drepper@redhat.com>2010-03-16 23:34:59 -0700
commitd8c47894ca28d5c5cf396aa271c579d41f21c1d4 (patch)
treeff4bcc8ec078db8a07f812e8cd41ad74aa37db6a /elf/dl-load.c
parent8ed9a2b18bc6d9bb2be89562fe1e14f9c3cf3346 (diff)
downloadglibc-d8c47894ca28d5c5cf396aa271c579d41f21c1d4.tar.gz
glibc-d8c47894ca28d5c5cf396aa271c579d41f21c1d4.tar.xz
glibc-d8c47894ca28d5c5cf396aa271c579d41f21c1d4.zip
Extended ELF ABI version handling only for Linux.
If the OSABI is generic we should not allow the ABI version to be nonzero.
Move all the new functionality into Linux-specific files.
Diffstat (limited to 'elf/dl-load.c')
-rw-r--r--elf/dl-load.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 1cfab353d0..756816f25f 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1569,7 +1569,7 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 #ifndef VALID_ELF_HEADER
 # define VALID_ELF_HEADER(hdr,exp,size)	(memcmp (hdr, exp, size) == 0)
 # define VALID_ELF_OSABI(osabi)		(osabi == ELFOSABI_SYSV)
-# define VALID_ELF_ABIVERSION(ver)	(ver < LIBC_ABI_MAX)
+# define VALID_ELF_ABIVERSION(osabi,ver) (ver == 0)
 #elif defined MORE_ELF_HEADER_DATA
   MORE_ELF_HEADER_DATA;
 #endif
@@ -1656,7 +1656,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
       /* See whether the ELF header is what we expect.  */
       if (__builtin_expect (! VALID_ELF_HEADER (ehdr->e_ident, expected,
 						EI_ABIVERSION)
-			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]),
+			    || !VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
+						      ehdr->e_ident[EI_ABIVERSION]),
 			    0))
 	{
 	  /* Something is wrong.  */
@@ -1697,7 +1698,8 @@ open_verify (const char *name, struct filebuf *fbp, struct link_map *loader,
 	     allowed here.  */
 	  else if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI]))
 	    errstring = N_("ELF file OS ABI invalid");
-	  else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]))
+	  else if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_OSABI],
+					  ehdr->e_ident[EI_ABIVERSION]))
 	    errstring = N_("ELF file ABI version invalid");
 	  else
 	    /* Otherwise we don't know what went wrong.  */