public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sourceware.org at plagman dot net" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug dynamic-link/15097] New: The loader should avoid writing over already-valid relocations
Date: Mon, 04 Feb 2013 22:18:00 -0000	[thread overview]
Message-ID: <bug-15097-131@http.sourceware.org/bugzilla/> (raw)

http://sourceware.org/bugzilla/show_bug.cgi?id=15097

             Bug #: 15097
           Summary: The loader should avoid writing over already-valid
                    relocations
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: dynamic-link
        AssignedTo: unassigned@sourceware.org
        ReportedBy: sourceware.org@plagman.net
    Classification: Unclassified


When pre-relocating a shared object to a certain base address using `prelink
-r` (and successfully loading it there), the loader will still compute and
overwrite all relocations. This marks the pages of the mapping dirty, triggers
copy-on-write and ends up committing private memory to all processes mapping
that shared object that could otherwise have been cleanly shared.

If the loader did a comparison between the relocation it computed and the
existing contents of the destination before performing the write, this would be
avoided.

I suspect only having such a check for RELATIVE relocations would be sufficient
in practice, but in theory applying it to all types of relocations could
exhibit memory benefits with a small runtime cost.

See this email exchange for more details about the usecase, and the attached
example patch:

http://lists.freedesktop.org/archives/wayland-devel/2012-March/002798.html

http://lists.freedesktop.org/archives/wayland-devel/attachments/20120327/a8bedd3f/attachment.patch

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


             reply	other threads:[~2013-02-04 22:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04 22:18 sourceware.org at plagman dot net [this message]
2013-02-05 11:16 ` [Bug dynamic-link/15097] " schwab@linux-m68k.org
2014-06-13 18:55 ` fweimer at redhat dot com
2024-05-07 11:42 ` fweimer at redhat dot com

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=bug-15097-131@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).