Welcome! Log In Create A New Profile


Stack page holding environment variables invisible in /proc/self/maps

Posted by Kapil Arya 

Our application scans through /proc/self/maps and we find that under an unusual circumstance, the page holding the environment is not displayed in /proc/self/maps even though we can continue to read and write to it. In the buggy version below, we can continue to access contents from the address range <7fffffffe000 - 7ffffffff000> even though it is not in /proc/self/maps. Indeed the value of environ[0] is 0x7fffffffe2cb.

Correct Version:
7ffffffea000-7ffffffff000 rwxp 00000000 00:00 0 [stack]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

Buggy Version:
7ffffffea000-7fffffffe000 rwxp 00000000 00:00 0 [stack]
7ffffffff000-7ffffffff000 rw-p 00000000 00:00 0
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]

It seems to be correlated with a large environment (>3Kcool smiley. As can be noted in the above buggy version, there is an extra anonymouns mapping with size zero. The bug tends to go away in several cases:
- If the environment is small enough.
- If we keep the same environment but replace the Matlab binary with a simple hello world program.

We encountered this in continuing development of our checkpoint-package, DMTCP (http://dmtcp.sourceforge.net). DMTCP does transparent checkpoint-restart with no root-priviledge and with no Kernel mods. We are testing on Matlab (version 7.9). DMTCP never calls mmap(), mprotect() prior to the time when this bug is observed. The bug version is present at the earlier startup of Matlab (even before main() is called). This long happens long before we attempt to checkpoint. We are concerned because we read /proc/self/maps in order to save and later restore the process memory.

DMTCP used LD_PRELOAD to load its own library for checkpointing. The bug seems to be present from the beginning as this library is initialized.

Test environment:
Distro: Ubuntu 9.10 Karmik

bsn89k1:~> uname -a
Linux bsn89k1 2.6.31-22-server #63-Ubuntu SMP Thu Aug 19 01:25:01 UTC 2010 x86_64 GNU/Linux

bsn89k1:~> /lib64/libc.so.6
GNU C Library (EGLIBC) stable release version 2.10.1, by Roland McGrath et al.

DMTCP Developers

Your Email:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 9 plus 14?