Lines 175-190
selinux_enabled_check (void)
Link Here
|
175 |
/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ |
175 |
/* On PaX enable kernels that have MPROTECT enable we can't use PROT_EXEC. */ |
176 |
#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX |
176 |
#ifdef FFI_MMAP_EXEC_EMUTRAMP_PAX |
177 |
#include <stdlib.h> |
177 |
#include <stdlib.h> |
|
|
178 |
#include <syslog.h> |
179 |
#define LINE_BUFFER 1024 |
178 |
|
180 |
|
179 |
static int emutramp_enabled = -1; |
181 |
static int emutramp_enabled = -1; |
180 |
|
182 |
|
181 |
static int |
183 |
static int |
182 |
emutramp_enabled_check (void) |
184 |
emutramp_enabled_check (void) |
183 |
{ |
185 |
{ |
184 |
if (getenv ("FFI_DISABLE_EMUTRAMP") == NULL) |
186 |
if (getenv ("FFI_DISABLE_EMUTRAMP") != NULL) |
185 |
return 1; |
|
|
186 |
else |
187 |
return 0; |
187 |
return 0; |
|
|
188 |
FILE *f; |
189 |
char first[LINE_BUFFER], second[LINE_BUFFER]; |
190 |
char conf_line[LINE_BUFFER]; |
191 |
f = fopen("/proc/self/status", "r"); |
192 |
if (f == NULL) |
193 |
{ |
194 |
/* We can't read the needed info from /proc */ |
195 |
/* So log it and make may day. */ |
196 |
syslog (LOG_INFO, "Can't read /proc/self/status"); |
197 |
return 0; |
198 |
} |
199 |
while (fgets (conf_line, LINE_BUFFER, f) ) |
200 |
{ |
201 |
sscanf (conf_line, "%s %s", first, second ); |
202 |
if( !strcmp (first, "PaX:" ) ) |
203 |
{ |
204 |
if( second[1] != 'E' ) |
205 |
syslog (LOG_INFO, "Emutramp in not enable."); |
206 |
fclose (f); |
207 |
return 1; |
208 |
} |
209 |
} |
210 |
fclose (f); |
211 |
return 0; |
188 |
} |
212 |
} |
189 |
|
213 |
|
190 |
#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ |
214 |
#define is_emutramp_enabled() (emutramp_enabled >= 0 ? emutramp_enabled \ |
Lines 197-202
emutramp_enabled_check (void)
Link Here
|
197 |
|
221 |
|
198 |
/* Cygwin is Linux-like, but not quite that Linux-like. */ |
222 |
/* Cygwin is Linux-like, but not quite that Linux-like. */ |
199 |
#define is_selinux_enabled() 0 |
223 |
#define is_selinux_enabled() 0 |
|
|
224 |
#define is_emutramp_enabled() 0 |
200 |
|
225 |
|
201 |
#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ |
226 |
#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ |
202 |
|
227 |
|