|
From: Oswald, M. <mic...@si...> - 2008-03-21 18:14:06
|
> I would say first that in my view using MAP_FIXED for anything is a > bad idea. It silently replaces or truncates any existing mapping which > overlaps the requested range, but there is no easy way to know beforehand > if this will happened. The only way to use it safely is to have some > way to know what the process' address space layout is, like reading > /proc/self/maps, or in some very specialised situations, as ld.so does. I totally agree with that. The system I am working on was developed by many companies and we proposed a few times to drop POST and use something different, more portable and safe, but the proposal was never accepted. The current approach is, that there is some small test-program, which uses some kind of heuristic to determine an address, which is then fixed with an environment variable. Still a rather lousy approach. > It respects MAP_FIXED if it can, but will reject calls which could > overwrite Valgrind's code or data mappings. So it will likely fail > vs succeed differently on Valgrind than natively. Note that Valgrind > changes the process' address space layout a lot compared to natively, and > so assumptions about what-is-where or what areas are free that might > appear to work natively may not work when running in Valgrind. That's what I was afraid of... > Yes. But, uh, requiring the libraries to load in a particular order > seems to me to be a sign of fragileness. Yes, of course. I think you can imagine, that you run into very funny crashes, if you recompile some of the libraries and forget to import into POST and try to run the system afterwards... Or you add some new library and did forget about the link order... Some people already spent days debugging crashes which were caused on this... > Best thing is to send a small test case which shows the problem. I > read through the rest of the thread but can't see from that enough > info to say anything much else. I don't know, if I am able to strip down the code to something like that. I will try. POST itself is free (http://www.ispras.ru/~knizhnik/post.html). > How does POST deal with address space randomization that modern > kernels commonly do? Even when not using Valgrind, wouldn't address > space randomization cause it problems? Yes. Normally this doesn't represent problems, since the system is only supported for older kernels. I myself did a port to Suse Linux Enterprise Server 10 where I ran exactly into this problem. The solution was quite simple, we added the disable_rand_maps kernel parameter at startup which disables this feature. thanks, Michael |