lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 6 Oct 2008 11:17:23 +0300
From:	"Kirill A. Shutemov" <kirill@...temov.name>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] x86_64: Implement personality ADDR_LIMIT_32BIT

On Mon, Oct 06, 2008 at 08:13:19AM +0200, Andi Kleen wrote:
> "Kirill A. Shutemov" <kirill@...temov.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@...il:~/tsrc> cat tstack2.c
> #include <stdio.h>
> int main(void)
> {
>         void *p = &p;
>         printf("%p\n", &p);
>         return 0;
> }
> andi@...il:~/tsrc> gcc -m32 tstack2.c  -o tstack2
> andi@...il:~/tsrc> ./tstack2 
> 0xff807d70
> andi@...il:~/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/

Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ