From: mikpe@it.uu.se (Mikael Pettersson)
To: linux-arm-kernel@lists.infradead.org
Subject: mmaping a fixed address fails on ARM
Date: Thu, 13 Jan 2011 10:44:03 +0100 [thread overview]
Message-ID: <19758.51555.797311.465295@pilspetsen.it.uu.se> (raw)
In-Reply-To: <AANLkTim1MOB+r1shuJDvqJexerFo3wQ_o1wQpiaALW=0@mail.gmail.com>
Bryan Wu writes:
> Let me add Andre here
>
> Thanks,
> -Bryan
>
> On Thu, Jan 13, 2011 at 5:58 AM, Bryan Wu <bryan.wu@canonical.com> wrote:
> > Hi Russell,
> >
> > Andre posted a mmap testcase [1] and a bug report [2] for Ubuntu
> > kernel on OMAP4 system, since he is porting some applications from x86
> > to ARM. He testcase works fine on x86, but always fail on ARM. I've
> > tested it on OMAP3/OMAP4/i.MX51.
> >
> > Basically what he want to do is get a mapping on a specific virtual
> > address. But AFAIK, mmap doesn't make sure we can get the mapping
> > address as we want. On x86, it works fine. So if this fails, the
> > application can't run on ARM.
> >
> > The implementation of arch_get_unmapped_area() is different from ARM
> > and x86, that might makes mmap behavior different between ARM and x86.
> > Andre said 2.6.28-versatile. I'm not sure whether it is a regression.
> >
> > [1]: http://launchpadlibrarian.net/61588086/main.c
> > [2]: https://bugs.launchpad.net/ubuntu/+source/linux-ti-omap4/+bug/697004
mmap() with a non-NULL hint referring to a currently unmapped area,
but without MAP_FIXED, isn't even remotely portable or reliable
(I've tried it myself in the context of JITs). It may work on
Linux/x86, but that doesn't allow you to assume it should work
on other OS/CPU combinations (and I know of several where it
emphatically doesn't work).
If you want a fixed address then use MAP_FIXED. If you don't want
MAP_FIXED to clobber an existing mapping then you have to keep track
of existing mappings yourself and avoid them.
What is that "some application"?
/Mikael
next prev parent reply other threads:[~2011-01-13 9:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-12 21:58 mmaping a fixed address fails on ARM Bryan Wu
2011-01-12 22:05 ` Bryan Wu
2011-01-13 9:44 ` Mikael Pettersson [this message]
2011-01-13 22:31 ` Bryan Wu
2011-01-13 11:25 ` Russell King - ARM Linux
2011-01-13 22:34 ` Bryan Wu
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=19758.51555.797311.465295@pilspetsen.it.uu.se \
--to=mikpe@it.uu.se \
--cc=linux-arm-kernel@lists.infradead.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