On Fri, Mar 27, 2009 at 9:26 AM, Petr Tesarik <ptesarik@suse.cz> wrote:
Jiri Kosina píše v Pá 27. 03. 2009 v 00:21 +0100:
On Thu, 26 Mar 2009, Indu Bhagat wrote:
I have a question regarding the "virtual addresses" returned by the malloc call. When I run the same binary with the same input (implying that the program takes the same path), and pmap dump is the same across program runs (except stack), can something be said about the returned virtual addresses? Given that the process maps are identical (except stack), will they be the same? The behavior I am noticing is that they are the same (I ran the program many times). But this is not sufficient to say that they " will always " be the same. My program does not depend on the returned addresses, its only for some profiling purposes that the answer matters in this context. I have an OpenSuse kernel 2.6.20 with libc version 2.5.
You can't rely on that. I have added full address space randomization (including the randomized location of .text segment for PIE binaries and mmap base for all binaries) to newer kernels for certain architectures.
Yes, that's true, but IMO Indu wants to do some profiling in a well-defined environment, not in _any_ environment. In other words, for that use case it is possible to disable address space randomization by setting /proc/sys/kernel/randomize_va_space to 0.
If you do that before starting your profiling, you may rely on the virtual address space layout. Of course, this is not a good idea for production systems...
Petr Tesarik L3 Prague
Address Space Randomization (/proc/sys/kernel/randomize_va_space) is set to zero on my machine now. But the malloc'd address dump does vary..As I commented earlier, the address space layout is the same (pmap dump). Is there something missing? Thanks Indu -- To unsubscribe, e-mail: opensuse-kernel+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-kernel+help@opensuse.org