about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-cache.c3
-rw-r--r--elf/dl-diagnostics.c5
-rw-r--r--elf/dl-load.c95
-rw-r--r--elf/dl-support.c6
-rw-r--r--elf/rtld.c15
5 files changed, 15 insertions, 109 deletions
diff --git a/elf/dl-cache.c b/elf/dl-cache.c
index 88bf78ad7c..8bbf110d02 100644
--- a/elf/dl-cache.c
+++ b/elf/dl-cache.c
@@ -297,9 +297,6 @@ search_cache (const char *string_table, uint32_t string_table_size,
 
 		      if ((libnew->hwcap & hwcap_exclude) && !named_hwcap)
 			continue;
-		      if (GLRO (dl_osversion)
-			  && libnew->osversion > GLRO (dl_osversion))
-			continue;
 		      if (_DL_PLATFORMS_COUNT
 			  && (libnew->hwcap & _DL_HWCAP_PLATFORM) != 0
 			  && ((libnew->hwcap & _DL_HWCAP_PLATFORM)
diff --git a/elf/dl-diagnostics.c b/elf/dl-diagnostics.c
index d29bdd6904..dd3871b1e0 100644
--- a/elf/dl-diagnostics.c
+++ b/elf/dl-diagnostics.c
@@ -231,10 +231,6 @@ print_version (void)
 void
 _dl_print_diagnostics (char **environ)
 {
-#ifdef HAVE_DL_DISCOVER_OSVERSION
-  _dl_diagnostics_print_labeled_value
-    ("dl_discover_osversion", _dl_discover_osversion ());
-#endif
   _dl_diagnostics_print_labeled_string ("dl_dst_lib", DL_DST_LIB);
   _dl_diagnostics_print_labeled_value ("dl_hwcap", GLRO (dl_hwcap));
   _dl_diagnostics_print_labeled_value ("dl_hwcap_important", HWCAP_IMPORTANT);
@@ -243,7 +239,6 @@ _dl_print_diagnostics (char **environ)
     ("dl_hwcaps_subdirs", _dl_hwcaps_subdirs);
   _dl_diagnostics_print_labeled_value
     ("dl_hwcaps_subdirs_active", _dl_hwcaps_subdirs_active ());
-  _dl_diagnostics_print_labeled_value ("dl_osversion", GLRO (dl_osversion));
   _dl_diagnostics_print_labeled_value ("dl_pagesize", GLRO (dl_pagesize));
   _dl_diagnostics_print_labeled_string ("dl_platform", GLRO (dl_platform));
   _dl_diagnostics_print_labeled_string
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 2fdd612997..2e4a010fc5 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -1591,13 +1591,6 @@ open_verify (const char *name, int fd,
     [EI_OSABI] = ELFOSABI_SYSV,
     [EI_ABIVERSION] = 0
   };
-  static const struct
-  {
-    ElfW(Word) vendorlen;
-    ElfW(Word) datalen;
-    ElfW(Word) type;
-    char vendor[4];
-  } expected_note = { 4, 16, 1, "GNU" };
   /* Initialize it to make the compiler happy.  */
   const char *errstring = NULL;
   int errval = 0;
@@ -1628,10 +1621,7 @@ open_verify (const char *name, int fd,
   if (fd != -1)
     {
       ElfW(Ehdr) *ehdr;
-      ElfW(Phdr) *phdr, *ph;
-      ElfW(Word) *abi_note;
-      ElfW(Word) *abi_note_malloced = NULL;
-      unsigned int osversion;
+      ElfW(Phdr) *phdr;
       size_t maplength;
 
       /* We successfully opened the file.  Now verify it is a file
@@ -1695,13 +1685,16 @@ open_verify (const char *name, int fd,
 #endif
 	      )
 	    errstring = N_("invalid ELF header");
+
 	  else if (ehdr->e_ident[EI_CLASS] != ELFW(CLASS))
 	    {
 	      /* This is not a fatal error.  On architectures where
 		 32-bit and 64-bit binaries can be run this might
 		 happen.  */
 	      *found_other_class = true;
-	      goto close_and_out;
+	      __close_nocancel (fd);
+	      __set_errno (ENOENT);
+	      return -1;
 	    }
 	  else if (ehdr->e_ident[EI_DATA] != byteorder)
 	    {
@@ -1736,7 +1729,11 @@ open_verify (const char *name, int fd,
 	  goto lose;
 	}
       if (! __glibc_likely (elf_machine_matches_host (ehdr)))
-	goto close_and_out;
+	{
+	  __close_nocancel (fd);
+	  __set_errno (ENOENT);
+	  return -1;
+	}
       else if (__glibc_unlikely (ehdr->e_type != ET_DYN
 				 && ehdr->e_type != ET_EXEC))
 	{
@@ -1758,7 +1755,6 @@ open_verify (const char *name, int fd,
 	  if ((size_t) __pread64_nocancel (fd, (void *) phdr, maplength,
 					   ehdr->e_phoff) != maplength)
 	    {
-	    read_error:
 	      errval = errno;
 	      errstring = N_("cannot read file data");
 	      goto lose;
@@ -1768,73 +1764,12 @@ open_verify (const char *name, int fd,
       if (__glibc_unlikely (elf_machine_reject_phdr_p
 			    (phdr, ehdr->e_phnum, fbp->buf, fbp->len,
 			     loader, fd)))
-	goto close_and_out;
-
-      /* 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 || ph->p_align == 8))
-	  {
-	    ElfW(Addr) size = ph->p_filesz;
-
-	    if (ph->p_offset + size <= (size_t) fbp->len)
-	      abi_note = (void *) (fbp->buf + ph->p_offset);
-	    else
-	      {
-		/* Note: __libc_use_alloca is not usable here, because
-		   thread info may not have been set up yet.  */
-		if (size < __MAX_ALLOCA_CUTOFF)
-		  abi_note = alloca (size);
-		else
-		  {
-		    /* There could be multiple PT_NOTEs.  */
-		    abi_note_malloced = realloc (abi_note_malloced, size);
-		    if (abi_note_malloced == NULL)
-		      goto read_error;
-
-		    abi_note = abi_note_malloced;
-		  }
-		if (__pread64_nocancel (fd, (void *) abi_note, size,
-					ph->p_offset) != size)
-		  {
-		    free (abi_note_malloced);
-		    goto read_error;
-		  }
-	      }
-
-	    while (memcmp (abi_note, &expected_note, sizeof (expected_note)))
-	      {
-		ElfW(Addr) note_size
-		  = ELF_NOTE_NEXT_OFFSET (abi_note[0], abi_note[1],
-					  ph->p_align);
-
-		if (size - 32 < note_size)
-		  {
-		    size = 0;
-		    break;
-		  }
-		size -= note_size;
-		abi_note = (void *) abi_note + note_size;
-	      }
-
-	    if (size == 0)
-	      continue;
-
-	    osversion = (abi_note[5] & 0xff) * 65536
-			+ (abi_note[6] & 0xff) * 256
-			+ (abi_note[7] & 0xff);
-	    if (abi_note[4] != __ABI_TAG_OS
-		|| (GLRO(dl_osversion) && GLRO(dl_osversion) < osversion))
-	      {
-	      close_and_out:
-		__close_nocancel (fd);
-		__set_errno (ENOENT);
-		fd = -1;
-	      }
+	{
+	  __close_nocancel (fd);
+	  __set_errno (ENOENT);
+	  return -1;
+	}
 
-	    break;
-	  }
-      free (abi_note_malloced);
     }
 
   return fd;
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 153dd57ad2..1e82e8c554 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -145,8 +145,6 @@ size_t _dl_minsigstacksize = CONSTANT_MINSIGSTKSZ;
 
 int _dl_inhibit_cache;
 
-unsigned int _dl_osversion;
-
 /* All known directories in sorted order.  */
 struct r_search_path_elem *_dl_all_dirs;
 
@@ -327,10 +325,6 @@ _dl_non_dynamic_init (void)
   DL_PLATFORM_INIT;
 #endif
 
-#ifdef DL_OSVERSION_INIT
-  DL_OSVERSION_INIT;
-#endif
-
   /* Now determine the length of the platform string.  */
   if (_dl_platform != NULL)
     _dl_platformlen = strlen (_dl_platform);
diff --git a/elf/rtld.c b/elf/rtld.c
index 3b2e05bf4c..a8cf9daef0 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -384,9 +384,6 @@ struct rtld_global_ro _rtld_global_ro attribute_relro =
     ._dl_error_free = _dl_error_free,
     ._dl_tls_get_addr_soft = _dl_tls_get_addr_soft,
     ._dl_libc_freeres = __rtld_libc_freeres,
-#ifdef HAVE_DL_DISCOVER_OSVERSION
-    ._dl_discover_osversion = _dl_discover_osversion
-#endif
   };
 /* If we would use strong_alias here the compiler would see a
    non-hidden definition.  This would undo the effect of the previous
@@ -1710,10 +1707,6 @@ dl_main (const ElfW(Phdr) *phdr,
   /* With vDSO setup we can initialize the function pointers.  */
   setup_vdso_pointers ();
 
-#ifdef DL_SYSDEP_OSCHECK
-  DL_SYSDEP_OSCHECK (_dl_fatal_printf);
-#endif
-
   /* Initialize the data structures for the search paths for shared
      objects.  */
   call_init_paths (&state);
@@ -2638,14 +2631,6 @@ process_envvars (struct dl_main_state *state)
 	    GLRO(dl_dynamic_weak) = 1;
 	  break;
 
-	case 13:
-	  /* We might have some extra environment variable with length 13
-	     to handle.  */
-#ifdef EXTRA_LD_ENVVARS_13
-	  EXTRA_LD_ENVVARS_13
-#endif
-	  break;
-
 	case 14:
 	  /* Where to place the profiling data file.  */
 	  if (!__libc_enable_secure