]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
2014-03-12 Paul Pluzhnikov <ppluzhnikov@google.com>
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Wed, 12 Mar 2014 22:58:39 +0000 (15:58 -0700)
committerPaul Pluzhnikov <ppluzhnikov@google.com>
Wed, 12 Mar 2014 22:58:39 +0000 (15:58 -0700)
[BZ #16381]

* elf/Makefile (tests): Add tst-pie2.
        (tests-pie): Add tst-pie2.
* elf/tst-pie2.c: New file.
* elf/dl-load.c (_dl_map_object_from_fd): Assert correct l_type
for ET_EXEC.
* elf/rtld.c (map_doit): Load executable as lt_executable.
(dl_main): Likewise.

ChangeLog
NEWS
elf/Makefile
elf/dl-load.c
elf/rtld.c

index defe406d72ec766ac7b0f393208aed118152f2ab..05490349fb88026174a7fdc08a544a1b6cedb672 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-03-12  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       [BZ #16381]
+
+       * elf/Makefile (tests): Add tst-pie2.
+        (tests-pie): Add tst-pie2.
+       * elf/tst-pie2.c: New file.
+       * elf/dl-load.c (_dl_map_object_from_fd): Assert correct l_type
+       for ET_EXEC.
+       * elf/rtld.c (map_doit): Load executable as lt_executable.
+       (dl_main): Likewise.
+
 2014-03-12  Joseph Myers  <joseph@codesourcery.com>
 
        [BZ #16642]
diff --git a/NEWS b/NEWS
index 446ce94ec7fe572ec0e4864ac8c5af78d515c437..e8e7f806949e9d69275908eac0f6a331a7976d2e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -43,9 +43,9 @@ Version 2.19
   16055, 16071, 16072, 16074, 16077, 16078, 16103, 16112, 16143, 16144,
   16146, 16150, 16151, 16153, 16167, 16169, 16172, 16195, 16214, 16245,
   16271, 16274, 16283, 16289, 16293, 16314, 16316, 16330, 16337, 16338,
-  16356, 16365, 16366, 16369, 16372, 16375, 16379, 16384, 16385, 16386,
-  16387, 16390, 16394, 16398, 16400, 16407, 16408, 16414, 16430, 16431,
-  16453, 16474, 16506, 16510, 16529
+  16356, 16365, 16366, 16369, 16372, 16375, 16379, 16381, 16384, 16385,
+  16386, 16387, 16390, 16394, 16398, 16400, 16407, 16408, 16414, 16430,
+  16431, 16453, 16474, 16506, 16510, 16529
 
 * Slovenian translations for glibc messages have been contributed by the
   Translation Project's Slovenian team of translators.
index e31ab920e37bc48389a2c48603616476ba8d63b7..2db3c980da7c107eaf202309fba904fae28ef2fe 100644 (file)
@@ -215,8 +215,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
                tst-array5dep tst-null-argv-lib
 ifeq (yesyes,$(have-fpie)$(build-shared))
 modules-names += tst-piemod1
-tests += tst-pie1
-tests-pie += tst-pie1
+tests += tst-pie1 tst-pie2
+tests-pie += tst-pie1 tst-pie2
 endif
 modules-execstack-yes = tst-execstack-mod
 extra-test-objs += $(addsuffix .os,$(strip $(modules-names)))
@@ -901,6 +901,7 @@ $(objpfx)tst-array5-static-cmp.out: tst-array5-static.exp \
        $(evaluate-test)
 
 CFLAGS-tst-pie1.c += $(pie-ccflag)
+CFLAGS-tst-pie2.c += $(pie-ccflag)
 
 $(objpfx)tst-pie1: $(objpfx)tst-piemod1.so
 
index 6501ff2dca2afb7e474d5204d2b3042709eaca4b..8ebc1285ea32a8cf7646932ee00c11861c6f5820 100644 (file)
@@ -1534,8 +1534,8 @@ cannot enable executable stack as shared object requires");
   /* Signal that we closed the file.  */
   fd = -1;
 
-  if (l->l_type == lt_library && type == ET_EXEC)
-    l->l_type = lt_executable;
+  /* If this is ET_EXEC, we should have loaded it as lt_executable.  */
+  assert (type != ET_EXEC || l->l_type == lt_executable);
 
   l->l_entry += l->l_addr;
 
index 7f1413af08d9a0b0280c2ba58703e12e36a5266e..63e92d30063d8b5b27d65c8cfafa655363dbfaf8 100644 (file)
@@ -623,7 +623,8 @@ static void
 map_doit (void *a)
 {
   struct map_args *args = (struct map_args *) a;
-  args->map = _dl_map_object (args->loader, args->str, lt_library, 0,
+  int type = (args->mode == __RTLD_OPENEXEC) ? lt_executable : lt_library;
+  args->map = _dl_map_object (args->loader, args->str, type, 0,
                              args->mode, LM_ID_BASE);
 }
 
@@ -1075,7 +1076,7 @@ of this helper program; chances are you did not intend to run this program.\n\
       else
        {
          HP_TIMING_NOW (start);
-         _dl_map_object (NULL, rtld_progname, lt_library, 0,
+         _dl_map_object (NULL, rtld_progname, lt_executable, 0,
                          __RTLD_OPENEXEC, LM_ID_BASE);
          HP_TIMING_NOW (stop);