diff options
author | kib <kib@FreeBSD.org> | 2011-01-25 21:12:31 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-01-25 21:12:31 +0000 |
commit | 1290d38ac50b3afa7e5781d9d97346a1042c736c (patch) | |
tree | 6b984b52162918ea8254c857cb2d30fd43f83cbf | |
parent | 736c72ab1a257909fc96a743c7c7e9a1e584cbaa (diff) | |
download | FreeBSD-src-1290d38ac50b3afa7e5781d9d97346a1042c736c.zip FreeBSD-src-1290d38ac50b3afa7e5781d9d97346a1042c736c.tar.gz |
When loading dso without PT_GNU_STACK phdr, only call
__pthread_map_stacks_exec() on architectures that allow executable
stacks.
Reported and tested by: marcel (ia64)
-rw-r--r-- | libexec/rtld-elf/amd64/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/arm/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/i386/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/ia64/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/map_object.c | 2 | ||||
-rw-r--r-- | libexec/rtld-elf/mips/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/powerpc/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/powerpc64/rtld_machdep.h | 3 | ||||
-rw-r--r-- | libexec/rtld-elf/rtld.c | 2 | ||||
-rw-r--r-- | libexec/rtld-elf/sparc64/rtld_machdep.h | 3 |
10 files changed, 26 insertions, 2 deletions
diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h index 301eb0c..48d225f 100644 --- a/libexec/rtld-elf/amd64/rtld_machdep.h +++ b/libexec/rtld-elf/amd64/rtld_machdep.h @@ -73,4 +73,7 @@ typedef struct { extern void *__tls_get_addr(tls_index *ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/arm/rtld_machdep.h b/libexec/rtld-elf/arm/rtld_machdep.h index 8364afa..8a1b786 100644 --- a/libexec/rtld-elf/arm/rtld_machdep.h +++ b/libexec/rtld-elf/arm/rtld_machdep.h @@ -69,4 +69,7 @@ void _rtld_bind_start(void); extern void *__tls_get_addr(tls_index *ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h index 9b3dcdf..7d121e4 100644 --- a/libexec/rtld-elf/i386/rtld_machdep.h +++ b/libexec/rtld-elf/i386/rtld_machdep.h @@ -74,4 +74,7 @@ typedef struct { extern void *___tls_get_addr(tls_index *ti) __attribute__((__regparm__(1))); extern void *__tls_get_addr(tls_index *ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/ia64/rtld_machdep.h b/libexec/rtld-elf/ia64/rtld_machdep.h index 5af9602..c47b309 100644 --- a/libexec/rtld-elf/ia64/rtld_machdep.h +++ b/libexec/rtld-elf/ia64/rtld_machdep.h @@ -65,4 +65,7 @@ void call_initfini_pointer(const struct Struct_Obj_Entry *, Elf_Addr); extern void *__tls_get_addr(unsigned long module, unsigned long offset); +#define RTLD_DEFAULT_STACK_PF_EXEC 0 +#define RTLD_DEFAULT_STACK_EXEC 0 + #endif diff --git a/libexec/rtld-elf/map_object.c b/libexec/rtld-elf/map_object.c index 3f69e9b..2b33862 100644 --- a/libexec/rtld-elf/map_object.c +++ b/libexec/rtld-elf/map_object.c @@ -101,7 +101,7 @@ map_object(int fd, const char *path, const struct stat *sb) phdyn = phinterp = phtls = NULL; phdr_vaddr = 0; segs = alloca(sizeof(segs[0]) * hdr->e_phnum); - stack_flags = PF_X | PF_R | PF_W; + stack_flags = RTLD_DEFAULT_STACK_PF_EXEC | PF_R | PF_W; while (phdr < phlimit) { switch (phdr->p_type) { diff --git a/libexec/rtld-elf/mips/rtld_machdep.h b/libexec/rtld-elf/mips/rtld_machdep.h index 8364afa..8a1b786 100644 --- a/libexec/rtld-elf/mips/rtld_machdep.h +++ b/libexec/rtld-elf/mips/rtld_machdep.h @@ -69,4 +69,7 @@ void _rtld_bind_start(void); extern void *__tls_get_addr(tls_index *ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h index bf589c5..4d0dad4 100644 --- a/libexec/rtld-elf/powerpc/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc/rtld_machdep.h @@ -84,4 +84,7 @@ typedef struct { extern void *__tls_get_addr(tls_index* ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h index 3c08ea5..041efe0 100644 --- a/libexec/rtld-elf/powerpc64/rtld_machdep.h +++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h @@ -76,4 +76,7 @@ typedef struct { extern void *__tls_get_addr(tls_index* ti); +#define RTLD_DEFAULT_STACK_PF_EXEC PF_X +#define RTLD_DEFAULT_STACK_EXEC PROT_EXEC + #endif diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8acbdc5..2ed7ea4 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -191,7 +191,7 @@ extern Elf_Dyn _DYNAMIC; int osreldate, pagesize; -static int stack_prot = PROT_READ | PROT_WRITE | PROT_EXEC; +static int stack_prot = PROT_READ | PROT_WRITE | RTLD_DEFAULT_STACK_EXEC; static int max_stack_flags; /* diff --git a/libexec/rtld-elf/sparc64/rtld_machdep.h b/libexec/rtld-elf/sparc64/rtld_machdep.h index a161071..3160391 100644 --- a/libexec/rtld-elf/sparc64/rtld_machdep.h +++ b/libexec/rtld-elf/sparc64/rtld_machdep.h @@ -65,4 +65,7 @@ typedef struct { extern void *__tls_get_addr(tls_index *ti); +#define RTLD_DEFAULT_STACK_PF_EXEC 0 +#define RTLD_DEFAULT_STACK_EXEC 0 + #endif |