Subject: Weird munmap(2) semantic
To: None <>
From: Charles Hannum <>
List: tech-kern
Date: 09/27/2002 15:39:52
In munmap(2), we do this:

         * interesting system call semantic: make sure entire range is
         * allocated before allowing an unmap.
        if (!uvm_map_checkprot(map, addr, addr + size, VM_PROT_NONE)) {
                return (EINVAL);

What is the reason for this?  I found a reference claming that spec
1170 required this, but I also found specific references that say none
of Linux, Solaris or AIX implement it this way.

At the very least, it often causes dlclose(3) to fail to unmap memory,
because the munmap(2) returns EINVAL.  (This happens most often on
platforms other than i386, where the data section page alignment is
large, and there are often unmapped pages between the text and data.)

I'm considering removing this check...