> Indeed. Netscape is essentially 32 bit application, so probably
> it treats TASK_UNMAPPED_BASE (0x20000000000) as failure.
> A tad more respect of specified address fixes that.
Iterating over memory areas twice is ugly. Tom, could you please try the
following patch? It should make things better with less ugliness.
-- + Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: macro@ds2.pg.gda.pl, PGP key available +patch-2.4.5-ac8-mmap-7 diff -up --recursive --new-file linux-2.4.5-ac8.macro/arch/ia64/kernel/sys_ia64.c linux-2.4.5-ac8/arch/ia64/kernel/sys_ia64.c --- linux-2.4.5-ac8.macro/arch/ia64/kernel/sys_ia64.c Tue Jun 5 14:22:10 2001 +++ linux-2.4.5-ac8/arch/ia64/kernel/sys_ia64.c Tue Jun 5 14:46:14 2001 @@ -39,11 +39,15 @@ arch_get_unmapped_area (struct file *fil rgn_offset(addr) + len <= RGN_MAP_LIMIT) && (!vmm || addr + len <= vmm->vm_start)) return addr; + if (addr > TASK_UNMAPPED_BASE) + addr = 0; + } + if (!addr) { + if (flags & MAP_SHARED) + addr = COLOR_ALIGN(TASK_UNMAPPED_BASE); + else + addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); } - if (flags & MAP_SHARED) - addr = COLOR_ALIGN(TASK_UNMAPPED_BASE); - else - addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { /* At this point: (!vmm || addr < vmm->vm_end). */ diff -up --recursive --new-file linux-2.4.5-ac8.macro/arch/sparc/kernel/sys_sparc.c linux-2.4.5-ac8/arch/sparc/kernel/sys_sparc.c --- linux-2.4.5-ac8.macro/arch/sparc/kernel/sys_sparc.c Tue Jun 5 14:22:10 2001 +++ linux-2.4.5-ac8/arch/sparc/kernel/sys_sparc.c Tue Jun 5 14:39:49 2001 @@ -69,11 +69,15 @@ unsigned long arch_get_unmapped_area(str if (TASK_SIZE - PAGE_SIZE - len >= addr && (!vmm || addr + len <= vmm->vm_start)) return addr; + if (addr > TASK_UNMAPPED_BASE) + addr = 0; + } + if (!addr) { + if (flags & MAP_SHARED) + addr = COLOUR_ALIGN(TASK_UNMAPPED_BASE); + else + addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); } - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(TASK_UNMAPPED_BASE); - else - addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { /* At this point: (!vmm || addr < vmm->vm_end). */ diff -up --recursive --new-file linux-2.4.5-ac8.macro/arch/sparc64/kernel/sys_sparc.c linux-2.4.5-ac8/arch/sparc64/kernel/sys_sparc.c --- linux-2.4.5-ac8.macro/arch/sparc64/kernel/sys_sparc.c Tue Jun 5 14:22:10 2001 +++ linux-2.4.5-ac8/arch/sparc64/kernel/sys_sparc.c Tue Jun 5 14:44:19 2001 @@ -76,11 +76,15 @@ unsigned long arch_get_unmapped_area(str if (task_size >= addr && (!vmm || addr + len <= vmm->vm_start)) return addr; + if (addr > TASK_UNMAPPED_BASE) + addr = 0; + } + if (!addr) { + if (flags & MAP_SHARED) + addr = COLOUR_ALIGN(TASK_UNMAPPED_BASE); + else + addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); } - if (flags & MAP_SHARED) - addr = COLOUR_ALIGN(TASK_UNMAPPED_BASE); - else - addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) { /* At this point: (!vmm || addr < vmm->vm_end). */ diff -up --recursive --new-file linux-2.4.5-ac8.macro/mm/mmap.c linux-2.4.5-ac8/mm/mmap.c --- linux-2.4.5-ac8.macro/mm/mmap.c Tue Jun 5 14:22:29 2001 +++ linux-2.4.5-ac8/mm/mmap.c Tue Jun 5 14:45:57 2001 @@ -408,8 +408,11 @@ static inline unsigned long arch_get_unm if (TASK_SIZE - len >= addr && (!vma || addr + len <= vma->vm_start)) return addr; + if (addr > TASK_UNMAPPED_BASE) + addr = 0; } - addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); + if (!addr) + addr = PAGE_ALIGN(TASK_UNMAPPED_BASE); for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { /* At this point: (!vma || addr < vma->vm_end). */
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/