Re: allocating >2G in userland

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

 



Hello Hayim...

> int main(int,char**) {
>          unsigned int size = (unsigned int)2 * 1024 *1024 *1024 +
> 1000; char *p;
>
>          p = malloc(size);

Two things you need to be aware of:
1. you are doing malloc(), which is then translated into a request to 
enlarge heap section. Enlarging heap doesn't guarantee that kernel can 
actually provide enough room to store your 2G array when it is 
completely filled. It is simply check whether heap section can be 
enlarged or not...

2. IIRC, FC kernel use 4G/4G VM split. Therefore, you have no problem 
allocating 2G array on user space.

> Using ldd on the "bad" machine I get:
> [root@host1 root]# ldd test_hi_mem
>          linux-gate.so.1 =>  (0x00280000)
>          libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x4e056000)
>          libm.so.6 => /lib/tls/libm.so.6 (0x4d316000)
>          libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x4deb8000)
>          libc.so.6 => /lib/tls/libc.so.6 (0x4d1f3000)
>          /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x4d1da000)
> This suggests that the "bad" machine puts the libraries in the middle
> of the address space. But then I do not understand how any kernel can
> allocate 2G.

If I understand what Arjan said on Redhat magazine, this must be related 
with address space randomization. The goal is clear, makes one almost 
impossible to guess on which offset a library is kept

regards

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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