From f883c66e40ada01c4413c5f33912339f88bd8073 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 25 Apr 2019 18:07:55 +1000 Subject: [PATCH] Updated server-Desktop_Refcount patchset --- ...-desktop-handle-count-more-correctly.patch | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch b/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch index ab7e3b7b..64e68233 100644 --- a/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch +++ b/patches/server-Desktop_Refcount/0002-server-Track-desktop-handle-count-more-correctly.patch @@ -1,7 +1,7 @@ -From eb47d6b708c171ca94c3e6d22a7c783d5d016256 Mon Sep 17 00:00:00 2001 +From 64eb8d1af7948f239a48a47c346445added70a94 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 4 Dec 2015 01:22:29 +0100 -Subject: [PATCH 2/3] server: Track desktop handle count more correctly. +Subject: [PATCH] server: Track desktop handle count more correctly. Desktop objects should stay valid, as long as there is a handle from a (non-system) process. Counting only process->desktop references is not @@ -9,15 +9,15 @@ sufficient in practice, and causes explorer.exe process leaks. Signed-off-by: Sebastian Lackner --- - programs/explorer/desktop.c | 18 +++++++++- + programs/explorer/desktop.c | 18 +++++++- server/handle.c | 3 +- server/handle.h | 2 +- server/process.c | 1 - - server/winstation.c | 88 +++++++++++++++++++++++---------------------- + server/winstation.c | 88 +++++++++++++++++++------------------ 5 files changed, 65 insertions(+), 47 deletions(-) diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c -index 27b9b24..381012a 100644 +index 27b9b24901..381012ac86 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -37,6 +37,8 @@ @@ -54,10 +54,10 @@ index 27b9b24..381012a 100644 } diff --git a/server/handle.c b/server/handle.c -index 4737825..f993a18 100644 +index 879098aee8..0aa5aa52bb 100644 --- a/server/handle.c +++ b/server/handle.c -@@ -498,7 +498,7 @@ obj_handle_t find_inherited_handle( struct process *process, const struct object +@@ -499,7 +499,7 @@ obj_handle_t find_inherited_handle( struct process *process, const struct object /* enumerate handles of a given type */ /* this is needed for window stations and desktops */ obj_handle_t enumerate_handles( struct process *process, const struct object_ops *ops, @@ -66,7 +66,7 @@ index 4737825..f993a18 100644 { struct handle_table *table = process->handles; unsigned int i; -@@ -511,6 +511,7 @@ obj_handle_t enumerate_handles( struct process *process, const struct object_ops +@@ -512,6 +512,7 @@ obj_handle_t enumerate_handles( struct process *process, const struct object_ops if (!entry->ptr) continue; if (entry->ptr->ops != ops) continue; *index = i + 1; @@ -75,7 +75,7 @@ index 4737825..f993a18 100644 } return 0; diff --git a/server/handle.h b/server/handle.h -index f1deb79..1347836 100644 +index f1deb79fb5..13478368fa 100644 --- a/server/handle.h +++ b/server/handle.h @@ -49,7 +49,7 @@ extern obj_handle_t open_object( struct process *process, obj_handle_t parent, u @@ -88,10 +88,10 @@ index f1deb79..1347836 100644 extern struct handle_table *alloc_handle_table( struct process *process, int count ); extern struct handle_table *copy_handle_table( struct process *process, struct process *parent ); diff --git a/server/process.c b/server/process.c -index c1b39f8..7b41ca3 100644 +index e6568ecebb..3221b15da5 100644 --- a/server/process.c +++ b/server/process.c -@@ -838,7 +838,6 @@ static void process_killed( struct process *process ) +@@ -899,7 +899,6 @@ static void process_killed( struct process *process ) assert( list_empty( &process->thread_list )); process->end_time = current_time; @@ -100,7 +100,7 @@ index c1b39f8..7b41ca3 100644 process->desktop = 0; close_process_handles( process ); diff --git a/server/winstation.c b/server/winstation.c -index f0a5287..fde6b68 100644 +index d7e8a5c800..f9c0054962 100644 --- a/server/winstation.c +++ b/server/winstation.c @@ -53,6 +53,7 @@ static unsigned int winstation_map_access( struct object *obj, unsigned int acce @@ -111,16 +111,16 @@ index f0a5287..fde6b68 100644 static int desktop_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void desktop_destroy( struct object *obj ); static unsigned int desktop_map_access( struct object *obj, unsigned int access ); -@@ -76,7 +77,7 @@ static const struct object_ops winstation_ops = +@@ -103,7 +104,7 @@ static const struct object_ops desktop_ops = default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ no_kernel_obj_list, /* get_kernel_obj_list */ - no_alloc_handle, /* alloc_handle */ + desktop_alloc_handle, /* alloc_handle */ - winstation_close_handle, /* close_handle */ - winstation_destroy /* destroy */ + desktop_close_handle, /* close_handle */ + desktop_destroy /* destroy */ }; -@@ -273,14 +274,54 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru +@@ -275,14 +276,54 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru return 1; } @@ -175,7 +175,7 @@ index f0a5287..fde6b68 100644 return 1; } -@@ -288,6 +329,7 @@ static void desktop_destroy( struct object *obj ) +@@ -290,6 +331,7 @@ static void desktop_destroy( struct object *obj ) { struct desktop *desktop = (struct desktop *)obj; @@ -183,7 +183,7 @@ index f0a5287..fde6b68 100644 free_hotkeys( desktop, 0 ); if (desktop->top_window) destroy_window( desktop->top_window ); if (desktop->msg_window) destroy_window( desktop->msg_window ); -@@ -314,40 +356,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access ) +@@ -316,40 +358,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access ) return get_desktop_obj( thread->process, thread->desktop, access ); } @@ -224,7 +224,7 @@ index f0a5287..fde6b68 100644 /* set the process default desktop handle */ void set_process_default_desktop( struct process *process, struct desktop *desktop, obj_handle_t handle ) -@@ -364,12 +372,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt +@@ -366,12 +374,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) if (!thread->desktop) thread->desktop = handle; @@ -237,7 +237,7 @@ index f0a5287..fde6b68 100644 if (old_desktop) release_object( old_desktop ); } -@@ -419,8 +421,8 @@ done: +@@ -421,8 +423,8 @@ done: void close_process_desktop( struct process *process ) { struct desktop *desktop; @@ -249,5 +249,5 @@ index f0a5287..fde6b68 100644 remove_desktop_user( desktop ); release_object( desktop ); -- -1.9.1 +2.20.1