changed default kernel to 2.6.28.5, it at least runs on
[openwrt.git] / toolchain / uClibc / patches / 150-fix-ldso-text-realloc-segfault.patch
1 diff -urN uClibc-0.9.29.old/ldso/ldso/ldso.c uClibc-0.9.29/ldso/ldso/ldso.c
2 --- uClibc-0.9.29.old/ldso/ldso/ldso.c 2008-09-25 01:02:42.000000000 +0200
3 +++ uClibc-0.9.29/ldso/ldso/ldso.c 2008-09-24 23:55:11.000000000 +0200
4 @@ -286,15 +286,20 @@
5 _dl_debug_early("calling mprotect on the application program\n");
6 /* Now cover the application program. */
7 if (app_tpnt->dynamic_info[DT_TEXTREL]) {
8 - ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
9 - for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) {
10 - if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W))
11 - _dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & PAGE_ALIGN),
12 - ((ppnt->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
13 - (unsigned long) ppnt->p_filesz,
14 + ElfW(Phdr) *ppnt_inner = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val;
15 + for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt_inner++) {
16 + if (ppnt_inner->p_type == PT_LOAD && !(ppnt_inner->p_flags & PF_W))
17 + _dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt_inner->p_vaddr) & PAGE_ALIGN),
18 + ((ppnt_inner->p_vaddr + app_tpnt->loadaddr) & ADDR_ALIGN) +
19 + (unsigned long) ppnt_inner->p_filesz,
20 PROT_READ | PROT_WRITE | PROT_EXEC);
21 }
22 }
23 +#else
24 + if (app_tpnt->dynamic_info[DT_TEXTREL]) {
25 + _dl_dprintf(_dl_debug_file, "Can't modify application's text section; use the GCC option -fPIE for position-independent executables.\n");
26 + _dl_exit(1);
27 +}
28 #endif
29
30 #ifndef ALLOW_ZERO_PLTGOT
This page took 0.059247 seconds and 5 git commands to generate.