diff --git a/patches/kernel32-Named_Pipe/0009-server-Use-SOCK_SEQPACKET-socket-in-combination-with.patch b/patches/kernel32-Named_Pipe/0009-server-Use-SOCK_SEQPACKET-socket-in-combination-with.patch index 28a7a642..16c0627d 100644 --- a/patches/kernel32-Named_Pipe/0009-server-Use-SOCK_SEQPACKET-socket-in-combination-with.patch +++ b/patches/kernel32-Named_Pipe/0009-server-Use-SOCK_SEQPACKET-socket-in-combination-with.patch @@ -1,4 +1,4 @@ -From 4ae4e05064134eb80698a6cb3c2bfe77a50997c1 Mon Sep 17 00:00:00 2001 +From 6f7aea78c09e8c1ef0e93aef214ac28fe223d544 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 4 Aug 2014 05:01:11 +0200 Subject: server: Use SOCK_SEQPACKET socket in combination with SO_PEEK_OFF to @@ -329,7 +329,7 @@ index eef36ad..420984c 100644 if (needs_close) close( fd ); } diff --git a/server/named_pipe.c b/server/named_pipe.c -index ee6008c..9cc3939 100644 +index 3e1eff0..3d9917f 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -42,6 +42,10 @@ @@ -351,8 +351,8 @@ index ee6008c..9cc3939 100644 #include "handle.h" #include "thread.h" #include "request.h" -@@ -782,14 +787,43 @@ static struct pipe_server *find_available_server( struct named_pipe *pipe ) - return NULL; +@@ -799,14 +804,43 @@ static int named_pipe_link_name( struct object *obj, struct object_name *name, s + return 1; } +/* check if message mode named pipes are supported */ @@ -396,7 +396,7 @@ index ee6008c..9cc3939 100644 if (!(server = find_available_server( pipe ))) { -@@ -808,7 +842,10 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc +@@ -825,7 +859,10 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc if ((client = create_pipe_client( options, pipe->flags ))) { @@ -408,7 +408,7 @@ index ee6008c..9cc3939 100644 { assert( !server->fd ); -@@ -818,32 +855,55 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc +@@ -835,32 +872,55 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc if (is_overlapped( options )) fcntl( fds[1], F_SETFL, O_NONBLOCK ); if (is_overlapped( server->options )) fcntl( fds[0], F_SETFL, O_NONBLOCK ); @@ -483,7 +483,7 @@ index ee6008c..9cc3939 100644 release_object( client ); client = NULL; } -@@ -934,7 +994,7 @@ DECL_HANDLER(create_named_pipe) +@@ -951,7 +1011,7 @@ DECL_HANDLER(create_named_pipe) return; } @@ -492,7 +492,7 @@ index ee6008c..9cc3939 100644 if (!name.len) /* pipes need a root directory even without a name */ { -@@ -1037,6 +1097,9 @@ DECL_HANDLER(set_named_pipe_info) +@@ -1054,6 +1114,9 @@ DECL_HANDLER(set_named_pipe_info) { struct pipe_server *server; struct pipe_client *client = NULL; @@ -502,7 +502,7 @@ index ee6008c..9cc3939 100644 server = get_pipe_server_obj( current->process, req->handle, FILE_WRITE_ATTRIBUTES ); if (!server) -@@ -1063,10 +1126,20 @@ DECL_HANDLER(set_named_pipe_info) +@@ -1080,10 +1143,20 @@ DECL_HANDLER(set_named_pipe_info) else if (client) { client->pipe_flags = server->pipe->flags | req->flags; @@ -524,7 +524,7 @@ index ee6008c..9cc3939 100644 if (client) diff --git a/server/sock.c b/server/sock.c -index 57d3d93..ede97d9 100644 +index a11964f..0a2e079 100644 --- a/server/sock.c +++ b/server/sock.c @@ -61,6 +61,7 @@ @@ -543,7 +543,7 @@ index 57d3d93..ede97d9 100644 static const struct object_ops sock_ops = { -@@ -956,7 +956,7 @@ static int sock_get_ntstatus( int err ) +@@ -958,7 +958,7 @@ static int sock_get_ntstatus( int err ) } /* set the last error depending on errno */ diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index c7177562..b20852e3 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -51,7 +51,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "f55db7882db25019e1af1a497bd7723d10541989" + echo "b21a3240705fdaf9f70a0eb1d2ff4736efcd35c9" } # Show version information @@ -254,6 +254,7 @@ patch_enable_all () enable_server_Desktop_Refcount="$1" enable_server_FileEndOfFileInformation="$1" enable_server_File_Permissions="$1" + enable_server_Fix_Leak="$1" enable_server_Inherited_ACLs="$1" enable_server_Key_State="$1" enable_server_Map_EXDEV_Error="$1" @@ -901,6 +902,9 @@ patch_enable () server-File_Permissions) enable_server_File_Permissions="$2" ;; + server-Fix_Leak) + enable_server_Fix_Leak="$2" + ;; server-Inherited_ACLs) enable_server_Inherited_ACLs="$2" ;; @@ -5401,6 +5405,18 @@ if test "$enable_server_FileEndOfFileInformation" -eq 1; then ) >> "$patchlist" fi +# Patchset server-Fix_Leak +# | +# | Modified files: +# | * server/object.c +# | +if test "$enable_server_Fix_Leak" -eq 1; then + patch_apply server-Fix_Leak/0001-server-Fix-newly-introduced-memory-leak-of-object-na.patch + ( + echo '+ { "Sebastian Lackner", "server: Fix newly introduced memory leak of object name structure.", 1 },'; + ) >> "$patchlist" +fi + # Patchset server-Stored_ACLs # | # | This patchset has the following (direct or indirect) dependencies: @@ -5518,10 +5534,8 @@ fi # | * dlls/ntdll/tests/om.c, server/named_pipe.c, server/object.c # | if test "$enable_server_Pipe_ObjectName" -eq 1; then - patch_apply server-Pipe_ObjectName/0001-server-Link-named-pipes-to-their-device.patch - patch_apply server-Pipe_ObjectName/0002-server-Store-a-reference-to-the-parent-object-for-pi.patch + patch_apply server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch ( - echo '+ { "Sebastian Lackner", "server: Link named pipes to their device.", 1 },'; echo '+ { "Sebastian Lackner", "server: Store a reference to the parent object for pipe servers.", 2 },'; ) >> "$patchlist" fi diff --git a/patches/server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch b/patches/server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch index 10eea1c5..453824b9 100644 --- a/patches/server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch +++ b/patches/server-Desktop_Refcount/0001-server-Introduce-a-new-alloc_handle-object-callback..patch @@ -1,4 +1,4 @@ -From c6d16cb51a12109111ca19308c2062338da82ed4 Mon Sep 17 00:00:00 2001 +From bb902548f15deec4dc9d9eaaf6e78b4cbdb01f87 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 4 Dec 2015 10:36:47 +0100 Subject: server: Introduce a new alloc_handle object callback. (v2) @@ -98,12 +98,12 @@ index 7b92706..fa3aa51 100644 no_destroy /* destroy */ }; diff --git a/server/completion.c b/server/completion.c -index 072bc0a1..909df81 100644 +index 759c6e2..bca0963 100644 --- a/server/completion.c +++ b/server/completion.c @@ -75,6 +75,7 @@ static const struct object_ops completion_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -158,7 +158,7 @@ index 2eb794a..a2c07ba 100644 debug_ctx_destroy /* destroy */ }; diff --git a/server/device.c b/server/device.c -index c6e95b1..8ff6cde 100644 +index a8f6f5d..4fdf7ad 100644 --- a/server/device.c +++ b/server/device.c @@ -81,6 +81,7 @@ static const struct object_ops irp_call_ops = @@ -178,8 +178,8 @@ index c6e95b1..8ff6cde 100644 device_manager_destroy /* destroy */ }; @@ -158,6 +160,7 @@ static const struct object_ops device_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ device_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -194,40 +194,40 @@ index c6e95b1..8ff6cde 100644 device_file_destroy /* destroy */ }; diff --git a/server/directory.c b/server/directory.c -index 56c5bf1..a12fb00 100644 +index 45683b9..445c35c 100644 --- a/server/directory.c +++ b/server/directory.c @@ -67,6 +67,7 @@ static const struct object_ops object_type_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; @@ -102,6 +103,7 @@ static const struct object_ops directory_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ directory_destroy /* destroy */ }; diff --git a/server/event.c b/server/event.c -index cc4ef4f..8325b09 100644 +index c9a0ebb..36ea8fd 100644 --- a/server/event.c +++ b/server/event.c @@ -68,6 +68,7 @@ static const struct object_ops event_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ no_destroy /* destroy */ }; @@ -101,6 +102,7 @@ static const struct object_ops keyed_event_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -339,18 +339,18 @@ index 3a0e4b4..dc653b8 100644 hook_table_destroy /* destroy */ }; diff --git a/server/mailslot.c b/server/mailslot.c -index 9f18083..1c5e0d5 100644 +index a0fa6e2..bff0208 100644 --- a/server/mailslot.c +++ b/server/mailslot.c -@@ -88,6 +88,7 @@ static const struct object_ops mailslot_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -89,6 +89,7 @@ static const struct object_ops mailslot_ops = + mailslot_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ mailslot_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ fd_close_handle, /* close_handle */ mailslot_destroy /* destroy */ }; -@@ -143,6 +144,7 @@ static const struct object_ops mail_writer_ops = +@@ -144,6 +145,7 @@ static const struct object_ops mail_writer_ops = no_link_name, /* link_name */ NULL, /* unlink_name */ no_open_file, /* open_file */ @@ -358,51 +358,51 @@ index 9f18083..1c5e0d5 100644 fd_close_handle, /* close_handle */ mail_writer_destroy /* destroy */ }; -@@ -199,6 +201,7 @@ static const struct object_ops mailslot_device_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -200,6 +202,7 @@ static const struct object_ops mailslot_device_ops = + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ mailslot_device_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ fd_close_handle, /* close_handle */ mailslot_device_destroy /* destroy */ }; diff --git a/server/mapping.c b/server/mapping.c -index 9504996..b2749d2 100644 +index 4384cec..fc6404f 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -94,6 +94,7 @@ static const struct object_ops mapping_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ fd_close_handle, /* close_handle */ mapping_destroy /* destroy */ }; diff --git a/server/mutex.c b/server/mutex.c -index 08a2477..bfa56a7 100644 +index ca0da59..3598ac9 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -71,6 +71,7 @@ static const struct object_ops mutex_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ mutex_destroy /* destroy */ }; diff --git a/server/named_pipe.c b/server/named_pipe.c -index 0bd6064..9eef654 100644 +index 1e4169d..ade9165 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c -@@ -134,6 +134,7 @@ static const struct object_ops named_pipe_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -135,6 +135,7 @@ static const struct object_ops named_pipe_ops = + named_pipe_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ named_pipe_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ named_pipe_destroy /* destroy */ }; -@@ -165,6 +166,7 @@ static const struct object_ops pipe_server_ops = +@@ -166,6 +167,7 @@ static const struct object_ops pipe_server_ops = no_link_name, /* link_name */ NULL, /* unlink_name */ no_open_file, /* open_file */ @@ -410,7 +410,7 @@ index 0bd6064..9eef654 100644 fd_close_handle, /* close_handle */ pipe_server_destroy /* destroy */ }; -@@ -209,6 +211,7 @@ static const struct object_ops pipe_client_ops = +@@ -210,6 +212,7 @@ static const struct object_ops pipe_client_ops = no_link_name, /* link_name */ NULL, /* unlink_name */ no_open_file, /* open_file */ @@ -418,19 +418,19 @@ index 0bd6064..9eef654 100644 fd_close_handle, /* close_handle */ pipe_client_destroy /* destroy */ }; -@@ -257,6 +260,7 @@ static const struct object_ops named_pipe_device_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -258,6 +261,7 @@ static const struct object_ops named_pipe_device_ops = + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ named_pipe_device_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ fd_close_handle, /* close_handle */ named_pipe_device_destroy /* destroy */ }; diff --git a/server/object.c b/server/object.c -index 4f23e0c..c641e4e 100644 +index b8be122..8310067 100644 --- a/server/object.c +++ b/server/object.c -@@ -564,6 +564,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i +@@ -563,6 +563,10 @@ struct object *no_open_file( struct object *obj, unsigned int access, unsigned i return NULL; } @@ -442,7 +442,7 @@ index 4f23e0c..c641e4e 100644 { return 1; /* ok to close */ diff --git a/server/object.h b/server/object.h -index 3d6ba8a..353a9e2 100644 +index c4bc40b..16bf089 100644 --- a/server/object.h +++ b/server/object.h @@ -90,8 +90,10 @@ struct object_ops @@ -457,8 +457,8 @@ index 3d6ba8a..353a9e2 100644 /* destroy on refcount == 0 */ void (*destroy)(struct object *); }; -@@ -150,6 +152,7 @@ extern struct object *no_lookup_name( struct object *obj, struct unicode_str *na - extern int no_link_name( struct object *obj, struct object_name *name, struct object *parent ); +@@ -161,6 +163,7 @@ extern int no_link_name( struct object *obj, struct object_name *name, struct ob + extern void default_unlink_name( struct object *obj, struct object_name *name ); extern struct object *no_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); +extern void no_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle ); @@ -466,7 +466,7 @@ index 3d6ba8a..353a9e2 100644 extern void no_destroy( struct object *obj ); #ifdef DEBUG_OBJECTS diff --git a/server/process.c b/server/process.c -index d51c884..0f37a3b 100644 +index c9bcabb..cc9c01c 100644 --- a/server/process.c +++ b/server/process.c @@ -84,6 +84,7 @@ static const struct object_ops process_ops = @@ -486,8 +486,8 @@ index d51c884..0f37a3b 100644 startup_info_destroy /* destroy */ }; @@ -177,6 +179,7 @@ static const struct object_ops job_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ job_close_handle, /* close_handle */ @@ -538,12 +538,12 @@ index dfa4485..122de96 100644 master_socket_destroy /* destroy */ }; diff --git a/server/semaphore.c b/server/semaphore.c -index 515f49e..a0df7cf 100644 +index c77bd58..9c06ce4 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -68,6 +68,7 @@ static const struct object_ops semaphore_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -606,12 +606,12 @@ index dc10d2a..a11964f 100644 ifchange_destroy /* destroy */ }; diff --git a/server/symlink.c b/server/symlink.c -index 09443b8..a74fa7c 100644 +index bd09d34..6607e47 100644 --- a/server/symlink.c +++ b/server/symlink.c @@ -70,6 +70,7 @@ static const struct object_ops symlink_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -638,12 +638,12 @@ index ca02a8a..71b4d7b 100644 destroy_thread /* destroy */ }; diff --git a/server/timer.c b/server/timer.c -index ef9aa08..c80069a 100644 +index 0d81d90..966d65d 100644 --- a/server/timer.c +++ b/server/timer.c @@ -75,6 +75,7 @@ static const struct object_ops timer_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ no_close_handle, /* close_handle */ @@ -662,20 +662,20 @@ index ca12813..e13d03a 100644 token_destroy /* destroy */ }; diff --git a/server/winstation.c b/server/winstation.c -index 6e1c754..ab3dd05 100644 +index 9dc348d..17c312a 100644 --- a/server/winstation.c +++ b/server/winstation.c -@@ -72,6 +72,7 @@ static const struct object_ops winstation_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -73,6 +73,7 @@ static const struct object_ops winstation_ops = + directory_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ winstation_close_handle, /* close_handle */ winstation_destroy /* destroy */ }; -@@ -95,6 +96,7 @@ static const struct object_ops desktop_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -96,6 +97,7 @@ static const struct object_ops desktop_ops = + desktop_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ desktop_close_handle, /* close_handle */ 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 71561d2f..6ef73440 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,4 +1,4 @@ -From b66d03524b625b22f92f60b1856c7ac89197e809 Mon Sep 17 00:00:00 2001 +From 02981c79c3ad972000fd3f397371f284ce9fade6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 4 Dec 2015 01:22:29 +0100 Subject: server: Track desktop handle count more correctly. @@ -88,7 +88,7 @@ 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 0f37a3b..0bc1edd 100644 +index cc9c01c..b43e1f8 100644 --- a/server/process.c +++ b/server/process.c @@ -838,7 +838,6 @@ static void process_killed( struct process *process ) @@ -100,28 +100,28 @@ index 0f37a3b..0bc1edd 100644 process->desktop = 0; close_process_handles( process ); diff --git a/server/winstation.c b/server/winstation.c -index ab3dd05..9924cbe 100644 +index 17c312a..46ade3b 100644 --- a/server/winstation.c +++ b/server/winstation.c -@@ -50,6 +50,7 @@ static void winstation_destroy( struct object *obj ); - static unsigned int winstation_map_access( struct object *obj, unsigned int access ); +@@ -51,6 +51,7 @@ static unsigned int winstation_map_access( struct object *obj, unsigned int acce static void desktop_dump( struct object *obj, int verbose ); static struct object_type *desktop_get_type( struct object *obj ); + static int desktop_link_name( struct object *obj, struct object_name *name, struct object *parent ); +static void desktop_alloc_handle( struct object *obj, struct process *process, obj_handle_t handle ); 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 ); -@@ -96,7 +97,7 @@ static const struct object_ops desktop_ops = - no_link_name, /* link_name */ - NULL, /* unlink_name */ +@@ -97,7 +98,7 @@ static const struct object_ops desktop_ops = + desktop_link_name, /* link_name */ + default_unlink_name, /* unlink_name */ no_open_file, /* open_file */ - no_alloc_handle, /* alloc_handle */ + desktop_alloc_handle, /* alloc_handle */ desktop_close_handle, /* close_handle */ desktop_destroy /* destroy */ }; -@@ -240,14 +241,54 @@ static struct object_type *desktop_get_type( struct object *obj ) - return get_object_type( &str ); +@@ -253,14 +254,54 @@ static int desktop_link_name( struct object *obj, struct object_name *name, stru + return 1; } +static void close_desktop_timeout( void *private ) @@ -175,7 +175,7 @@ index ab3dd05..9924cbe 100644 return 1; } -@@ -255,6 +296,7 @@ static void desktop_destroy( struct object *obj ) +@@ -268,6 +309,7 @@ static void desktop_destroy( struct object *obj ) { struct desktop *desktop = (struct desktop *)obj; @@ -183,7 +183,7 @@ index ab3dd05..9924cbe 100644 free_hotkeys( desktop, 0 ); if (desktop->top_window) destroy_window( desktop->top_window ); if (desktop->msg_window) destroy_window( desktop->msg_window ); -@@ -282,40 +324,6 @@ struct desktop *get_thread_desktop( struct thread *thread, unsigned int access ) +@@ -294,40 +336,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 ab3dd05..9924cbe 100644 /* set the process default desktop handle */ void set_process_default_desktop( struct process *process, struct desktop *desktop, obj_handle_t handle ) -@@ -332,12 +340,6 @@ void set_process_default_desktop( struct process *process, struct desktop *deskt +@@ -344,12 +352,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 ab3dd05..9924cbe 100644 if (old_desktop) release_object( old_desktop ); } -@@ -387,8 +389,8 @@ done: +@@ -399,8 +401,8 @@ done: void close_process_desktop( struct process *process ) { struct desktop *desktop; diff --git a/patches/server-Fix_Leak/0001-server-Fix-newly-introduced-memory-leak-of-object-na.patch b/patches/server-Fix_Leak/0001-server-Fix-newly-introduced-memory-leak-of-object-na.patch new file mode 100644 index 00000000..16bf88ee --- /dev/null +++ b/patches/server-Fix_Leak/0001-server-Fix-newly-introduced-memory-leak-of-object-na.patch @@ -0,0 +1,24 @@ +From 3d1d0332cc94bdac774643e1adfe987c534e088b Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Fri, 5 Feb 2016 19:07:42 +0100 +Subject: server: Fix newly introduced memory leak of object name structure. + +--- + server/object.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/server/object.c b/server/object.c +index c8098ca..b8be122 100644 +--- a/server/object.c ++++ b/server/object.c +@@ -222,6 +222,7 @@ void *create_object( struct object *parent, const struct object_ops *ops, const + if (!obj->ops->link_name( obj, name_ptr, parent )) + { + free_object( obj ); ++ free( name_ptr ); + return NULL; + } + name_ptr->obj = obj; +-- +2.7.0 + diff --git a/patches/server-Pipe_ObjectName/0001-server-Link-named-pipes-to-their-device.patch b/patches/server-Pipe_ObjectName/0001-server-Link-named-pipes-to-their-device.patch deleted file mode 100644 index e44c9927..00000000 --- a/patches/server-Pipe_ObjectName/0001-server-Link-named-pipes-to-their-device.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8ff87be88de81b45327a9fc0eeacbc357544be20 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Mon, 17 Aug 2015 01:10:10 +0200 -Subject: server: Link named pipes to their device. - ---- - server/named_pipe.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/server/named_pipe.c b/server/named_pipe.c -index 53bec02..0ce3e59 100644 ---- a/server/named_pipe.c -+++ b/server/named_pipe.c -@@ -743,7 +743,7 @@ static struct named_pipe *create_named_pipe( struct directory *root, const struc - else - { - struct named_pipe_device *dev = (struct named_pipe_device *)obj; -- if ((pipe = create_object( dev->pipes, &named_pipe_ops, &new_name, NULL ))) -+ if ((pipe = create_object( dev->pipes, &named_pipe_ops, &new_name, &dev->obj ))) - clear_error(); - } - --- -2.5.0 - diff --git a/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch b/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch new file mode 100644 index 00000000..11ce2aec --- /dev/null +++ b/patches/server-Pipe_ObjectName/0001-server-Store-a-reference-to-the-parent-object-for-pi.patch @@ -0,0 +1,193 @@ +From dea19bf17349a7c1c2398a44e15587dae8fbce44 Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Mon, 17 Aug 2015 01:11:47 +0200 +Subject: server: Store a reference to the parent object for pipe servers. (v2) + +--- + dlls/ntdll/tests/om.c | 3 --- + server/named_pipe.c | 45 +++++++++++++++++++++++++++++++++++++-------- + server/object.c | 18 ++++++++++++------ + 3 files changed, 49 insertions(+), 17 deletions(-) + +diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c +index 3d0487c..84507de 100644 +--- a/dlls/ntdll/tests/om.c ++++ b/dlls/ntdll/tests/om.c +@@ -1401,14 +1401,11 @@ static void test_query_object(void) + status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len ); + ok( status == STATUS_SUCCESS , "NtQueryObject returned %x\n", status ); + str = (UNICODE_STRING *)buffer; +- todo_wine + ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len ); + str = (UNICODE_STRING *)buffer; + expected_len = sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR); +- todo_wine + ok( len == expected_len || broken(len == expected_len - sizeof(WCHAR)), /* NT4 */ + "unexpected len %u\n", len ); +- todo_wine + ok( len > sizeof(UNICODE_STRING) + sizeof("\\test_pipe") * sizeof(WCHAR), + "name too short %s\n", wine_dbgstr_w(str->Buffer) ); + trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len ); +diff --git a/server/named_pipe.c b/server/named_pipe.c +index ffa9e32..c92a117 100644 +--- a/server/named_pipe.c ++++ b/server/named_pipe.c +@@ -148,6 +148,8 @@ static const struct object_ops named_pipe_ops = + /* server end functions */ + static void pipe_server_dump( struct object *obj, int verbose ); + static struct fd *pipe_server_get_fd( struct object *obj ); ++static int pipe_server_link_name( struct object *obj, struct object_name *name, struct object *parent ); ++static void pipe_server_unlink_name( struct object *obj, struct object_name *name ); + static int pipe_server_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); + static void pipe_server_destroy( struct object *obj); + static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async, int blocking ); +@@ -170,8 +172,8 @@ static const struct object_ops pipe_server_ops = + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + no_lookup_name, /* lookup_name */ +- no_link_name, /* link_name */ +- NULL, /* unlink_name */ ++ pipe_server_link_name, /* link_name */ ++ pipe_server_unlink_name, /* unlink_name */ + no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ + pipe_server_close_handle, /* close_handle */ +@@ -196,6 +198,8 @@ static const struct fd_ops pipe_server_fd_ops = + static void pipe_client_dump( struct object *obj, int verbose ); + static int pipe_client_signaled( struct object *obj, struct wait_queue_entry *entry ); + static struct fd *pipe_client_get_fd( struct object *obj ); ++static int pipe_client_link_name( struct object *obj, struct object_name *name, struct object *parent ); ++static void pipe_client_unlink_name( struct object *obj, struct object_name *name ); + static int pipe_client_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); + static void pipe_client_destroy( struct object *obj ); + static obj_handle_t pipe_client_flush( struct fd *fd, const async_data_t *async, int blocking ); +@@ -216,8 +220,8 @@ static const struct object_ops pipe_client_ops = + default_get_sd, /* get_sd */ + default_set_sd, /* set_sd */ + no_lookup_name, /* lookup_name */ +- no_link_name, /* link_name */ +- NULL, /* unlink_name */ ++ pipe_client_link_name, /* link_name */ ++ pipe_client_unlink_name, /* unlink_name */ + no_open_file, /* open_file */ + no_alloc_handle, /* alloc_handle */ + pipe_client_close_handle, /* close_handle */ +@@ -399,6 +403,17 @@ static void do_disconnect( struct pipe_server *server ) + server->fd = NULL; + } + ++static int pipe_server_link_name( struct object *obj, struct object_name *name, struct object *parent ) ++{ ++ assert( parent->ops == &named_pipe_ops ); ++ name->parent = grab_object( parent ); ++ return 1; ++} ++ ++static void pipe_server_unlink_name( struct object *obj, struct object_name *name ) ++{ ++} ++ + static int pipe_server_close_handle( struct object *obj, struct process *process, obj_handle_t handle ) + { + #ifdef __linux__ +@@ -442,6 +457,17 @@ static void pipe_server_destroy( struct object *obj) + release_object( server->pipe ); + } + ++static int pipe_client_link_name( struct object *obj, struct object_name *name, struct object *parent ) ++{ ++ assert( parent->ops == &named_pipe_ops ); ++ name->parent = grab_object( parent ); ++ return 1; ++} ++ ++static void pipe_client_unlink_name( struct object *obj, struct object_name *name ) ++{ ++} ++ + static int pipe_client_close_handle( struct object *obj, struct process *process, obj_handle_t handle ) + { + #ifdef __linux__ +@@ -768,9 +794,10 @@ static struct pipe_server *get_pipe_server_obj( struct process *process, + static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, + unsigned int pipe_flags ) + { ++ static const struct unicode_str str = { NULL, 0 }; + struct pipe_server *server; + +- server = alloc_object( &pipe_server_ops ); ++ server = create_object( &pipe->obj, &pipe_server_ops, &str ); + if (!server) + return NULL; + +@@ -792,11 +819,13 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned + return server; + } + +-static struct pipe_client *create_pipe_client( unsigned int flags, unsigned int pipe_flags ) ++static struct pipe_client *create_pipe_client( struct named_pipe *pipe, unsigned int flags, ++ unsigned int pipe_flags ) + { ++ static const struct unicode_str str = { NULL, 0 }; + struct pipe_client *client; + +- client = alloc_object( &pipe_client_ops ); ++ client = create_object( &pipe->obj, &pipe_client_ops, &str ); + if (!client) + return NULL; + +@@ -896,7 +925,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc + return NULL; + } + +- if ((client = create_pipe_client( options, pipe->flags ))) ++ if ((client = create_pipe_client( pipe, options, pipe->flags ))) + { + type = ((pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && is_messagemode_supported()) ? + SOCK_SEQPACKET : SOCK_STREAM; +diff --git a/server/object.c b/server/object.c +index d4217c0..ef99334 100644 +--- a/server/object.c ++++ b/server/object.c +@@ -162,7 +162,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) + while (ptr && ptr->name) + { + struct object_name *name = ptr->name; +- len += name->len + sizeof(WCHAR); ++ if (name->len) len += name->len + sizeof(WCHAR); + ptr = name->parent; + } + if (!len) return NULL; +@@ -172,9 +172,12 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) + while (obj && obj->name) + { + struct object_name *name = obj->name; +- memcpy( ret + len - name->len, name->name, name->len ); +- len -= name->len + sizeof(WCHAR); +- memcpy( ret + len, &backslash, sizeof(WCHAR) ); ++ if (name->len) ++ { ++ memcpy( ret + len - name->len, name->name, name->len ); ++ len -= name->len + sizeof(WCHAR); ++ memcpy( ret + len, &backslash, sizeof(WCHAR) ); ++ } + obj = name->parent; + } + return (WCHAR *)ret; +@@ -269,8 +272,11 @@ static void dump_name( struct object *obj ) + + if (!name) return; + if (name->parent) dump_name( name->parent ); +- fputs( "\\\\", stderr ); +- dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" ); ++ if (name->len) ++ { ++ fputs( "\\\\", stderr ); ++ dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" ); ++ } + } + + /* dump the name of an object to stderr */ +-- +2.7.0 + diff --git a/patches/server-Pipe_ObjectName/0002-server-Store-a-reference-to-the-parent-object-for-pi.patch b/patches/server-Pipe_ObjectName/0002-server-Store-a-reference-to-the-parent-object-for-pi.patch deleted file mode 100644 index dc64177c..00000000 --- a/patches/server-Pipe_ObjectName/0002-server-Store-a-reference-to-the-parent-object-for-pi.patch +++ /dev/null @@ -1,144 +0,0 @@ -From a584e5646fb07dc21a2748ffa37b7c6461ff67f0 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Mon, 17 Aug 2015 01:11:47 +0200 -Subject: server: Store a reference to the parent object for pipe servers. (v2) - ---- - dlls/ntdll/tests/om.c | 3 --- - server/named_pipe.c | 11 +++++++---- - server/object.c | 31 ++++++++++++++++++++++--------- - 3 files changed, 29 insertions(+), 16 deletions(-) - -diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c -index b957128..1b50d92 100644 ---- a/dlls/ntdll/tests/om.c -+++ b/dlls/ntdll/tests/om.c -@@ -1084,14 +1084,11 @@ static void test_query_object(void) - status = pNtQueryObject( handle, ObjectNameInformation, buffer, sizeof(buffer), &len ); - ok( status == STATUS_SUCCESS , "NtQueryObject returned %x\n", status ); - str = (UNICODE_STRING *)buffer; -- todo_wine - ok( len > sizeof(UNICODE_STRING), "unexpected len %u\n", len ); - str = (UNICODE_STRING *)buffer; - expected_len = sizeof(UNICODE_STRING) + str->Length + sizeof(WCHAR); -- todo_wine - ok( len == expected_len || broken(len == expected_len - sizeof(WCHAR)), /* NT4 */ - "unexpected len %u\n", len ); -- todo_wine - ok( len > sizeof(UNICODE_STRING) + sizeof("\\test_pipe") * sizeof(WCHAR), - "name too short %s\n", wine_dbgstr_w(str->Buffer) ); - trace( "got %s len %u\n", wine_dbgstr_w(str->Buffer), len ); -diff --git a/server/named_pipe.c b/server/named_pipe.c -index 49b3f62..36a5c78 100644 ---- a/server/named_pipe.c -+++ b/server/named_pipe.c -@@ -765,9 +765,10 @@ static struct pipe_server *get_pipe_server_obj( struct process *process, - static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned int options, - unsigned int pipe_flags ) - { -+ static const struct unicode_str str = { NULL, 0 }; - struct pipe_server *server; - -- server = alloc_object( &pipe_server_ops ); -+ server = create_object( NULL, &pipe_server_ops, &str, &pipe->obj ); - if (!server) - return NULL; - -@@ -789,11 +790,13 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned - return server; - } - --static struct pipe_client *create_pipe_client( unsigned int flags, unsigned int pipe_flags ) -+static struct pipe_client *create_pipe_client( struct named_pipe *pipe, unsigned int flags, -+ unsigned int pipe_flags ) - { -+ static const struct unicode_str str = { NULL, 0 }; - struct pipe_client *client; - -- client = alloc_object( &pipe_client_ops ); -+ client = create_object( NULL, &pipe_client_ops, &str, &pipe->obj ); - if (!client) - return NULL; - -@@ -879,7 +882,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc - return NULL; - } - -- if ((client = create_pipe_client( options, pipe->flags ))) -+ if ((client = create_pipe_client( pipe, options, pipe->flags ))) - { - type = ((pipe->flags & NAMED_PIPE_MESSAGE_STREAM_WRITE) && is_messagemode_supported()) ? - SOCK_SEQPACKET : SOCK_STREAM; -diff --git a/server/object.c b/server/object.c -index a1b1184..fd24722 100644 ---- a/server/object.c -+++ b/server/object.c -@@ -55,6 +55,7 @@ struct namespace - struct list names[1]; /* array of hash entry lists */ - }; - -+static struct list dummy_namespace = LIST_INIT(dummy_namespace); - - #ifdef DEBUG_OBJECTS - static struct list object_list = LIST_INIT(object_list); -@@ -157,9 +158,15 @@ static void free_name( struct object *obj ) - static void set_object_name( struct namespace *namespace, - struct object *obj, struct object_name *ptr ) - { -- int hash = get_name_hash( namespace, ptr->name, ptr->len ); -- -- list_add_head( &namespace->names[hash], &ptr->entry ); -+ if (namespace) -+ { -+ int hash = get_name_hash( namespace, ptr->name, ptr->len ); -+ list_add_head( &namespace->names[hash], &ptr->entry ); -+ } -+ else -+ { -+ list_add_tail( &dummy_namespace, &ptr->entry ); -+ } - ptr->obj = obj; - obj->name = ptr; - } -@@ -184,7 +191,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) - while (ptr && ptr->name) - { - struct object_name *name = ptr->name; -- len += name->len + sizeof(WCHAR); -+ if (name->len) len += name->len + sizeof(WCHAR); - ptr = name->parent; - } - if (!len) return NULL; -@@ -194,9 +201,12 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) - while (obj && obj->name) - { - struct object_name *name = obj->name; -- memcpy( ret + len - name->len, name->name, name->len ); -- len -= name->len + sizeof(WCHAR); -- memcpy( ret + len, &backslash, sizeof(WCHAR) ); -+ if (name->len) -+ { -+ memcpy( ret + len - name->len, name->name, name->len ); -+ len -= name->len + sizeof(WCHAR); -+ memcpy( ret + len, &backslash, sizeof(WCHAR) ); -+ } - obj = name->parent; - } - return (WCHAR *)ret; -@@ -276,8 +286,11 @@ static void dump_name( struct object *obj ) - - if (!name) return; - if (name->parent) dump_name( name->parent ); -- fputs( "\\\\", stderr ); -- dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" ); -+ if (name->len) -+ { -+ fputs( "\\\\", stderr ); -+ dump_strW( name->name, name->len / sizeof(WCHAR), stderr, "[]" ); -+ } - } - - /* dump the name of an object to stderr */ --- -2.6.4 -