diff options
author | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-09-25 13:06:43 +0000 |
---|---|---|
committer | lars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-09-25 13:06:43 +0000 |
commit | 8da092e746bd130c88c5c4e754ed98e3a7b26e0e (patch) | |
tree | 15329fcbb839a7c8d93b9d83b5fd76747941f530 /toolchain/uClibc | |
parent | 9c106893832de677d64036ab063a42cc3f968393 (diff) |
Fix a segfault in uclibc ldso.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12698 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'toolchain/uClibc')
-rw-r--r-- | toolchain/uClibc/patches/150-fix-ldso-text-realloc-segfault.patch | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/toolchain/uClibc/patches/150-fix-ldso-text-realloc-segfault.patch b/toolchain/uClibc/patches/150-fix-ldso-text-realloc-segfault.patch new file mode 100644 index 0000000000..ce5fb30460 --- /dev/null +++ b/toolchain/uClibc/patches/150-fix-ldso-text-realloc-segfault.patch @@ -0,0 +1,30 @@ +diff -urN uClibc-0.9.29.old/ldso/ldso/ldso.c uClibc-0.9.29/ldso/ldso/ldso.c +--- uClibc-0.9.29.old/ldso/ldso/ldso.c 2008-09-25 01:02:42.000000000 +0200 ++++ uClibc-0.9.29/ldso/ldso/ldso.c 2008-09-24 23:55:11.000000000 +0200 +@@ -286,15 +286,20 @@ + _dl_debug_early("calling mprotect on the application program\n"); + /* Now cover the application program. */ + if (app_tpnt->dynamic_info[DT_TEXTREL]) { +- ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; +- for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { +- if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) +- _dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & PAGE_ALIGN), +- ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) + +- (unsigned long) ppnt->p_filesz, ++ ElfW(Phdr) *ppnt_inner = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; ++ for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt_inner++) { ++ if (ppnt_inner->p_type == PT_LOAD && !(ppnt_inner->p_flags & PF_W)) ++ _dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt_inner->p_vaddr) & PAGE_ALIGN), ++ ((ppnt_inner->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) + ++ (unsigned long) ppnt_inner->p_filesz, + PROT_READ | PROT_WRITE | PROT_EXEC); + } + } ++#else ++ if (app_tpnt->dynamic_info[DT_TEXTREL]) { ++ _dl_dprintf(_dl_debug_file, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n"); ++ _dl_exit(1); ++} + #endif + + #ifndef ALLOW_ZERO_PLTGOT |