Loading binaries and mmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I run a program on machines, say, A and B. The program is (a simple code 
that does nothing) compiled on A and stopped (put to sleep, with getch() 
or something) at the same point. When I examine their address spaces by 
looking /proc/<pid>/maps, I see that some of the vmas are mapped to 
different locations on A and B.

I looked at the code for load_elf_binary in fs/binfmt_elf.c, it is quite 
complicated. Who decides where these segments get mapped? Is it (1) 
load_elf_binary() or (2) mmap() or are they set at (3) compile/link 
time? The (3) seems not, as the program is compiled on A and ran on both.

I learned from Martin Loewis that:

- exact setting of the enviroment variables (in the strict sense of
   execve)
- size, contents, and layout of /etc/ld.so.cache
- path name of each file that is being loaded
- contents of each directory that is searched when loading shared libraries,
   and exact order of entries returned by getdents(2)
- value of cwd string

are some of the factors that affect the location of maps. Is there a way 
to make or guarantee these segments - a process'/library's data segment, 
etc. - get mapped at the same location across machines? Maybe by a 
customized elf binary handler?

-- 
Muzaffer Ozakca
Researcher/Software Engineer  -  muzaffer.ozakca@bilten.metu.edu.tr
TUBITAK-Bilten-ODTU - Communication Systems and Comp. Networks Group
ODTU, Ankara, Turkey
http://www.bilten.metu.edu.tr/   tel: +90-312-210 1311

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux