about summary refs log tree commit diff homepage
path: root/autoconf
diff options
context:
space:
mode:
authorMartinNowack <martin.nowack@gmail.com>2016-03-06 10:36:47 +0100
committerMartinNowack <martin.nowack@gmail.com>2016-03-06 10:36:47 +0100
commit253796d20214c0886cbc84fbabf0ba4bfd28a8db (patch)
treeabc0a627026a33ccbf6e2bfa58613edd8969debf /autoconf
parentf244db54bfc37f5cc1d831f54c74e818e69bd28c (diff)
parent45d8a085662f7689c0b6978cf2e33845f6095000 (diff)
downloadklee-253796d20214c0886cbc84fbabf0ba4bfd28a8db.tar.gz
Merge pull request #353 from lszekeres/selinux-fix
Fix SELinux signatures in runtime
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac23
1 files changed, 21 insertions, 2 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index bb391329..01c2c809 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -534,12 +534,31 @@ if test "x${have_cap}" = xno; then
 capability checking support for klee-replay.])
 fi
 
-AC_LANG_POP([C])
-
 AC_CHECK_HEADERS([selinux/selinux.h],
         AC_SUBST(HAVE_SELINUX, 1),
         AC_SUBST(HAVE_SELINUX, 0))
 
+if test "$HAVE_SELINUX" = "1"; then
+   # Test what function signature we need to use for SELinux. The signatures
+   # have changed between 2.2 and 2.3. In particular, the type of the "security
+   # context" parameter was changed from char * to const char *, with this
+   # patch: [PATCH] Get rid of security_context_t and fix const declarations.
+   # [http://www.spinics.net/lists/selinux/msg14827.html]
+   AC_CACHE_CHECK([for selinux security context type constness],
+                  [klee_cv_sel_ctx_const],
+   [AC_COMPILE_IFELSE(
+     [AC_LANG_PROGRAM([[
+#include <selinux/selinux.h>
+int setcon(char *context);]])],
+     [klee_cv_sel_ctx_const=''],
+     [klee_cv_sel_ctx_const='const'])])
+   AC_DEFINE_UNQUOTED([KLEE_SELINUX_CTX_CONST], [$klee_cv_sel_ctx_const],
+     [Define to empty or 'const' depending on how SELinux qualifies its
+      security context parameters.])
+fi
+
+AC_LANG_POP([C])
+
 dnl **************************************************************************
 dnl Test for features
 dnl **************************************************************************