LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-07-2008, 02:50 AM   #1
kailas
LQ Newbie
 
Registered: Jul 2008
Posts: 16

Rep: Reputation: 0
Process Memory Layout on x86_64


Hi

Can someone please let me know how is the process memory layout on x86_64?
Does it load ELFs on the same entry point i.e. 0x8048000?

Thanks in advanced.

Regards,
Kailas
 
Old 08-12-2008, 02:45 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
From what I know the addresses are randomized (to protect from attacks). You can see that effect if you run cat /proc/self/maps (that shows current process memory map) several times.
 
Old 08-13-2008, 03:01 AM   #3
kailas
LQ Newbie
 
Registered: Jul 2008
Posts: 16

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Mara View Post
From what I know the addresses are randomized (to protect from attacks). You can see that effect if you run cat /proc/self/maps (that shows current process memory map) several times.
Does it mean that these executables are fully relocatable?
If yes, is it possible to set this address on the basis of some other policy? Where do I need to put hooks for this?
 
Old 08-16-2008, 11:25 AM   #4
regmee
LQ Newbie
 
Registered: Aug 2008
Posts: 2

Rep: Reputation: 0
x86_64 virtual memory layout with Linux shared memory segment.

Quote:
Originally Posted by kailas View Post

Can someone please let me know how is the process memory layout on x86_64?
Does it load ELFs on the same entry point i.e. 0x8048000?
Hi kailas,

x86-64 uses "canonical form", with 48 bits assigned for virtual address space.
Bits 48 through 63 of any virtual address must be copies of bit 47 , or the
processor will raise an exception. Canonical form addresses run from 0 through
00007FFF`FFFFFFFF, and from FFFF8000`00000000 through FFFFFFFF`FFFFFFFF, for a
total of 256 TB of usable virtual address space.

The virtual address space layout is shown below.

Code:
                   
    ffffffff`ffffffff     _____________   
                          |            |   
                          |  region 2  |   
    ffff8000`00000000     |____________|   
                          |            |   
                          | Unused     |   
                          |  Space     |   
                          |            |   
    00007fff`ffffffff     |____________|   
                          |            |   
                          |   region 1 |   
    00000000`00000000     |____________|

The only NaNs that get included in the Virtual Address Space are the +ve NaNs,
(below is the NaN format)
Code:
     ______________________________________________________________________
    | |                 |                                                  
    |1|  11111111111    |                      Non Zero Fraction (f)       
    |_|_________________|__________________________________________________
    63 62              52 51                                              0
My Question:

We have tried to create a shared memory segment (in Linux). I could attach the
shared memory on addresses that belong to the (Region 1) as shown above.

Code:
#define SEGMENT_SIZE 1000000
for the SEGMENT_SIZE, addresses that could be attached to the segment were ...

0x6ffffffff000 then 0x700000000000 then 0x700000001000 ......
0x7ffffff00000 then 0x7ffffff01000 then 0x7ffffff02000 then 0x7ffffff03000 ..... 0x7ffffff0a000

No addresses beyond this could be attached.

Quote:
(WIKIPEDIA)
many operating systems take the higher-addressed half of the address space
(named kernel space) for themselves and leave the lower-addressed half (user
space) for application code, user mode stacks, heaps, and other data
regions.
Does anyone know why I could not attach an address in the (Region 2 - as shown above) to the
shared memory segment ??

-regmee
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout of Memory KissDaFeetOfSean Programming 3 07-17-2005 10:42 PM
Per-process address space in x86_64? geezjan Red Hat 1 04-07-2005 04:57 AM
Per-process address space in RHEL x86_64? geezjan Linux - Software 0 04-06-2005 01:19 PM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM
G++ memory layout of the classes shibdas Programming 4 09-20-2004 07:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration