Jinoh Kang : server: Fix querying debug port with restricted DACL.

Alexandre Julliard julliard at winehq.org
Thu Dec 9 15:34:27 CST 2021


Module: wine
Branch: master
Commit: 3e2f44300300eb80f1ac1208aac8bc59e5e6131d
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3e2f44300300eb80f1ac1208aac8bc59e5e6131d

Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date:   Wed Dec  8 00:29:02 2021 +0900

server: Fix querying debug port with restricted DACL.

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 not requiring DEBUG_ALL_ACCESS when opening the debug port
object.  Instead, use MAXIMUM_ALLOWED for the access mask.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52184
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/tests/info.c | 4 ----
 server/process.c        | 2 +-
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 9d446c0f872..5bcccd8a322 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -3518,20 +3518,16 @@ static void test_debuggee_dbgport(int argc, char **argv)
 
     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugPort,
                                          &debug_port, sizeof(debug_port), NULL );
-    todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL)
     ok( !status, "NtQueryInformationProcess ProcessDebugPort failed, status %#x.\n", status );
-    todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL)
     ok( debug_port == ~(DWORD_PTR)0, "Expected port %#lx, got %#lx.\n", ~(DWORD_PTR)0, debug_port );
 
     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugFlags,
                                          &debug_flags, sizeof(debug_flags), NULL );
-    todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL)
     ok( !status, "NtQueryInformationProcess ProcessDebugFlags failed, status %#x.\n", status );
 
     expect_status = access ? STATUS_SUCCESS : STATUS_ACCESS_DENIED;
     status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessDebugObjectHandle,
                                          &handle, sizeof(handle), NULL );
-    todo_wine_if(access != DEBUG_ALL_ACCESS && access != GENERIC_ALL)
     ok( status == expect_status, "NtQueryInformationProcess ProcessDebugObjectHandle expected status %#x, actual %#x.\n", expect_status, status );
     if (SUCCEEDED( status )) NtClose( handle );
 
diff --git a/server/process.c b/server/process.c
index 6d794ba5ead..81c94a3c81d 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1528,7 +1528,7 @@ DECL_HANDLER(get_process_debug_info)
 
     reply->debug_children = process->debug_children;
     if (!process->debug_obj) set_error( STATUS_PORT_NOT_SET );
-    else reply->debug = alloc_handle( current->process, process->debug_obj, DEBUG_ALL_ACCESS, 0 );
+    else reply->debug = alloc_handle( current->process, process->debug_obj, MAXIMUM_ALLOWED, 0 );
     release_object( process );
 }
 




More information about the wine-cvs mailing list