This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug dynamic-link/15097] New: The loader should avoid writing over already-valid relocations


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]