Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20160310210204.4c388872b04be2c4fe6a04f3@asm32.info>
Date: Thu, 10 Mar 2016 21:02:04 +0200
From: John Found <johnfound@...32.info>
To: musl@...ts.openwall.com
Subject: Re: Memory management, how to protect some address space.

On Thu, 10 Mar 2016 11:45:15 -0500
Rich Felker <dalias@...c.org> wrote:

> This is not musl-specific; Linux always does that for 32-bit x86
> binaries running on a 64-bit kernel. You can either run on a 32-bit
> kernel or set the ADDR_LIMIT_3GB personality() flag when running your
> program. Assuming part of the address space is not used is not a
> portable assumption to make, though.
> 
> Rich

Thanks! The sys_personality is exactly what I needed. I simply was not 
aware of this function. Unfortunately the documentation is very poor and when testing it, I have some issues, both with MUSL and Linux.

1. It seems to be MUSL problem - after setting the personality, the first 
several memory allocations from MUSL's malloc function still return addresses
outside the 3GB range. After that it starts to allocate proper addresses. 
The count of the "bad" allocations depends on the size of the allocated blocks.

Is it a bug, or I must call some MUSL re-initialization function?

BTW, this behaviour is not observed with glibc. 

2. The stack of the application remains allocated above 3GB space. It seems to be
Linux issue, but I still will appreciate some help.

Best Regards

-- 
http://fresh.flatassembler.net
http://asm32.info
John Found <johnfound@...32.info>

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.