From: John Found <johnfound@asm32.info>
To: musl@lists.openwall.com
Subject: Re: Memory management, how to protect some address space.
Date: Thu, 10 Mar 2016 21:02:04 +0200 [thread overview]
Message-ID: <20160310210204.4c388872b04be2c4fe6a04f3@asm32.info> (raw)
In-Reply-To: <20160310164515.GN9349@brightrain.aerifal.cx>
On Thu, 10 Mar 2016 11:45:15 -0500
Rich Felker <dalias@libc.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@asm32.info>
next prev parent reply other threads:[~2016-03-10 19:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-10 8:22 John Found
2016-03-10 16:45 ` Rich Felker
2016-03-10 19:02 ` John Found [this message]
2016-03-10 19:11 ` Rich Felker
2016-03-10 19:23 ` John Found
2016-03-10 19:53 ` Tomasz Sterna
2016-03-10 20:20 ` Rich Felker
2016-03-10 20:24 ` Bryan Hundven
2016-03-10 20:25 ` Alexander Monakov
2016-03-10 22:20 ` John Found
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=20160310210204.4c388872b04be2c4fe6a04f3@asm32.info \
--to=johnfound@asm32.info \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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).