尼克胡哲有多少钱:My Life, Starting Up: *** fatal error

来源:百度文库 编辑:中财网 时间:2024/05/09 14:08:39

*** fatal error - unable to remap to same address as parent : Cygwin, Ruby on Rails, System calls


I was trying to run system commands from the Ruby console in my Cygwin environment today (since that's part of how I'm integrating with Python). I was running into a helluva problem. I was getting a fatal error, unable to remap .dll to same address as parent. It took a while to track this down and even longer to actually figure out what is happening.

Let me tell you what you can do if you don't care what's actually happening.

1) Close out of Cygwin (and all cygwin processes).
2) Open a Windows command prompt (start -> run - > type 'cmd' or on vista : start -> type 'cmd' in the start search window)
3) Go to your cygwin bin directory. For me it is c:\cygwin\bin.
4) Type ash
5) Type '/usr/bin/rebaseall'
6) Resolve any errors (I had a warning that went unresolved and it still worked fine)
7) Reboot...and you should be good.

So what actually is happening? Well, in this case, the problem was a result of the way windows manages their .dll's. Windows uses ASLR (address space layout randomization) to manage its .dll's. It loads your dll's into different areas of memory every time you boot your computer. If this gets out of whack then the next time you look for that .dll - you can crash your system. Or if you look in the wrong place, you can crash your system. So how can this system get out of whack? Well, running your cygwin setup program can affect record keeping, especially if the ASLR has changed but Cygwin is holding on to an older copy (this can happen when setup doesn't complete).

ASLR is great for malware or hacker defense. Hackers can't constantly try new addresses for your .dll's without crashing your system. Posted by Lefty at 4:15 PM Email ThisBlogThis!Share to TwitterShare to Facebook