Re: Virtual memory leaking through IA32 emulation layer for mmap and munmap

From: <>
Date: 2004-03-10 14:58:01
What Dave said.  I only see 2 solutions to this problem:

1)  Find the preliminary patch I wrote (it's in the email archives,
let me know if you can't find it) and finish it.  It should be
fairly functional but it needs to be made optional, either as a
config option or something at run time.  Most `well behaved' IA32
programs don't need the overhead required to implement that patch.

2)  The easiest solution is to just configure your kernel to use
4K pages.  This might cause some performance degradation for IA64
programs but it should be minor and will definitely solve this

PS: You can read through the email archives to follow the detailed
discussion of this issue but, trust me, there is no easy solution.
Trying to modify the IA32 `mmap' calls to align all requests onto
the kerenl's page size, the obvious solution, will break the way
shared libraries are loaded and then no IA32 programs will run.

On Mon, Mar 08, 2004 at 05:04:47PM -0800, David Mosberger wrote:
> >>>>> On Tue, 9 Mar 2004 11:57:47 +1100, Peter Chubb <> said:
> >>>>> "David" == David Mosberger <> writes:
>   David> Rounded up to the _page-size_ which is 4KB for x86.  In
>   David> general, you can't just round up to 16KB for munmap() or all
>   David> hell will break lose.
>   Peter> As munmap()'s behaviour is undefined on memory that wasn't
>   Peter> allocated with mmap(), rounding to the underlaying true page
>   Peter> size should work for well-behaved programs.
>   Peter>      x = mmap(... 4k ....)  maps a 16k chunk
>   Peter>      munmap(x, 4k) deallocates a 16k chunk, if page_size is
>   Peter> 16k
>   Peter> Of course at present, mmap32 tries to be clever and pretend
>   Peter> PAGE_SIZE is 4k, so it doesn't work...
> All of this is old news and has come up at least twice in the past.
> Don Dugger started to work on a patch to track partial page
> allocations but I believe the patch was never finished.  Please check
> the mail archives for details.
> 	--david
> -
> To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
> the body of a message to
> More majordomo info at

Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
Ph: 303/447-2201
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to
More majordomo info at
Received on Wed Mar 10 00:43:24 2004

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:24 EST