]> sourceware.org Git - glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Sat, 28 Oct 2000 09:16:32 +0000 (09:16 +0000)
committerUlrich Drepper <drepper@redhat.com>
Sat, 28 Oct 2000 09:16:32 +0000 (09:16 +0000)
2000-10-28  Ulrich Drepper  <drepper@redhat.com>

* elf/dl-load.c (open_verify): Only try to load ET_DYN and ET_EXEC
objects.  Reject all other types.
(_dl_map_object_from_fd): Optimize a bit.

ChangeLog
elf/dl-load.c

index 9fcc7c8d038506c34cebee5903352439390ccc44..c959b8ccc1f53fd47b9778b0338b94b19b965133 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-10-28  Ulrich Drepper  <drepper@redhat.com>
+
+       * elf/dl-load.c (open_verify): Only try to load ET_DYN and ET_EXEC
+       objects.  Reject all other types.
+       (_dl_map_object_from_fd): Optimize a bit.
+
 2000-10-27  Ulrich Drepper  <drepper@redhat.com>
 
        * stdio-common/Makefile (tests): Add tst-fseek.
index ff24463cad624623e7f17c6ad0b9eb7df0f7f7e2..e1a579186fe8aa30abd5929b5e509695a1d15658 100644 (file)
@@ -902,7 +902,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp,
     /* Length of the sections to be loaded.  */
     maplength = loadcmds[nloadcmds - 1].allocend - c->mapstart;
 
-    if (type == ET_DYN || type == ET_REL)
+    if (__builtin_expect (type, ET_DYN) == ET_DYN)
       {
        /* This is a position-independent shared object.  We can let the
           kernel map it anywhere it likes, but we must have space for all
@@ -1279,10 +1279,10 @@ open_verify (const char *name, struct filebuf *fbp)
          /* XXX We should be able so set system specific versions which are
             allowed here.  */
          if (!VALID_ELF_OSABI (ehdr->e_ident[EI_OSABI]))
-           lose (0, fd, name, NULL, NULL, N_("ELF file OS ABI invalid."));
+           lose (0, fd, name, NULL, NULL, N_("ELF file OS ABI invalid"));
          if (!VALID_ELF_ABIVERSION (ehdr->e_ident[EI_ABIVERSION]))
            lose (0, fd, name, NULL, NULL,
-                 N_("ELF file ABI version invalid."));
+                 N_("ELF file ABI version invalid"));
          lose (0, fd, name, NULL, NULL, N_("internal error"));
        }
 
@@ -1300,6 +1300,10 @@ open_verify (const char *name, struct filebuf *fbp)
               != sizeof (ElfW(Phdr)))
        lose (0, fd, name, NULL, NULL,
              N_("ELF file's phentsize not the expected size"));
+      else if (__builtin_expect (ehdr->e_type, ET_DYN) != ET_DYN
+              && __builtin_expect (ehdr->e_type, ET_EXEC) != ET_EXEC)
+       lose (0, fd, name, NULL, NULL,
+             N_("only ET_DYN and ET_EXEC can be loaded"));
     }
 
   return fd;
This page took 0.057369 seconds and 5 git commands to generate.