On 12/4/21 19:05, Jinoh Kang wrote:
Today, Wine uses NtQueryInformationProcess/ProcessDebugPort to detect whether the current process is being debugged. If it is, the process issues a breakpoint to yield control to the debugger.
Some debuggers (e.g. latest CDB) appear to create debug handles with restricted DACL, which causes querying debug port to fail with STATUS_ACCESS_DENIED. This results in the debuggee erroneously skipping the initial breakpoint.
Fix this by making retrieval of debug port object handle optional. Also, skip debug port object handle retrieval if serving requests that don't need it (i.e. ProcessDebugPort and ProcessDebugFlags).
So it looks like ProcessDebugPort, ProcessDebugFlags are currently leaking debug object handle? Probably worth fixing as a separate patch.
Then, I suspect that maybe always querying the debug object handle with DEBUG_ALL_ACCESS is what is not quite right at the first place? Shouldn't it maybe return the debug object with available permissions in ProcessDebugObjectHandle? That probably deserves a test, and if that is the case returning the debug object handle with the available permissions will probably fix both the concerned issue and ProcessDebugObjectHandle implementation.
Also, we do not include automatically generated changes (make_requests) in the patches, they are generated during upstream commit.