mailing list of musl libc
 help / color / mirror / code / Atom feed
From: u-uy74@aetey.se
To: musl@lists.openwall.com
Subject: Re: a possible need for MAP_FIXED in ldso/dynlink.c ?
Date: Sat, 10 Jun 2017 16:32:25 +0200	[thread overview]
Message-ID: <20170610143225.GI30784@example.net> (raw)
In-Reply-To: <20170610122610.GQ1627@brightrain.aerifal.cx>

On Sat, Jun 10, 2017 at 08:26:10AM -0400, Rich Felker wrote:
> On Sat, Jun 10, 2017 at 12:51:51PM +0200, u-uy74@aetey.se wrote:
> > Adding the MAP_FIXED flag, both conditionally or not, seems to work
> > around the particular problem but I am unsure about all its implications
> > and consequences, among others under the current Linux implementation
> > of the Lunux ABI.

> Use of MAP_FIXED with a memory range you don't already own is an
> invalid and unsafe operation. You may end up mapping over top of
> yourself, even.

But the latter should be possible to avoid as long as we know where
ourself is located (?) Or do we?

> Implementations should honor the requested address
> passed to mmap and only fail to provide it if it's already in use.

I did not see this statement anywhere in the mmap() documentation
(and even if I am misinformed, you say "should" not "must").

E.g. http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
says
"When MAP_FIXED is not set, the implementation uses addr in an
implementation-defined manner to arrive at pa."

> applications that don't have a reason for requesting a
> particular address should, and do, pass 0 as the request.

Notwithstanding this, I find the API very unclear about how to
safely check whether the use of a certain address range is impossible
or just differs from the particular "implementation-defined manner"
to derive the returned value.

Does this mean that musl can not implement the explicit dynamic loader
with mere Posix mmap(), only with the "more tightly specified Linux mmap()"?

Regards,
Rune



  reply	other threads:[~2017-06-10 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-10 10:51 u-uy74
2017-06-10 12:26 ` Rich Felker
2017-06-10 14:32   ` u-uy74 [this message]
2017-06-10 15:01     ` Rich Felker
2017-06-10 17:00       ` u-uy74

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=20170610143225.GI30784@example.net \
    --to=u-uy74@aetey.se \
    --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).