[linux-sh:03173] SH7709S linux-2.6.3 SIGV

Yutaro Ebihara <[email protected]> Tue, 24 Feb 2004 15:44:55 +0900
Newsgroups gmane.linux.ports.sh.general
Message-ID <[email protected]>
Hello all.

On my SH7709S board, userland process couldn't run.
in mm/mmap.c:arch_get_unmapped_area()  function,

static inline unsigned long
arch_get_unmapped_area(struct file *filp, unsigned long addr,
                unsigned long len, unsigned long pgoff,
                unsigned long flags)
:snip
if (addr) {
        addr = PAGE_ALIGN(addr);
        vma = find_vma(mm, addr);
        if (TASK_SIZE - len >= addr &&
            (!vma || addr + len <= vma->vm_start))
                return addr;
}
start_addr = addr = mm->free_area_cache;

if addr=0 then addr will be 0x29555555.
and returns 0x29555555


/* Obtain the address to map to. we verify (or select) it and ensure
 * that it represents a valid section of the address space.
 */
 addr = get_unmapped_area(file, addr, len, pgoff, flags);
 if (addr & ~PAGE_MASK)
   return addr;          <------------ returns 0x29555555


in this case, struct_vma (includes 0x29555555) will not creat.
SIGV happens as a result.




I make this patch and my SH7709S board runs well.



--- linux-2.6.3/mm/mmap.c       Wed Feb 18 12:58:32 2004
+++ linux-2.6.3-sh/mm/mmap.c    Tue Feb 24 15:11:02 2004
@@ -737,21 +738,21 @@
        if (len > TASK_SIZE)
                return -ENOMEM;

        if (addr) {
                addr = PAGE_ALIGN(addr);
                vma = find_vma(mm, addr);
                if (TASK_SIZE - len >= addr &&
                    (!vma || addr + len <= vma->vm_start))
                        return addr;
        }
-       start_addr = addr = mm->free_area_cache;
+       start_addr = addr = PAGE_ALIGN(mm->free_area_cache);

 full_search:
        for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
                /* At this point:  (!vma || addr < vma->vm_end). */
                if (TASK_SIZE - len < addr) {