public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: Re: Virtual memory leaking through IA32 emulation layer for mmap and munmap
Date: Tue, 09 Mar 2004 00:23:49 +0000	[thread overview]
Message-ID: <16461.3733.809634.212327@napali.hpl.hp.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0403091028060.22838@sutekh.progsoc.uts.edu.au>

>>>>> On Tue, 9 Mar 2004 11:11:04 +1100, Peter Chubb <peter@chubb.wattle.id.au> said:

>>>>> "Shaun" = Shaun  <delius@progsoc.uts.edu.au> writes:
  Shaun> Hi,

  Shaun> Given that getpagesize() is hardcoded in glibc it returns
  Shaun> 4096, the mmap succeeds and the compatibility layers actually
  Shaun> allocate a full page (the kernel in question has PAGE_SHIFT
  Shaun> set to 14 for a page size of 16K).  However the munmap hits
  Shaun> the following bit of code in sys_ia32.c:

  Shaun> asmlinkage long sys32_munmap (unsigned int start, unsigned
  Shaun> int len) { unsigned int end = start + len; long ret; ...
  Shaun> start = PAGE_ALIGN(start); end = PAGE_START(end);

  Shaun> if (start >= end) return 0;

  Peter>  I think thius may be a bug.  From the man page for munmap:

  Peter>    The address start must be a multiple of the page size. All
  Peter> pages con- taining a part of the indicated range are
  Peter> unmapped, and subsequent ref- erences to these pages will
  Peter> generate SIGSEGV. It is not an error if the indicated range
  Peter> does not contain any mapped pages.

  Peter> This follows the SUS, which means that end should be rounded
  Peter> up not down.

Rounded up to the _page-size_ which is 4KB for x86.  In general, you
can't just round up to 16KB for munmap() or all hell will break lose.

	--david

  parent reply	other threads:[~2004-03-09  0:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08 23:43 Virtual memory leaking through IA32 emulation layer for mmap and Shaun
2004-03-08 23:59 ` Virtual memory leaking through IA32 emulation layer for mmap and munmap H. J. Lu
2004-03-09  0:11 ` Peter Chubb
2004-03-09  0:23 ` David Mosberger [this message]
2004-03-09  0:26 ` Virtual memory leaking through IA32 emulation layer for mmap Shaun
2004-03-09  0:57 ` Virtual memory leaking through IA32 emulation layer for mmap and munmap Peter Chubb
2004-03-09  1:04 ` David Mosberger
2004-03-09 20:26 ` Virtual memory leaking through IA32 emulation layer for mmap Arun Sharma
2004-03-09 20:32 ` Arun Sharma
2004-03-10  3:58 ` Virtual memory leaking through IA32 emulation layer for mmap and munmap n0ano
2004-03-10  5:16 ` Virtual memory leaking through IA32 emulation layer for mmap Shaun
2004-03-10 17:47 ` David Mosberger
2004-03-10 19:35 ` Arun Sharma
2004-03-10 19:48 ` David Mosberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16461.3733.809634.212327@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox