[Bug 12783] Allocation of PEB and TEB can overlap dll mappings

wine-bugs at winehq.org wine-bugs at winehq.org
Sun May 18 22:16:12 CDT 2008


http://bugs.winehq.org/show_bug.cgi?id=12783


John Reiser <jreiser at BitWagon.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jreiser at BitWagon.com




--- Comment #7 from John Reiser <jreiser at BitWagon.com>  2008-05-18 22:16:12 ---
There is a related underlying problem: the return value of
NtAllocateVirtualMemory() is not checked in 3 places in thread_init()
(dlls/ntdll/thread.c)  If you have a kernel that does not honor the address
given in mmap(addr,...) when !MAP_FIXED [such a kernel is entirely legal; if
!MAP_FIXED then the addr is only a hint] then the return value can be
STATUS_CONFLICTING_ADDRESSES, with no allocation at the requested addr, and NO
UPDATE of addr.  Probably wine will SIGSEGV later.  Not checking the return
value has reduced unnecessarily the precision of error messages, which
lengthens the time to debug and fix the problem.

The declaration of subroutine NtAllocateVirtualMemory ought to be marked with
"__attribute__ ((warn_unused_result))".  Three are 2 places in relay.c, plus 1
in directory.c and 1 in loader.c that also ignore the return value.

The particular case
    addr = (void *)0x7ffe0000;
    size = 0x10000;
    NtAllocateVirtualMemory( NtCurrentProcess(), &addr, 0, &size,
MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE );
    user_shared_data = addr;
probably should have some way to say MAP_FIXED, but I cannot find such a way. 
[Hint: valgrind presents such a kernel that ignores the first argument to
mmap() unless MAP_FIXED.]


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list