From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Andi Kleen <andi@firstfloor.org>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] x86_64: Implement personality ADDR_LIMIT_32BIT
Date: Mon, 6 Oct 2008 11:17:23 +0300 [thread overview]
Message-ID: <20081006081717.GA20072@localhost.localdomain> (raw)
In-Reply-To: <87abdintds.fsf@basil.nowhere.org>
[-- Attachment #1: Type: text/plain, Size: 2024 bytes --]
On Mon, Oct 06, 2008 at 08:13:19AM +0200, Andi Kleen wrote:
> "Kirill A. Shutemov" <kirill@shutemov.name> writes:
> >
> >>
> >> but more generally, we already have ADDR_LIMIT_3GB support on x86.
> >
> > Does ADDR_LIMIT_3GB really work?
>
> As Arjan pointed out it only takes effect on exec()
>
> andi@basil:~/tsrc> cat tstack2.c
> #include <stdio.h>
> int main(void)
> {
> void *p = &p;
> printf("%p\n", &p);
> return 0;
> }
> andi@basil:~/tsrc> gcc -m32 tstack2.c -o tstack2
> andi@basil:~/tsrc> ./tstack2
> 0xff807d70
> andi@basil:~/tsrc> linux32 --3gb ./tstack2
> 0xbfae2840
Which kernel do you use?
Does it work only when compiled with -m32?
$ cat 1.c
#include <stdio.h>
int main(void)
{
void *p = &p;
printf("%p\n", &p);
return 0;
}
$ gcc 1.c
$ linux32 --3gb ./a.out
0x7fffa667e7b8
> >> Why
> >> should support for ADDR_LIMIT_32BIT be added?
> >
> > It's useful for user mode qemu when you try emulate 32-bit target on
> > x86_64. For example, if shmat(2) return addres above 32-bit, target will
> > get SIGSEGV on access to it.
>
> The traditional way in mmap() to handle this is to give it a search
> hint < 4GB and then free the memory again/fail if the result was >4GB.
mmap() has MAP_32BIT flag on x86_64.
> Unfortunately that doesn't work for shmat() because the address argument
> is not a search hint, but a fixed address.
>
> I presume you need this for the qemu syscall emulation. For a standard
> application I would just recommend to use mmap with tmpfs instead
> (sysv shm is kind of obsolete). For shmat() emulation the cleanest way
> would be probably to add a new flag to shmat() that says that address
> is a search hint, not a fixed address. Then implement it the way recommended
> above.
I prefer one handle to switch application to 32-bit address mode. Why is it
wrong?
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ ALT Linux Team, http://www.altlinux.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2008-10-06 8:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-03 7:04 [PATCH] x86_64: Implement personality ADDR_LIMIT_32BIT Kirill A. Shutemov
2008-10-03 8:02 ` Ingo Molnar
2008-10-03 9:25 ` Kirill A. Shutemov
2008-10-03 12:44 ` Arjan van de Ven
2008-10-03 12:58 ` Kirill A. Shutemov
2008-10-06 6:13 ` Andi Kleen
2008-10-06 8:17 ` Kirill A. Shutemov [this message]
2008-10-06 8:42 ` Andi Kleen
2008-10-06 9:17 ` Kirill A. Shutemov
2008-10-06 9:56 ` Andi Kleen
2008-10-06 10:12 ` Kirill A. Shutemov
2008-10-06 13:26 ` Andi Kleen
2008-10-06 14:37 ` [PATCH, RFC] shmat: introduce flag SHM_MAP_HINT Kirill A. Shutemov
2008-10-06 19:29 ` Andi Kleen
2008-10-07 6:57 ` Kirill A. Shutemov
2008-10-07 6:57 ` [PATCH, RFC, v2] " Kirill A. Shutemov
2008-10-07 8:20 ` Andi Kleen
2008-10-07 10:09 ` Kirill A. Shutemov
2008-10-07 11:26 ` Andi Kleen
2008-10-07 11:23 ` Kirill A. Shutemov
2008-10-07 14:38 ` Hugh Dickins
2008-10-07 15:10 ` Andi Kleen
2008-10-07 11:08 ` [PATCH, RFC] " KOSAKI Motohiro
2008-10-07 11:21 ` Andi Kleen
2008-10-07 11:21 ` Kirill A. Shutemov
2008-10-07 11:26 ` KOSAKI Motohiro
2008-10-07 11:30 ` Kirill A. Shutemov
2008-10-07 11:50 ` Andi Kleen
2008-10-07 11:24 ` Kirill A. Shutemov
2008-10-07 12:31 ` Alan Cox
2008-10-07 13:14 ` Andi Kleen
2008-10-03 9:33 ` [PATCH] x86_64: Implement personality ADDR_LIMIT_32BIT Kirill A. Shutemov
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=20081006081717.GA20072@localhost.localdomain \
--to=kirill@shutemov.name \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).