[Bug 37355] Multiple software protection schemes need ntoskrnl ' MmMapLockedPagesSpecifyCache' implementation (Tages Protection v5.x, BattleEye's 'bedaisy.sys')

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Aug 27 23:51:08 CDT 2018


https://bugs.winehq.org/show_bug.cgi?id=37355

--- Comment #21 from Richard Yao <ryao at gentoo.org> ---
To improve on my previous comment, this probably should be implemented as a
wine server service. Upon being asked to do it, the requesting “kernel process”
could block on recvmsg with the wineserver. Then the wineserver could attach
ptrace to the target process and then:

1. Insert the information needed to service the request.
2. Save the registers to a predefined region.
3. Change the instruction pointer to jump into the interrupt handler.

Before finally letting the process continue:

Then the interrupt handler could do the messy stuff that I described
previously, send the file descriptor to the wineserver with sendmsg and resume
execution. Now, the wineserver can simply send the file descriptor to the
“kernel process”.

This makes it easier to handle concurrent usage of this API. Specifically,
calls to the API could be serialized would make implementation easier.

There would be more to it than this (especially when the function is called to
map invalid or already shared memory), but this should be doable as long as the
goal is to simulate a “mmap” that lets you map already existent regions of
memory that pre-existing regions.

Another idea that could also work would be if the wineserver kept file
descriptors for all memory regions mapped into child processes. Then when
shared memory is desired, it could just call dup on the file descriptor, call
lseek on the duplicated file descriptor, send it to the child to mmap and then
close the duplicate on its end. The child could close it too after mmap’ing it.
This would also require keeping track of where everything is mapped with
reference counters, but it would easier to be convinced of correctness and
there would be no issue from having to do memcopy() and worry about whether
this is on memory already shared across multiple processes.

You would have to worry about running out of file-descriptors unless you do a
hack where you let child processes hold onto the file descriptors for the
wineserver until it needs it to bypass the system limit on the maximum number
of file descriptors open by a process.

-- 
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