about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-07-20 02:49:44 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-07-20 03:28:14 +0200
commit2d5c41ded92bf1247ba2a29ad2074cf79dc15669 (patch)
tree9580c356237bb892e525b279d28714eae0aaf9fa /scripts
parent8ba1520e8c72ad0e2a33235625b37002c2715706 (diff)
downloadglibc-2d5c41ded92bf1247ba2a29ad2074cf79dc15669.tar.gz
glibc-2d5c41ded92bf1247ba2a29ad2074cf79dc15669.tar.xz
glibc-2d5c41ded92bf1247ba2a29ad2074cf79dc15669.zip
check-execstack: Permit sysdeps to xfail some libs
	* 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.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/check-execstack.awk27
1 files changed, 22 insertions, 5 deletions
diff --git a/scripts/check-execstack.awk b/scripts/check-execstack.awk
index 21d37e9f47..cd6b30ed3c 100644
--- a/scripts/check-execstack.awk
+++ b/scripts/check-execstack.awk
@@ -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";
   }