]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
check-execstack: Permit sysdeps to xfail some libs
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 20 Jul 2018 00:49:44 +0000 (02:49 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Fri, 20 Jul 2018 01:28:14 +0000 (03:28 +0200)
* scripts/check-execstack.awk: Consider `xfail' variable containing a
list
of libraries whose stack executability is expected.
* elf/Makefile ($(objpfx)check-execstack.out): Pass
$(check-execstack-xfail) to check-execstack.awk through `xfail'
variable.
* sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so
libc.so libpthread.so.

ChangeLog
elf/Makefile
scripts/check-execstack.awk
sysdeps/mach/hurd/i386/Makefile

index ace34c0a81422cf817dace52523a4e3bf59c5a90..b45c83ba2b481f41c1fb5312b0ebaf64b9d72a74 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,13 @@
        hidden prototypes.
        * sysdeps/mach/include/mach-shortcuts-hidden.h [!_ISOMAC]: Likewise.
        * sysdeps/mach/include/mach/mach_traps.h [!_ISOMAC]: Likewise.
+       * scripts/check-execstack.awk: Consider `xfail' variable containing a
+       list of libraries whose stack executability is expected.
+       * elf/Makefile ($(objpfx)check-execstack.out): Pass
+       $(check-execstack-xfail) to check-execstack.awk through `xfail'
+       variable.
+       * sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so
+       libc.so libpthread.so.
 
 2018-07-20  Thomas Schwinge  <tschwinge@gnu.org>
 
index 84107f6dbbd6d0225283e2fbccf8bd236a1b824d..cd0771307f90b6d45e8decd46db24dba4ecdb49c 100644 (file)
@@ -1103,7 +1103,7 @@ common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr)
 $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \
                              $(objpfx)execstack-default \
                              $(all-built-dso:=.phdr)
-       LC_ALL=C $(AWK) -f $^ > $@; \
+       LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \
        $(evaluate-test)
 generated += check-execstack.out
 
index 21d37e9f4729c9613ebed696c835355401e2ab2a..cd6b30ed3c3f11ec389976c92da55a23e7809550 100644 (file)
@@ -6,7 +6,12 @@
 # It fails (1) if any did indicate executable stack.
 # It fails (2) if the input did not take the expected form.
 
-BEGIN { result = sanity = 0; default_exec = -1 }
+BEGIN {
+  result = sanity = 0; default_exec = -1;
+  split(xfail, xfails, " ");
+  for (x in xfails)
+    expected_fails[xfails[x] ".phdr"] = 1;
+}
 
 /^execstack-no$/ { default_exec = 0; next }
 /^execstack-yes$/ { default_exec = 1; next }
@@ -17,6 +22,10 @@ function check_one(name) {
     result = 2;
   }
 
+  n = split(name, parts, "/");
+  basename = parts[n];
+  expected_fail = basename in expected_fails;
+
   if (!sanity) {
     print name ": *** input did not look like readelf -l output";
     result = 2;
@@ -24,12 +33,20 @@ function check_one(name) {
     if (stack_line ~ /^.*RW .*$/) {
       print name ": OK";
     } else if (stack_line ~ /^.*E.*$/) {
-      print name ": *** executable stack signaled";
-      result = result ? result : 1;
+      if (expected_fail) {
+       print name ": *** executable stack signaled, expected";
+      } else {
+       print name ": *** executable stack signaled";
+       result = result ? result : 1;
+      }
     }
   } else if (default_exec) {
-    print name ": *** no PT_GNU_STACK entry";
-    result = result ? result : 1;
+    if (expected_fail) {
+      print name ": *** no PT_GNU_STACK entry, expected";
+    } else {
+      print name ": *** no PT_GNU_STACK entry";
+      result = result ? result : 1;
+    }
   } else {
     print name ": no PT_GNU_STACK but default is OK";
   }
index 0b509d94991d11625441f28f92cc8f6a4b924b6a..9a824fadf3772327d6a757a9304b4d4ee56274fc 100644 (file)
@@ -96,3 +96,9 @@ endif
 ifeq ($(subdir),mach)
 test-xfail-check-abi-libmachuser = yes
 endif
+
+ifeq ($(subdir),elf)
+# We do use nested functions involving creation of trampolines, notably for
+# callbacks whose parameters don't permit to get the context parameters.
+check-execstack-xfail += ld.so libc.so libpthread.so
+endif