]>
Commit | Line | Data |
---|---|---|
2cb32190 | 1 | With latest versions of glibc, a lot of apps failed on a PaX enabled |
2 | system with: | |
3 | cannot enable executable stack as shared object requires: Permission denied | |
4 | ||
5 | This is due to PaX 'exec-protecting' the stack, and ld.so then trying | |
6 | to make the stack executable due to some libraries not containing the | |
7 | PT_GNU_STACK section. Bug #32960. <azarah@gentoo.org> (12 Nov 2003). | |
8 | ||
9 | Patch also NPTL. Bug #116086. <kevquinn@gentoo.org> (20 Dec 2005). | |
10 | ||
11 | --- sysdeps/unix/sysv/linux/dl-execstack.c | |
12 | +++ sysdeps/unix/sysv/linux/dl-execstack.c | |
13 | @@ -63,7 +63,10 @@ | |
5ce64f90 | 14 | else |
7e6493e0 | 15 | # endif |
2cb32190 | 16 | { |
17 | - result = errno; | |
18 | + if (errno == EACCES) /* PAX is enabled */ | |
19 | + result = 0; | |
20 | + else | |
21 | + result = errno; | |
22 | goto out; | |
23 | } | |
e5fc5449 | 24 | } |
2cb32190 | 25 | @@ -89,7 +92,12 @@ |
26 | page -= size; | |
27 | else | |
e5fc5449 | 28 | { |
2cb32190 | 29 | - if (errno != ENOMEM) /* Unexpected failure mode. */ |
30 | + if (errno == EACCES) /* PAX is enabled */ | |
31 | + { | |
32 | + result = 0; | |
33 | + goto out; | |
34 | + } | |
35 | + else if (errno != ENOMEM) /* Unexpected failure mode. */ | |
36 | { | |
37 | result = errno; | |
38 | goto out; | |
39 | @@ -115,7 +123,12 @@ | |
40 | page += size; | |
41 | else | |
e5fc5449 | 42 | { |
2cb32190 | 43 | - if (errno != ENOMEM) /* Unexpected failure mode. */ |
44 | + if (errno == EACCES) /* PAX is enabled */ | |
45 | + { | |
46 | + result = 0; | |
47 | + goto out; | |
48 | + } | |
49 | + else if (errno != ENOMEM) /* Unexpected failure mode. */ | |
50 | { | |
51 | result = errno; | |
52 | goto out; | |
53 | --- nptl/allocatestack.c | |
54 | +++ nptl/allocatestack.c | |
55 | @@ -279,7 +279,8 @@ | |
56 | size_t len = pd->stackblock_size - pd->guardsize; | |
57 | #endif | |
58 | if (mprotect (stack, len, PROT_READ | PROT_WRITE | PROT_EXEC) != 0) | |
59 | - return errno; | |
60 | + if (errno != EACCES) /* PAX is enabled */ | |
61 | + return errno; | |
e5fc5449 | 62 | |
2cb32190 | 63 | return 0; |
64 | } |