Mail Archives: cygwin/2009/02/27/16:22:22
--------------000701020409080206070409
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Corinna Vinschen wrote:
>> which means that locale.nls extends all the way down to 0x005E1000, so
>> Cwd.dll can't go at 0x00860000.
>
> Hm? Isn't that end_of_mapped_region = mapped_location + mapped_size?
You're right. I was confused by the upside-down chart I was looking at.
> I'm wondering if that's a result of ASLR in Vista. The document
> http://taossa.com.nyud.net:8080/archive/bh08sotirovdowd.pdf describes,
> starting at page 11, a registry key to influence Vista's ASLR behaviour.
> Does that change the behaviour for you?
It *changes* the behavior, but doesn't fix it.
the default case is key not present, or key present and equal to
anything other than 0 or -1/0xffffffff. In this case, only those DLLs
explicitly marked ASLR-compatible are supposed to be relocated --
subject to the other normal relocation rules.
with the registry key set to 0 (disable ASLR, even if the DLL says it is
ASLR-compatible), I get the same behavior as before: can't remap Cwd.dll.
with the registry key set to -1/0xffffffff (force ASLR for all DLLs), I
get slightly different behavior: can't allocate stack. Presumably this
is because cygwin1.dll itself falls victim to relocation in this
situation (verified this by looking at cygwin1.dll's load address).
> If so, there's nothing Cygwin can do against that. In the long run,
> only a native fork() implementation would help.
Well, maybe not! From the document you referenced:
Since Windows relies on relocations instead of position
independent code, a DLL must be loaded at the same address
in each process that uses it to allow the physical memory
used by the DLL to be shared. To facilitate this behaviour,
a global bitmap called _MiImageBitMap is used to represent
the address space from 0x50000000 to 0x78000000. The bitmap
is 0x2800 bits in length with each bit representing 64KB
of memory. As each DLL is loaded, its position is recorded
by setting the appropriate bits in the bitmap to mark the
memory where the DLL is being mapped. When the same DLL
is loaded in another process, its section object is reused
and it is mapped at the same virtual addresses.
So, by marking a particular (or all but cygwin1.dll?) DLL as
ASLR-compatibile, we may be able to coerce the Windows runtime loader
into ensuring that the DLLs are loaded at the same memory location for
all concurrent processes (unless the parent has filled up the space from
0x50000000 to 0x78000000, and so is forced to put an ASLR-compatible DLL
somewhere else that is not tracked by _MiImageBitMap).
I wrote a little utility to explicitly mark a DLL as ASLR-compatible.
Using it on Cwd.dll -- the offending one in my situation -- I was able
to eliminate the problem!
I've created it as a patch to the rebase package: 'aslr.exe' is a
separate utility and doesn't actually use the imagebase library. I've
also modified rebaseall to optionally call it after rebase. It seems to
work okay; I've manually used it on a dozen or so DLLs -- but I'm still
a little nervous about running it on EVERYTHING in my installation,
since it doesn't quite have the history behind it that rebase does.
Another pair of eyes (or dozen) looking at the code would be nice...
Patch attached. Jason?
--
Chuck
--------------000701020409080206070409
Content-Type: application/x-patch;
name="rebase-2.4.4-1.aslr.patch"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="rebase-2.4.4-1.aslr.patch"
ZGlmZiAtTnVhciByZWJhc2UtMi40LjQtMS1vcmlnL0NoYW5nZXMgcmViYXNl
LTIuNC40LTEvQ2hhbmdlcwotLS0gcmViYXNlLTIuNC40LTEtb3JpZy9DaGFu
Z2VzCTIwMDUtMDctMjggMDk6Mjk6NDkuMDAwMDAwMDAwIC0wNDAwCisrKyBy
ZWJhc2UtMi40LjQtMS9DaGFuZ2VzCTIwMDktMDItMjcgMTY6MTM6MzIuMTU2
MzAxMzAwIC0wNTAwCkBAIC0xLDUgKzEsMjQgQEAKICRJZDogQ2hhbmdlcyx2
IDEuMyAyMDA1LzA3LzI4IDEzOjI5OjQ0IGp0IEV4cCAkCiAKKyAgICAqIE5l
dyBhc2xyIHV0aWxpdHkgYWxsb3dzIHRvIG1hbmlwdWxhdGUgdGhlIGZvbGxv
d2luZworICAgICAgZmxhZ3MgaW4gRExMczoKKyAgICAgICAgIC1hIDEgIC0t
PiBFbmFibGUgQWRkcmVzcyBTcGFjZSBMYXlvdXQgUmFuZG9taXphdGlvbgor
ICAgICAgICAgLWEgMCAgLS0+IERpc2FibGUgQWRkcmVzcyBTcGFjZSBMYXlv
dXQgUmFuZG9taXphdGlvbgorICAgICAgICAgLW4gMSAgLS0+IEluZGljYXRl
IHRoYXQgRExMIGlzIGNvbXBhdGlibGUgd2l0aCBERV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sKKyAgICAgIGlmICghc3RhdHVzKQorCWV4aXQgKDIpOwor
ICAgIH0KKworICBleGl0ICgwKTsKK30KKworQk9PTAorZG9fbWFyayAoY29u
c3QgY2hhciAqcGF0aG5hbWUpCit7CisgIEJPT0wgbWFya19hbnkgPSAobWFy
a19hc2xyICE9IDAgfHwgbWFya19ueCAhPSAwIHx8IG1hcmtfdHMgIT0gMCk7
CisgIEJPT0wgc3RhdHVzLCBzdGF0dXMyOworICBCT09MIGhhc19yZWxvY19p
bmZvOworICBXT1JEIG9sZF9kbGxfY2hhcmFjdGVyaXN0aWNzOworICBXT1JE
IG5ld19kbGxfY2hhcmFjdGVyaXN0aWNzOworCisgIC8qIFNraXAgaWYgZmls
ZSBkb2VzIG5vdCBleGlzdCAqLworICBpZiAoYWNjZXNzIChwYXRobmFtZSwg
Rl9PSykgPT0gLTEpCisgICAgeworICAgICAgZnByaW50ZiAoc3RkZXJyLCAi
JXM6IHNraXBwZWQgYmVjYXVzZSBub25leGlzdGVudFxuIiwgcGF0aG5hbWUp
OworICAgICAgcmV0dXJuIFRSVUU7CisgICAgfQorCisgIGlmICghbWFya19h
bnkpCisgICAgeworICAgICAgLyogU2tpcCBpZiBub3Qgd3JpdGFibGUuICov
CisgICAgICBpZiAoYWNjZXNzIChwYXRobmFtZSwgV19PSykgPT0gLTEpCisg
ICAgICAgIHsKKyAgICAgICAgICBmcHJpbnRmIChzdGRlcnIsICIlczogc2tp
cHBlZCBiZWNhdXNlIG5vdCB3cml0YWJsZVxuIiwgcGF0aG5hbWUpOworICAg
ICAgICAgIHJldHVybiBUUlVFOworICAgICAgICB9CisgICAgfQorCisgIGlm
ICghZ2V0X2NoYXJhY3RlcmlzdGljcyAocGF0aG5hbWUsCisgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgJmhhc19yZWxvY19pbmZvLAorICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICZvbGRfZGxsX2NoYXJhY3RlcmlzdGljcykp
CisgICAgeworICAgICAgZnByaW50ZiAoc3RkZXJyLAorICAgICAgICAgICAg
ICAgIiVzOiBza2lwcGVkIGJlY2F1c2UgY291bGQgbm90IHJlYWQgZmlsZSBj
aGFyYWN0ZXJpc3RpY3NcbiIsCisgICAgICAgICAgICAgICBwYXRobmFtZSk7
CisgICAgICByZXR1cm4gVFJVRTsKKyAgICB9CisgIG5ld19kbGxfY2hhcmFj
dGVyaXN0aWNzID0gb2xkX2RsbF9jaGFyYWN0ZXJpc3RpY3M7CisgIAorICBp
ZiAobWFya19hbnkpCisgICAgeworICAgICAgaWYgKGhhc19yZWxvY19pbmZv
KQorICAgICAgICB7CisgICAgICAgICAgaWYgKG1hcmtfYXNsciA+IDApCisg
ICAgICAgICAgICBuZXdfZGxsX2NoYXJhY3RlcmlzdGljcyB8PSBJTUFHRV9E
TExfQ0hBUkFDVEVSSVNUSUNTX0RZTkFNSUNfQkFTRTsKKyAgICAgICAgICBl
bHNlIGlmIChtYXJrX2FzbHIgPCAwKQorICAgICAgICAgICAgbmV3X2RsbF9j
aGFyYWN0ZXJpc3RpY3MgJj0gfklNQUdFX0RMTF9DSEFSQUNURVJJU1RJQ1Nf
RFlOQU1JQ19CQVNFOworICAgIAorICAgICAgICAgIGlmIChtYXJrX254ID4g
MCkKKyAgICAgICAgICAgIG5ld19kbGxfY2hhcmFjdGVyaXN0aWNzIHw9IElN
QUdFX0RMTENIQVJBQ1RFUklTVElDU19OWF9DT01QQVQ7CisgICAgICAgICAg
ZWxzZSBpZiAobWFya19ueCA8IDApCisgICAgICAgICAgICBuZXdfZGxsX2No
YXJhY3RlcmlzdGljcyAmPSB+SU1BR0VfRExMQ0hBUkFDVEVSSVNUSUNTX05Y
X0NPTVBBVDsKKyAgICAKKyAgICAgICAgICBpZiAobWFya190cyA+IDApCisg
ICAgICAgICAgICBuZXdfZGxsX2NoYXJhY3RlcmlzdGljcyB8PSBJTUFHRV9E
TExDSEFSQUNURVJJU1RJQ1NfVEVSTUlOQUxfU0VSVkVSX0FXQVJFOworICAg
ICAgICAgIGVsc2UgaWYgKG1hcmtfdHMgPCAwKQorICAgICAgICAgICAgbmV3
X2RsbF9jaGFyYWN0ZXJpc3RpY3MgJj0gfklNQUdFX0RMTENIQVJBQ1RFUklT
VElDU19URVJNSU5BTF9TRVJWRVJfQVdBUkU7CisgICAKKyAgICAgICAgICBp
ZiAoIXNldF9jaGFyYWN0ZXJpc3RpY3MgKHBhdGhuYW1lLAorICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgbmV3X2RsbF9jaGFyYWN0ZXJp
c3RpY3MpKQorICAgICAgICAgICAgeworICAgICAgICAgICAgICBmcHJpbnRm
IChzdGRlcnIsCisgICAgICAgICAgICAgICAgICAgICAgICIlczogY291bGQg
bm90IHVwZGF0ZSBjaGFyYWN0ZXJpc3RpY3NcbiIsCisgICAgICAgICAgICAg
ICAgICAgICAgIHBhdGhuYW1lKTsKKyAgICAgICAgICAgICAgcmV0dXJuIEZB
TFNFOworICAgICAgICAgICAgfQorICAgICAgICB9CisgICAgICBlbHNlCisg
ICAgICAgIHsKKyAgICAgICAgICBpZiAodmVyYm9zZSkKKyAgICAgICAgICAg
IGZwcmludGYgKHN0ZGVyciwKKyAgICAgICAgICAgICAgICAgICAgICIlczog
c2tpcHBlZCBiZWNhdXNlIGRvZXMgbm90IGNvbnRhaW4gcmVsb2NhdGlvbiBp
bmZvXG4iLAorICAgICAgICAgICAgICAgICAgICAgcGF0aG5hbWUpOworICAg
ICAgICAgIHJldHVybiBUUlVFOworICAgICAgICB9CisgICAgfQorCisgIC8q
IERpc3BsYXkgaW1hZ2UgY2hhcmFjdGVyaXN0aWNzLiAqLworICBpZiAodmVy
Ym9zZSB8fCAhbWFya19hbnkpCisgICAgeworICAgICAgcHJpbnRmICgiJXM6
IG9sZCA9IDB4JTA0eCAlcyVzJXMsIG5ldyA9IDB4JTA0eCAlcyVzJXNcbiIs
IHBhdGhuYW1lLAorICAgICAgICAgICAgICBvbGRfZGxsX2NoYXJhY3Rlcmlz
dGljcywKKyAgICAgICAgICAgICAgZGxsX2NoYXJzX3RvX3N0cmluZyAob2xk
X2RsbF9jaGFyYWN0ZXJpc3RpY3MsCisgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgIElNQUdFX0RMTF9DSEFSQUNURVJJU1RJQ1NfRFlOQU1J
Q19CQVNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAi
Wythc2xyXSIsIlstYXNscl0iKSwKKyAgICAgICAgICAgICAgZGxsX2NoYXJz
X3RvX3N0cmluZyAob2xkX2RsbF9jaGFyYWN0ZXJpc3RpY3MsCisgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgIElNQUdFX0RMTENIQVJBQ1RF
UklTVElDU19OWF9DT01QQVQsCisgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICJbK254XSIsIlstbnhdIiksCisgICAgICAgICAgICAgIGRs
bF9jaGFyc190b19zdHJpbmcgKG9sZF9kbGxfY2hhcmFjdGVyaXN0aWNzLAor
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTUFHRV9ETExD
SEFSQUNURVJJU1RJQ1NfVEVSTUlOQUxfU0VSVkVSX0FXQVJFLAorICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiWyt0c19hd2FyZV0iLCJb
LXRzX2F3YXJlXSIpLAorICAgICAgICAgICAgICBuZXdfZGxsX2NoYXJhY3Rl
cmlzdGljcywKKyAgICAgICAgICAgICAgZGxsX2NoYXJzX3RvX3N0cmluZyAo
bmV3X2RsbF9jaGFyYWN0ZXJpc3RpY3MsCisgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgIElNQUdFX0RMTF9DSEFSQUNURVJJU1RJQ1NfRFlO
QU1JQ19CQVNFLAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAiWythc2xyXSIsIlstYXNscl0iKSwKKyAgICAgICAgICAgICAgZGxsX2No
YXJzX3RvX3N0cmluZyAobmV3X2RsbF9jaGFyYWN0ZXJpc3RpY3MsCisgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIElNQUdFX0RMTENIQVJB
Q1RFUklTVElDU19OWF9DT01QQVQsCisgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICJbK254XSIsIlstbnhdIiksCisgICAgICAgICAgICAg
IGRsbF9jaGFyc190b19zdHJpbmcgKG5ld19kbGxfY2hhcmFjdGVyaXN0aWNz
LAorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBJTUFHRV9E
TExDSEFSQUNURVJJU1RJQ1NfVEVSTUlOQUxfU0VSVkVSX0FXQVJFLAorICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAiWyt0c19hd2FyZV0i
LCJbLXRzX2F3YXJlXSIpKTsKKyAgICB9CisKKyAgcmV0dXJuIFRSVUU7Cit9
CisKK2NvbnN0IGNoYXIgKgorZGxsX2NoYXJzX3RvX3N0cmluZyAoV09SRCBw
ZV9kbGxfY2hhcmFjdGVyaXN0aWNzLAorICAgICAgICAgICAgICAgICAgICAg
V09SRCBmbGFnLAorICAgICAgICAgICAgICAgICAgICAgY29uc3QgY2hhciAq
IHBzdHIsCisgICAgICAgICAgICAgICAgICAgICBjb25zdCBjaGFyICogbnN0
cikKK3sKKyAgaWYgKChwZV9kbGxfY2hhcmFjdGVyaXN0aWNzICYgZmxhZykg
PT0gZmxhZykKKyAgICByZXR1cm4gcHN0cjsKKyAgcmV0dXJuIG5zdHI7Cit9
Cit2b2lkCitwYXJzZV9hcmdzIChpbnQgYXJnYywgY2hhciAqYXJndltdKQor
eworICBjb25zdCBjaGFyICphbk9wdGlvbnMgPSAiOmE6bjp0OlQ6dlYiOwor
ICBpbnQgYW5PcHRpb24gPSAwOworICBCT09MIGJvb2xfdmFsdWU7CisKKyAg
Zm9yIChhbk9wdGlvbjsgKGFuT3B0aW9uID0gZ2V0b3B0IChhcmdjLCBhcmd2
LCBhbk9wdGlvbnMpKSAhPSAtMTspCisgICAgeworICAgICAgc3dpdGNoIChh
bk9wdGlvbikKKwl7CisJY2FzZSAnYSc6CisJICBpZiAoIXN0cmluZ190b19i
b29sIChvcHRhcmcsICZib29sX3ZhbHVlKSkKKyAgICAgICAgICAgIHsKKyAg
ICAgICAgICAgICAgZnByaW50ZiAoc3RkZXJyLCAiSW52YWxpZCBhcmd1bWVu
dCBmb3IgLWE6ICVzXG4iLCBvcHRhcmcpOworCSAgICAgIHVzYWdlICgpOwor
CSAgICAgIGV4aXQgKDEpOworICAgICAgICAgICAgfQorICAgICAgICAgIG1h
cmtfYXNsciA9IChib29sX3ZhbHVlID8gMSA6IC0xKTsKKwkgIGJyZWFrOwor
CWNhc2UgJ24nOgorCSAgaWYgKCFzdHJpbmdfdG9fYm9vbCAob3B0YXJnLCAm
Ym9vbF92YWx1ZSkpCisgICAgICAgICAgICB7CisgICAgICAgICAgICAgIGZw
cmludGYgKHN0ZGVyciwgIkludmFsaWQgYXJndW1lbnQgZm9yIC1uOiAlc1xu
Iiwgb3B0YXJnKTsKKwkgICAgICB1c2FnZSAoKTsKKwkgICAgICBleGl0ICgx
KTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgICBtYXJrX254ID0gKGJvb2xf
dmFsdWUgPyAxIDogLTEpOworCSAgYnJlYWs7CisJY2FzZSAndCc6CisJICBp
ZiAoIXN0cmluZ190b19ib29sIChvcHRhcmcsICZib29sX3ZhbHVlKSkKKyAg
ICAgICAgICAgIHsKKyAgICAgICAgICAgICAgZnByaW50ZiAoc3RkZXJyLCAi
SW52YWxpZCBhcmd1bWVudCBmb3IgLXQ6ICVzXG4iLCBvcHRhcmcpOworCSAg
ICAgIHVzYWdlICgpOworCSAgICAgIGV4aXQgKDEpOworICAgICAgICAgICAg
fQorICAgICAgICAgIG1hcmtfdHMgPSAoYm9vbF92YWx1ZSA/IDEgOiAtMSk7
CisJICBicmVhazsKKwljYXNlICdUJzoKKwkgIGZpbGVfbGlzdCA9IG9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kgCisgICAgICAgICB8fChsZW4gPT0gMSAmJiBz
dHJjYXNlY21wIChzdHJpbmcsICJmIikgPT0gMCkgCisgICAgICAgICB8fChs
ZW4gPT0gMSAmJiBzdHJjYXNlY21wIChzdHJpbmcsICJuIikgPT0gMCkpCisg
ICAgICAgIHsKKyAgICAgICAgICAqdmFsdWUgPSBGQUxTRTsKKyAgICAgICAg
fQorICAgICAgZWxzZQorICAgICAgICB7CisgICAgICAgICAgcmV0dXJuIEZB
TFNFOworICAgICAgICB9CisgICAgfQorICBlbHNlCisgICAgeworICAgICAg
KnZhbHVlID0gKG51bWJlciAhPSAwKTsKKyAgICB9CisgIHJldHVybiBUUlVF
OyAKK30KKworQk9PTAorc3RyaW5nX3RvX3Vsb25nIChjb25zdCBjaGFyICpz
dHJpbmcsIHVuc2lnbmVkIGxvbmcgKnZhbHVlKQoreworICB1bnNpZ25lZCBs
b25nIG51bWJlciA9IDA7CisgIGNoYXIgKiBlbmRwOworICBlcnJubyA9IDA7
CisKKyAgLyogbnVsbCBvciBlbXB0eSBpbnB1dCAqLworICBpZiAoIXN0cmlu
ZyB8fCAhKnN0cmluZykKKyAgICByZXR1cm4gRkFMU0U7CisKKyAgbnVtYmVy
ID0gc3RydG91bCAoc3RyaW5nLCAmZW5kcCwgMCk7CisKKyAgLyogb3V0IG9m
IHJhbmdlICovCisgIGlmIChFUkFOR0UgPT0gZXJybm8pCisgICAgcmV0dXJu
IEZBTFNFOworCisgIC8qIG5vIHZhbGlkIG51bWVyaWMgaW5wdXQgKi8KKyAg
aWYgKGVuZHAgPT0gc3RyaW5nKQorICAgIHJldHVybiBGQUxTRTsKKworICAv
KiBub24tbnVtZXJpYyB0cmFpbGluZyBjaGFyYWN0ZXJzICovCisgIGlmICgq
ZW5kcCAhPSAnXDAnKQorICAgIHJldHVybiBGQUxTRTsKKworICAqdmFsdWUg
PSBudW1iZXI7CisgIHJldHVybiBUUlVFOworfQorCit2b2lkCit1c2FnZSAo
KQoreworICBmcHJpbnRm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Ci0g
ICAgc2VkIC1lICcvY3lnd2luMS5kbGwkL2QnIC1lICdzL14vXC8vJyA+IiRU
bXBGaWxlIgorICAgIHNlZCAtZSAnL2N5Z3dpbjEuZGxsJC9kJyAtZSAnL2N5
Z2xzYTY0LmRsbCQvZCcgLWUgJ3MvXi9cLy8nID4iJFRtcEZpbGUiCiAKICMg
QXBwZW5kIHVzZXIgc3VwcGxpZWQgZmlsZSBsaXN0LCBpZiBhbnkKIGlmIFsg
LW4gIiRGaWxlTGlzdCIgXQpAQCAtMTE4LDYgKzEyNiwxMCBAQAogIyBSZWJh
c2UgZmlsZXMKIHJlYmFzZSAkVmVyYm9zZSAtZCAtYiAkQmFzZUFkZHJlc3Mg
LW8gJE9mZnNldCAtVCAiJFRtcEZpbGUiCiBFeGl0Q29kZT0kPworaWYgdGVz
dCAieCRFeGl0Q29kZSIgPSAieDAiICYmIHRlc3QgLW4gIiREb0FzbHIiCisg
IGFzbHIgJFZlcmJvc2UgJEFzbHJPcHRzIC1UICIkVG1wRmlsZSIKKyAgRXhp
dENvZGU9JD8KK2ZpCiAKICMgQ2xlYW4gdXAKIGNsZWFudXAK
--------------000701020409080206070409
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------000701020409080206070409--
- Raw text -