diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-06-04 13:01:31 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2016-06-04 13:04:11 +0000 |
commit | ac56fefa23d912357f907fb031d091c08fd9a62a (patch) | |
tree | a8518aa63157f47add2188f1fd955559f4c21003 | |
parent | 77d4586cc47e8f4c02278afbc220145bba0d442b (diff) | |
download | libffi-baserock/pedroalvarez/selinux-disabled-hack.tar.gz |
Disable selinux support (hack)baserock/pedroalvarez/selinux-disabled-hack
-rw-r--r-- | src/closures.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/src/closures.c b/src/closures.c index 6298d6f..71689b2 100644 --- a/src/closures.c +++ b/src/closures.c @@ -123,55 +123,8 @@ #include <sys/mman.h> #define LACKS_SYS_MMAN_H 1 -#if FFI_MMAP_EXEC_SELINUX -#include <sys/statfs.h> -#include <stdlib.h> - -static int selinux_enabled = -1; - -static int -selinux_enabled_check (void) -{ - struct statfs sfs; - FILE *f; - char *buf = NULL; - size_t len = 0; - - if (statfs ("/selinux", &sfs) >= 0 - && (unsigned int) sfs.f_type == 0xf97cff8cU) - return 1; - f = fopen ("/proc/mounts", "r"); - if (f == NULL) - return 0; - while (getline (&buf, &len, f) >= 0) - { - char *p = strchr (buf, ' '); - if (p == NULL) - break; - p = strchr (p + 1, ' '); - if (p == NULL) - break; - if (strncmp (p + 1, "selinuxfs ", 10) == 0) - { - free (buf); - fclose (f); - return 1; - } - } - free (buf); - fclose (f); - return 0; -} - -#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ - : (selinux_enabled = selinux_enabled_check ())) - -#else - #define is_selinux_enabled() 0 -#endif /* !FFI_MMAP_EXEC_SELINUX */ - /* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ #ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX #include <stdlib.h> |