From 84aaa8ff12a3a9a113d4619e7f9e2db371fc283f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 17 Aug 2015 01:25:22 +0200 Subject: [PATCH] Added patch to report correct ObjectName for NamedPipe wineserver objects (fixes Wine Staging Bug #363). --- README.md | 3 +- debian/changelog | 2 + patches/patchinstall.sh | 30 +++++ ...nt-reference-from-object_name-to-obj.patch | 114 ++++++++++++++++++ ...ver-Link-named-pipes-to-their-device.patch | 25 ++++ ...eference-to-the-parent-object-for-pi.patch | 103 ++++++++++++++++ patches/server-Pipe_ObjectName/definition | 2 + 7 files changed, 278 insertions(+), 1 deletion(-) create mode 100644 patches/server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch create mode 100644 patches/server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch create mode 100644 patches/server-Pipe_ObjectName/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch create mode 100644 patches/server-Pipe_ObjectName/definition diff --git a/README.md b/README.md index ba229770..9845f283 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [10]:** +**Bug fixes and features included in the next upcoming release [11]:** * Add IDragSourceHelper stub interface ([Wine Bug #24699](https://bugs.winehq.org/show_bug.cgi?id=24699)) * Catch invalid memory accesses in imagehlp.CheckSumMappedFile @@ -51,6 +51,7 @@ Included bug fixes and improvements * Improve startup performance by delaying font initialization * Only set SFGAO_HASSUBFOLDER when there are really subfolders ([Wine Bug #24851](https://bugs.winehq.org/show_bug.cgi?id=24851)) * Properly implement imagehlp.ImageLoad and ImageUnload +* Report correct ObjectName for NamedPipe wineserver objects **Bug fixes and features in Wine Staging 1.7.49 [235]:** diff --git a/debian/changelog b/debian/changelog index 98c00d69..2c994935 100644 --- a/debian/changelog +++ b/debian/changelog @@ -12,6 +12,8 @@ wine-staging (1.7.50) UNRELEASED; urgency=low * Added patch to set SFGAO_HASSUBFOLDER only when there are really subfolders. * Added patch to fix multiple uninitialized memory issues in wineserver. * Added patch to implement shell32 NewMenu class with new folder item. + * Added patch to report correct ObjectName for NamedPipe wineserver objects + (fixes Wine Staging Bug #363). * Removed patch to move security cookie initialization from memory management to loader. -- Sebastian Lackner Tue, 11 Aug 2015 06:12:14 +0200 diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 5002d8b3..31f6839d 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -215,6 +215,7 @@ patch_enable_all () enable_server_Misc_ACL="$1" enable_server_OpenProcess="$1" enable_server_PeekMessage="$1" + enable_server_Pipe_ObjectName="$1" enable_server_Realtime_Priority="$1" enable_server_Registry_Timestamp="$1" enable_server_RootDirectory_File="$1" @@ -736,6 +737,9 @@ patch_enable () server-PeekMessage) enable_server_PeekMessage="$2" ;; + server-Pipe_ObjectName) + enable_server_Pipe_ObjectName="$2" + ;; server-Realtime_Priority) enable_server_Realtime_Priority="$2" ;; @@ -1713,6 +1717,13 @@ if test "$enable_server_Shared_Memory" -eq 1; then enable_server_PeekMessage=1 fi +if test "$enable_server_Pipe_ObjectName" -eq 1; then + if test "$enable_kernel32_Named_Pipe" -gt 1; then + abort "Patchset kernel32-Named_Pipe disabled, but server-Pipe_ObjectName depends on that." + fi + enable_kernel32_Named_Pipe=1 +fi + if test "$enable_server_ACL_Compat" -eq 1; then if test "$enable_server_Inherited_ACLs" -gt 1; then abort "Patchset server-Inherited_ACLs disabled, but server-ACL_Compat depends on that." @@ -4532,6 +4543,25 @@ if test "$enable_server_PeekMessage" -eq 1; then ) >> "$patchlist" fi +# Patchset server-Pipe_ObjectName +# | +# | This patchset has the following dependencies: +# | * kernel32-Named_Pipe +# | +# | Modified files: +# | * server/named_pipe.c, server/object.c, server/object.h +# | +if test "$enable_server_Pipe_ObjectName" -eq 1; then + patch_apply server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch + patch_apply server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch + patch_apply server-Pipe_ObjectName/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch + ( + echo '+ { "Sebastian Lackner", "server: Move parent reference from object_name to object.", 1 },'; + 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.", 1 },'; + ) >> "$patchlist" +fi + # Patchset server-Realtime_Priority # | # | Modified files: diff --git a/patches/server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch b/patches/server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch new file mode 100644 index 00000000..bde32387 --- /dev/null +++ b/patches/server-Pipe_ObjectName/0001-server-Move-parent-reference-from-object_name-to-obj.patch @@ -0,0 +1,114 @@ +From e266c05975d524f09886decb854ec78942e9b2fb Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Mon, 17 Aug 2015 00:13:27 +0200 +Subject: server: Move parent reference from object_name to object. + +--- + server/object.c | 20 ++++++++++---------- + server/object.h | 1 + + 2 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/server/object.c b/server/object.c +index d04fdb9..bfb4689 100644 +--- a/server/object.c ++++ b/server/object.c +@@ -44,7 +44,6 @@ struct object_name + { + struct list entry; /* entry in the hash list */ + struct object *obj; /* object owning this name */ +- struct object *parent; /* parent object */ + data_size_t len; /* name length in bytes */ + WCHAR name[1]; + }; +@@ -136,18 +135,15 @@ static struct object_name *alloc_name( const struct unicode_str *name ) + if ((ptr = mem_alloc( sizeof(*ptr) + name->len - sizeof(ptr->name) ))) + { + ptr->len = name->len; +- ptr->parent = NULL; + memcpy( ptr->name, name->str, name->len ); + } + return ptr; + } + + /* free the name of an object */ +-static void free_name( struct object *obj ) ++static void free_name( struct object_name *ptr ) + { +- struct object_name *ptr = obj->name; + list_remove( &ptr->entry ); +- if (ptr->parent) release_object( ptr->parent ); + free( ptr ); + } + +@@ -183,7 +179,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) + { + struct object_name *name = ptr->name; + len += name->len + sizeof(WCHAR); +- ptr = name->parent; ++ ptr = ptr->parent; + } + if (!len) return NULL; + if (!(ret = malloc( len ))) return NULL; +@@ -195,7 +191,7 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) + memcpy( ret + len - name->len, name->name, name->len ); + len -= name->len + sizeof(WCHAR); + memcpy( ret + len, &backslash, sizeof(WCHAR) ); +- obj = name->parent; ++ obj = obj->parent; + } + return (WCHAR *)ret; + } +@@ -208,6 +204,7 @@ void *alloc_object( const struct object_ops *ops ) + { + obj->refcount = 1; + obj->handle_count = 0; ++ obj->parent = NULL; + obj->ops = ops; + obj->name = NULL; + obj->sd = NULL; +@@ -230,7 +227,7 @@ void *create_object( struct namespace *namespace, const struct object_ops *ops, + if ((obj = alloc_object( ops ))) + { + set_object_name( namespace, obj, name_ptr ); +- if (parent) name_ptr->parent = grab_object( parent ); ++ if (parent) obj->parent = grab_object( parent ); + } + else + free( name_ptr ); +@@ -278,8 +275,10 @@ void dump_object_name( struct object *obj ) + /* unlink a named object from its namespace, without freeing the object itself */ + void unlink_named_object( struct object *obj ) + { +- if (obj->name) free_name( obj ); ++ if (obj->name) free_name( obj->name ); ++ if (obj->parent) release_object( obj->parent ); + obj->name = NULL; ++ obj->parent = NULL; + } + + /* mark an object as being stored statically, i.e. only released at shutdown */ +@@ -311,7 +310,8 @@ void release_object( void *ptr ) + /* if the refcount is 0, nobody can be in the wait queue */ + assert( list_empty( &obj->wait_queue )); + obj->ops->destroy( obj ); +- if (obj->name) free_name( obj ); ++ if (obj->name) free_name( obj->name ); ++ if (obj->parent) release_object( obj->parent ); + free( obj->sd ); + #ifdef DEBUG_OBJECTS + list_remove( &obj->obj_list ); +diff --git a/server/object.h b/server/object.h +index 0974d87..9d14c9c 100644 +--- a/server/object.h ++++ b/server/object.h +@@ -96,6 +96,7 @@ struct object + { + unsigned int refcount; /* reference count */ + unsigned int handle_count;/* handle count */ ++ struct object *parent; /* parent object */ + const struct object_ops *ops; + struct list wait_queue; + struct object_name *name; +-- +2.5.0 + diff --git a/patches/server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch b/patches/server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch new file mode 100644 index 00000000..e44c9927 --- /dev/null +++ b/patches/server-Pipe_ObjectName/0002-server-Link-named-pipes-to-their-device.patch @@ -0,0 +1,25 @@ +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/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch b/patches/server-Pipe_ObjectName/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch new file mode 100644 index 00000000..44e91bd0 --- /dev/null +++ b/patches/server-Pipe_ObjectName/0003-server-Store-a-reference-to-the-parent-object-for-pi.patch @@ -0,0 +1,103 @@ +From 84d1dc87366a3f72365b29f490da5bed67998386 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. + +--- + server/named_pipe.c | 9 +++++---- + server/object.c | 21 ++++++++++++--------- + 2 files changed, 17 insertions(+), 13 deletions(-) + +diff --git a/server/named_pipe.c b/server/named_pipe.c +index 0ce3e59..283eb2c 100644 +--- a/server/named_pipe.c ++++ b/server/named_pipe.c +@@ -764,7 +764,7 @@ static struct pipe_server *create_pipe_server( struct named_pipe *pipe, unsigned + { + struct pipe_server *server; + +- server = alloc_object( &pipe_server_ops ); ++ server = create_object( NULL, &pipe_server_ops, NULL, &pipe->obj ); + if (!server) + return NULL; + +@@ -786,11 +786,12 @@ 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 ) + { + struct pipe_client *client; + +- client = alloc_object( &pipe_client_ops ); ++ client = create_object( NULL, &pipe_client_ops, NULL, &pipe->obj ); + if (!client) + return NULL; + +@@ -876,7 +877,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 bfb4689..5f16046 100644 +--- a/server/object.c ++++ b/server/object.c +@@ -175,22 +175,25 @@ WCHAR *get_object_full_name( struct object *obj, data_size_t *ret_len ) + data_size_t len = 0; + char *ret; + +- while (ptr && ptr->name) ++ while (ptr) + { + struct object_name *name = ptr->name; +- len += name->len + sizeof(WCHAR); ++ if (name) len += name->len + sizeof(WCHAR); + ptr = ptr->parent; + } + if (!len) return NULL; + if (!(ret = malloc( len ))) return NULL; + + *ret_len = len; +- while (obj && obj->name) ++ while (obj) + { + 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) ++ { ++ memcpy( ret + len - name->len, name->name, name->len ); ++ len -= name->len + sizeof(WCHAR); ++ memcpy( ret + len, &backslash, sizeof(WCHAR) ); ++ } + obj = obj->parent; + } + return (WCHAR *)ret; +@@ -220,13 +223,13 @@ void *alloc_object( const struct object_ops *ops ) + void *create_object( struct namespace *namespace, const struct object_ops *ops, + const struct unicode_str *name, struct object *parent ) + { ++ struct object_name *name_ptr = NULL; + struct object *obj; +- struct object_name *name_ptr; + +- if (!(name_ptr = alloc_name( name ))) return NULL; ++ if (namespace && !(name_ptr = alloc_name( name ))) return NULL; + if ((obj = alloc_object( ops ))) + { +- set_object_name( namespace, obj, name_ptr ); ++ if (namespace) set_object_name( namespace, obj, name_ptr ); + if (parent) obj->parent = grab_object( parent ); + } + else +-- +2.5.0 + diff --git a/patches/server-Pipe_ObjectName/definition b/patches/server-Pipe_ObjectName/definition new file mode 100644 index 00000000..14e6e8ea --- /dev/null +++ b/patches/server-Pipe_ObjectName/definition @@ -0,0 +1,2 @@ +Fixes: Report correct ObjectName for NamedPipe wineserver objects +Depends: kernel32-Named_Pipe