Re: [2/2] ntdll: Allow reading from a VPROT_WRITECOPY protected memory
André Hentschel wrote:
As per tests in kernel32:loader it seems linux&co allows reads on PROT_WRITE areas, but solaris doesn't and crashes. This fixes this issue.
- if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE; + if (vprot & VPROT_WRITECOPY) prot |= PROT_READ | PROT_WRITE;
Do you mean that the recently added test for resource section access mapping crashes on Solaris? If yes, then the fix should be done in different place. -- Dmitry.
On Tue, 6 Sep 2011, Dmitry Timoshkov wrote:
André Hentschel wrote:
As per tests in kernel32:loader it seems linux&co allows reads on PROT_WRITE areas, but solaris doesn't and crashes. This fixes this issue.
- if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE; + if (vprot & VPROT_WRITECOPY) prot |= PROT_READ | PROT_WRITE;
Do you mean that the recently added test for resource section access mapping crashes on Solaris?
The kernel32:loader test was crashing on line 660: ok(!memcmp((const char *)info.BaseAddress, section_data, section.SizeOfRawData), "wrong section data\n"); Further that was just for the following entries: { IMAGE_SCN_MEM_WRITE, PAGE_WRITECOPY }, and { IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_EXECUTE, PAGE_EXECUTE_WRITECOPY },
If yes, then the fix should be done in different place.
What do you suggest? -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ A particle is an irreducible representation of the Poincaré Group - Eugene Wigner
Francois Gouget wrote:
The kernel32:loader test was crashing on line 660:
ok(!memcmp((const char *)info.BaseAddress, section_data, section.SizeOfRawData), "wrong section data\n");
Further that was just for the following entries: { IMAGE_SCN_MEM_WRITE, PAGE_WRITECOPY }, and { IMAGE_SCN_MEM_WRITE | IMAGE_SCN_MEM_EXECUTE, PAGE_EXECUTE_WRITECOPY },
If yes, then the fix should be done in different place.
What do you suggest?
The relevant part of http://source.winehq.org/git/wine.git/commitdiff/3d81e97c753a73646081b1084ad... is - if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_READ|VPROT_WRITE; + if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_WRITECOPY; So, probably restore adding VPROT_READ. I should note, that VPROT_READ not always was there, I added it long time ago for a broken DLL which was crashing on Linux. Perhaps Linux has been fixed since then. -- Dmitry.
On Tue, 6 Sep 2011, Dmitry Timoshkov wrote: [...]
- if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_READ|VPROT_WRITE; + if (sec->Characteristics & IMAGE_SCN_MEM_WRITE) vprot |= VPROT_WRITECOPY;
So, probably restore adding VPROT_READ.
Yep, that works. André, I'll let you do the honors for the patch. -- Francois Gouget <fgouget(a)free.fr> http://fgouget.free.fr/ $live{free} || die "";
participants (2)
-
Dmitry Timoshkov -
Francois Gouget