User: Password:
|
|
Subscribe / Log in / New account

Prelink and address space randomization

Prelink and address space randomization

Posted Jul 7, 2006 4:10 UTC (Fri) by jamesh (guest, #1159)
In reply to: Prelink and address space randomization by brian
Parent article: Prelink and address space randomization

Most of the library text is shared, yes. But if the library is loaded at different addresses, then the functions and variables will have different memory addresses. So pointers to the functions and variables will need to be fixed up to point at the correct place. This is the relocation process and results in portions of the library text being modified for the app and hence not being shared.

As the article explained, the prelink process tries to do this relocation ahead of time so different apps can use the same library text unmodified (and hence share it completely), but this means that the load addresses of libraries are not randomised between different processes.


(Log in to post comments)

Prelink and address space randomization

Posted Jul 7, 2006 9:39 UTC (Fri) by nix (subscriber, #2304) [Link]

Of course, the kernel could still randomize the load addresses anyway; but if it did that, the benefits of prelink would be entirely negated.

(prelink has sped up a lot recently, did you notice? You no longer have to wait eight thousand years for C++ stuff with lots of symbols to be prelinked...)

Prelink and address space randomization

Posted Jul 7, 2006 16:19 UTC (Fri) by jzbiciak (subscriber, #5246) [Link]

BTW, it's the fact that the same shared copy of the library can be loaded at different addresses for different processes that requires dynamic libraries to use Position Independent Code (PIC).

Now, what might be interesting is a selectively applied address randomization. For instance, tell the kernel that for some list of UIDs, apply address randomization, and for the rest, use a default address map.

So, for instace, an average desktop with eleventy billion programs running the desktop environment, etc., all running as a non-privileged user--those can all benefit from prelink. Any system services running in the background with elevated privileges or a network-facing component, such as sshd, CUPS, a webserver, whatever... those should all run with address randomization.

And, if some program seems to be problematic wrt. to buffer overflows? Perhaps allow marking it to be randomized as well regardless of UID. (Perhaps extended fs attributes are a good way to denote this?)

Prelink and address space randomization

Posted Aug 20, 2006 7:52 UTC (Sun) by bluefoxicy (guest, #25366) [Link]

"portions of the library text" what? That's TEXTRELs. There is a specific set of relocation sections that tell where to make relocations; they're ALL done in the Global Offset Table, which the library text references. TEXTRELs happen only as a result of bugs; rewriting library text is slow. :|

Good try, but read up on how PIC works.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds