Quantcast
Channel: Paging and PIC executables - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Answer by duskwuff for Paging and PIC executables

$
0
0

Two major reasons:

  1. Shared libraries. Libraries can't be guaranteed to load at a specific address -- even on a 64-bit system, there's no way to guarantee that every library will have a unique load address which won't collide with any other libraries, or with dynamic memory allocations. As such, code in shared libraries is compiled as PIC so that it can be loaded at any address that it's needed at.

  2. Security. Having specific code present at predictable locations in memory is a security risk, as it enables exploits which jump to short code "gadgets" in memory which can be strung together to perform arbitrary operations. Relocating code randomly at application startup helps defeat these attacks.


Viewing all articles
Browse latest Browse all 3

Trending Articles