src/closures.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/closures.c b/src/closures.c
index fecbc4a..5d566f2 100644
--- a/src/closures.c
+++ b/src/closures.c
@@ -176,15 +176,32 @@ selinux_enabled_check (void)
 #ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX
 #include <stdlib.h>
 
+#define LINE_BUFFER 1024
 static int emutramp_enabled = -1;
 
 static int
 emutramp_enabled_check (void)
 {
-  if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL)
-    return 1;
-  else
+  FILE *f;
+  char first[LINE_BUFFER], second[LINE_BUFFER];
+  char conf_line[LINE_BUFFER];
+  f  = fopen("/proc/self/status", "r");
+  if (f == NULL)
     return 0;
+  else
+    while( fgets(conf_line, LINE_BUFFER, f) )
+      {
+ 	sscanf(conf_line, "%s %s", first, second );
+	if( !strcmp( first, "PaX" ) )
+	    if( second[1] == 'E' )
+		if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL)
+		  {
+	            fclose (f);
+	            return 1;
+		  }
+      }
+  fclose (f);
+  return 0;
 }
 
 #define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \