Re: do_mmap

Thomas 'Dent' Mirlacher (dent@cosy.sbg.ac.at)
Mon, 3 Jun 2002 22:11:33 +0200 (MET DST)


pavel,

--snip/snip

> While you are at it... fs/binfmt_elf does mmaps but does not check for errors.
> And errors actually do happen there :-(

ok, had a second look.
it does check for errors, using BAD_ADDR which is: if (addr > TASK_SIZE)
and TASK_SIZE on the other hand is PAGE_OFFSET == 0xC0000000 (for x86)

hmm, which means even if we correctly map an area > PAGE_OFFSET, we will
never free the area (well another question is, if we ever try to map
an area > PAGE_OFFSET) - but nevertheless, the check should be before
trying to mmap, and checking for IS_ERR after mmap.

nyone explain what to do if we cannot map the page for MMAP_PAGE_ZERO?
- we just ignore it for now ...

also another instance: if (addr != req_address) - which means if we have
some alignment with mmap - load_elf_library just bails out.
guess we need to munmap also (if no error occured during mmap)

do_brk() is _never_ checked for return (at least in binfm_elf) ... oh
well ...

any comments?

tm

-- 
in some way i do, and in some way i don't.

- 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/