1

If my understanding of the Windows Portable Executable specification is correct, relocation tables are only needed when libraries cannot be loaded at their prefered addresses. Why do some applications (e.g. chrome.exe) contain a relocation table? Are applications not always loaded at their preferred addresses?

mox
  • 6,084
  • 2
  • 23
  • 35

1 Answers1

2

It's for ASLR

AFAIK, current system loader don't relocate .exe files, maybe because it will increase loading time.
However, in next versions of OS, loader will relocate EXEs. (When hardware will be fast enough)

Abyx
  • 12,345
  • 5
  • 44
  • 76
  • As mentioned, as far as I understand the PE Specification, a Relocation table is ONLY needed in a DLL, NOT in an EXE (since an EXE is NEVER relocated !)..ASLR never relocates EXE. – mox Dec 17 '11 at 16:39
  • `.exe` can be relocated too, why not – Abyx Dec 17 '11 at 18:05
  • 1
    Could you add more information about ASLR to this post? Even though you linked to Wikipedia, it'll help others who check this question for an answer. – jwheron Dec 17 '11 at 21:32
  • @Abyx: Could you please explain WHY exe would ever be relocated? Please provide more details and a concrete answer. – mox Dec 18 '11 at 14:57
  • Interesting, So relocation table was brought up after the idea of ASLR ? – daisy Sep 17 '12 at 15:06
  • @warl0ck: No. Relocation tables are primarily there to know which addresses need to have a delta added to them in case the library can't be loaded at its preferred address. They are there at least since Windows NT 3.x: http://msdn.microsoft.com/en-us/library/ms809762.aspx – Sebastian Graf Apr 02 '13 at 21:09