aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac15
-rw-r--r--tests/Makefile.am29
-rw-r--r--tests/gnustack/Makefile.am28
-rw-r--r--tests/gnustack/bad-gnustack.c (renamed from tests/bad-gnustack.c)0
-rw-r--r--tests/gnustack/bad32.asm (renamed from tests/bad32.asm)0
-rw-r--r--tests/gnustack/bad64.asm (renamed from tests/bad64.asm)0
-rw-r--r--tests/pxtpax/Makefile15
-rw-r--r--tests/pxtpax/Makefile.am7
-rw-r--r--tests/pxtpax/daemon.c20
-rwxr-xr-xtests/pxtpax/init.sh40
-rwxr-xr-xtests/pxtpax/test.sh30
11 files changed, 151 insertions, 33 deletions
diff --git a/configure.ac b/configure.ac
index 24508c8..57ca11b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,10 +49,15 @@ AC_TYPE_UINT16_T
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
-AC_CONFIG_FILES([Makefile
- src/Makefile
- scripts/Makefile
- doc/Makefile
- tests/Makefile])
+AC_CONFIG_FILES([
+ Makefile
+ src/Makefile
+ scripts/Makefile
+ doc/Makefile
+ tests/Makefile
+ tests/gnustack/Makefile
+ tests/gnustack/Makefile
+ tests/pxtpax/Makefile
+])
AC_OUTPUT
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b0b054f..9744798 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,28 +1 @@
-noinst_PROGRAMS = bad-gnustack
-bad_gnustack_SOURCES = bad-gnustack.c
-bad_gnustack_DEPENDENCIES = bad-asm.o
-bad_gnustack_LDADD = bad-asm.o
-
-EXTRA_DIST = bad64.asm bad32.asm
-
-ARCH = $(shell uname -m | sed -e 's/i./x/')
-
-bad-asm.o: bad64.asm bad32.asm
- [[ "$(ARCH)" == "x86" ]] && yasm -f elf -m x86 bad32.asm && mv bad32.o bad-asm.o || true
- [[ "$(ARCH)" == "x86_64" ]] && yasm -f elf -m amd64 bad64.asm && mv bad64.o bad-asm.o || true
-
-check_SCRIPTS = test.sh
-TEST = $(check_SCRIPTS)
-
-test.sh:
- @echo "================================================================================"
- @echo
- @echo "Fixing Bad GNU_STACK Elf"
- @../src/fix-gnustack -f bad-gnustack
- @echo
- @echo "Fixed Bad GNU_STACK Elf"
- @../src/fix-gnustack bad-gnustack
- @echo
- @echo "================================================================================"
-
-CLEANFILES = bad-asm.o test.sh
+SUBDIRS = gnustack xtpax
diff --git a/tests/gnustack/Makefile.am b/tests/gnustack/Makefile.am
new file mode 100644
index 0000000..b0b054f
--- /dev/null
+++ b/tests/gnustack/Makefile.am
@@ -0,0 +1,28 @@
+noinst_PROGRAMS = bad-gnustack
+bad_gnustack_SOURCES = bad-gnustack.c
+bad_gnustack_DEPENDENCIES = bad-asm.o
+bad_gnustack_LDADD = bad-asm.o
+
+EXTRA_DIST = bad64.asm bad32.asm
+
+ARCH = $(shell uname -m | sed -e 's/i./x/')
+
+bad-asm.o: bad64.asm bad32.asm
+ [[ "$(ARCH)" == "x86" ]] && yasm -f elf -m x86 bad32.asm && mv bad32.o bad-asm.o || true
+ [[ "$(ARCH)" == "x86_64" ]] && yasm -f elf -m amd64 bad64.asm && mv bad64.o bad-asm.o || true
+
+check_SCRIPTS = test.sh
+TEST = $(check_SCRIPTS)
+
+test.sh:
+ @echo "================================================================================"
+ @echo
+ @echo "Fixing Bad GNU_STACK Elf"
+ @../src/fix-gnustack -f bad-gnustack
+ @echo
+ @echo "Fixed Bad GNU_STACK Elf"
+ @../src/fix-gnustack bad-gnustack
+ @echo
+ @echo "================================================================================"
+
+CLEANFILES = bad-asm.o test.sh
diff --git a/tests/bad-gnustack.c b/tests/gnustack/bad-gnustack.c
index fa7bcf5..fa7bcf5 100644
--- a/tests/bad-gnustack.c
+++ b/tests/gnustack/bad-gnustack.c
diff --git a/tests/bad32.asm b/tests/gnustack/bad32.asm
index 8020ac7..8020ac7 100644
--- a/tests/bad32.asm
+++ b/tests/gnustack/bad32.asm
diff --git a/tests/bad64.asm b/tests/gnustack/bad64.asm
index 1164095..1164095 100644
--- a/tests/bad64.asm
+++ b/tests/gnustack/bad64.asm
diff --git a/tests/pxtpax/Makefile b/tests/pxtpax/Makefile
new file mode 100644
index 0000000..bc2845b
--- /dev/null
+++ b/tests/pxtpax/Makefile
@@ -0,0 +1,15 @@
+
+.PHONY: all
+all: test
+
+.PHONY: test
+test: daemon init.sh test.sh
+ @echo "xattr process"
+ @$(PWD)/test.sh
+
+daemon: daemon.c
+ gcc -o $@ $^
+ paxctl-ng -cv $@
+
+clean:
+ rm -f daemon daemon.pid
diff --git a/tests/pxtpax/Makefile.am b/tests/pxtpax/Makefile.am
new file mode 100644
index 0000000..4770a08
--- /dev/null
+++ b/tests/pxtpax/Makefile.am
@@ -0,0 +1,7 @@
+noinst_PROGRAMS = daemon
+daemon_SOURCES = daemon.c
+
+EXTRA_DIST = init.sh test.sh
+
+check_SCRIPTS = test.sh
+TEST = $(check_SCRIPTS)
diff --git a/tests/pxtpax/daemon.c b/tests/pxtpax/daemon.c
new file mode 100644
index 0000000..3459db9
--- /dev/null
+++ b/tests/pxtpax/daemon.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+int main()
+{
+ pid_t p = fork();
+
+ if(p)
+ printf("%d\n", p);
+ else
+ {
+ close(STDIN_FILENO);
+ close(STDOUT_FILENO);
+ close(STDERR_FILENO);
+ for(;;) sleep(1);
+ }
+
+ exit(0) ;
+}
diff --git a/tests/pxtpax/init.sh b/tests/pxtpax/init.sh
new file mode 100755
index 0000000..4013b29
--- /dev/null
+++ b/tests/pxtpax/init.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+PATH=/sbin:/bin
+
+PWD=$(pwd)
+DAEMON="${PWD}"/daemon
+PIDFILE="${PWD}"/daemon.pid
+
+start()
+{
+ rm -f ${PIDFILE}
+ if [ -e ${DAEMON} ]
+ then
+ PID=$(${DAEMON})
+ if [ "x${PID}" != "x" ]
+ then
+ echo $PID >> ${PIDFILE}
+ fi
+ else
+ echo "No daemon"
+ fi
+}
+
+stop()
+{
+ kill $(cat ${PIDFILE})
+ rm -f ${PIDFILE}
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ *)
+ echo "Usage: $0 start | stop"
+ ;;
+esac
diff --git a/tests/pxtpax/test.sh b/tests/pxtpax/test.sh
new file mode 100755
index 0000000..6db0e4d
--- /dev/null
+++ b/tests/pxtpax/test.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+PWD=$(pwd)
+INITSH="${PWD}"/init.sh
+DAEMON="${PWD}"/daemon
+PIDFILE="${PWD}"/daemon.pid
+
+paxctl-ng -cv ${DAEMON}
+
+for pf in "p" "P"; do
+ for ef in "e" "E"; do
+ for mf in "m" "M"; do
+ for rf in "r" "R"; do
+ for sf in "s" "S"; do
+ flags="${pf}${ef}${mf}${rf}${sf}"
+ echo -n ${flags} " "
+ paxctl-ng -"${flags}" ${DAEMON} 2>&1 1>/dev/null
+ ${INITSH} start
+ if [ -f "${PIDFILE}" ]
+ then
+ rflags=$(cat /proc/$(cat ${PIDFILE})/status | grep ^PaX | awk '{ print $2 }')
+ echo -n ${rflags}
+ ${INITSH} stop
+ fi
+ echo
+ done
+ done
+ done
+ done
+done