Added additional patch to use assembly wrapper for TLS callbacks.

This commit is contained in:
Sebastian Lackner 2014-09-07 01:51:30 +02:00
parent 1598a4326e
commit ba1bf62faa
6 changed files with 106 additions and 1 deletions

View File

@ -35,12 +35,13 @@ Wine. All those differences are also documented on the
Included bugfixes and improvements
==================================
**Bugfixes and features included in the next upcoming release [4]:**
**Bugfixes and features included in the next upcoming release [5]:**
* Fix unintentional leaks with ntdll internals
* Improvement for heap allocation performance
* Support for DOS hidden/system file attributes ([Wine Bug #9158](http://bugs.winehq.org/show_bug.cgi?id=9158 "Multiple Microsoft development tools online/web installers fail to skip \"$shtdwn$.req\" with FILE_ATTRIBUTE_HIDDEN (Visual Studio Express Editions, .NET Framework 3.0)"))
* Support for setcap on wine-preloader ([Wine Bug #26256](http://bugs.winehq.org/show_bug.cgi?id=26256 "wine64-preloader can't handle setcap cap_net_raw+epi"))
* Use assembly wrapper to run TLS callbacks ([Wine Bug #21917](http://bugs.winehq.org/show_bug.cgi?id=21917 "SC2 'LazyLaunch' v2.0 fails with 'Exception frame is not in stack limits => unable to dispatch exception.' (TLS callbacks can taint EBP, needs assembly wrapper)"))
**Bugs fixed in Wine-Compholio 1.7.25 [53]:**

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ wine-compholio (1.7.26) UNRELEASED; urgency=low
* Added patch to fix issues when using setcap on wine executable.
* Added patch to improve heap allocation performance by using more freelists.
* Added patch to fix detection of ncurses on Archlinux (avoids ugly workarounds at build time).
* Added patch to use assembly wrapper for TLS callbacks.
* Removed patch to fix issue with msi/ITERATE_MoveFiles (accepted upstream).
* Removed patch to fix detection of ncurses on Archlinux (accepted upstream).
-- Erich E. Hoover <erich.e.hoover@gmail.com> Wed, 27 Aug 2014 00:34:51 +0200

View File

@ -45,6 +45,7 @@ PATCHLIST := \
ntdll-Heap_FreeLists.ok \
ntdll-Junction_Points.ok \
ntdll-Pipe_SpecialCharacters.ok \
ntdll-Save_Regs_Entrypoint.ok \
ntdll-loader_EntryPoint.ok \
quartz-MediaSeeking_Positions.ok \
riched20-IText_Interface.ok \
@ -635,6 +636,25 @@ ntdll-Pipe_SpecialCharacters.ok:
echo '+ { "ntdll-Pipe_SpecialCharacters", "Michael Müller", "Allow special characters in pipe names." },'; \
) > ntdll-Pipe_SpecialCharacters.ok
# Patchset ntdll-Save_Regs_Entrypoint
# |
# | Included patches:
# | * Use assembly wrapper to run TLS callbacks and save EBP. [by Sebastian Lackner]
# |
# | This patchset fixes the following Wine bugs:
# | * [#21917] Use assembly wrapper to run TLS callbacks
# |
# | Modified files:
# | * dlls/ntdll/loader.c
# |
.INTERMEDIATE: ntdll-Save_Regs_Entrypoint.ok
ntdll-Save_Regs_Entrypoint.ok:
$(call APPLY_FILE,ntdll-Save_Regs_Entrypoint/0001-ntdll-Save-more-registers-in-call_dll_entry_point-on.patch)
$(call APPLY_FILE,ntdll-Save_Regs_Entrypoint/0002-ntdll-Use-call_dll_entry_point-to-execute-TLS-callba.patch)
@( \
echo '+ { "ntdll-Save_Regs_Entrypoint", "Sebastian Lackner", "Use assembly wrapper to run TLS callbacks and save EBP." },'; \
) > ntdll-Save_Regs_Entrypoint.ok
# Patchset ntdll-loader_EntryPoint
# |
# | Included patches:

View File

@ -0,0 +1,54 @@
From eaee4cd11725df0a44649ae7ee1a6bdaeeb8dfcc Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 7 Sep 2014 01:46:26 +0200
Subject: ntdll: Save more registers in call_dll_entry_point on i386.
---
dlls/ntdll/loader.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 79aa341..dfe7516 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -142,7 +142,9 @@ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
* call_dll_entry_point
*
* Some brain-damaged dlls (ir32_32.dll for instance) modify ebx in
- * their entry point, so we need a small asm wrapper.
+ * their entry point, so we need a small asm wrapper. Testing indicates
+ * that only modifying esi leads to a crash, so use this one to backup
+ * ebp while running the dll entry proc.
*/
#ifdef __i386__
extern BOOL call_dll_entry_point( DLLENTRYPROC proc, void *module, UINT reason, void *reserved );
@@ -154,13 +156,24 @@ __ASM_GLOBAL_FUNC(call_dll_entry_point,
__ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
"pushl %ebx\n\t"
__ASM_CFI(".cfi_rel_offset %ebx,-4\n\t")
- "subl $8,%esp\n\t"
+ "pushl %esi\n\t"
+ __ASM_CFI(".cfi_rel_offset %esi,-8\n\t")
+ "pushl %edi\n\t"
+ __ASM_CFI(".cfi_rel_offset %edi,-12\n\t")
+ "movl %ebp,%esi\n\t"
+ __ASM_CFI(".cfi_def_cfa_register %esi\n\t")
"pushl 20(%ebp)\n\t"
"pushl 16(%ebp)\n\t"
"pushl 12(%ebp)\n\t"
"movl 8(%ebp),%eax\n\t"
"call *%eax\n\t"
- "leal -4(%ebp),%esp\n\t"
+ "movl %esi,%ebp\n\t"
+ __ASM_CFI(".cfi_def_cfa_register %ebp\n\t")
+ "leal -12(%ebp),%esp\n\t"
+ "popl %edi\n\t"
+ __ASM_CFI(".cfi_same_value %edi\n\t")
+ "popl %esi\n\t"
+ __ASM_CFI(".cfi_same_value %esi\n\t")
"popl %ebx\n\t"
__ASM_CFI(".cfi_same_value %ebx\n\t")
"popl %ebp\n\t"
--
2.1.0

View File

@ -0,0 +1,25 @@
From 507cba6fbcec06846ac90e62a76aaa61117f21fd Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 7 Sep 2014 01:46:52 +0200
Subject: ntdll: Use call_dll_entry_point to execute TLS callbacks.
---
dlls/ntdll/loader.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index dfe7516..bd160d9 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -1030,7 +1030,7 @@ static void call_tls_callbacks( HMODULE module, UINT reason )
GetCurrentThreadId(), *callback, module, reason_names[reason] );
__TRY
{
- (*callback)( module, reason, NULL );
+ call_dll_entry_point( (DLLENTRYPROC)(*callback), module, reason, NULL );
}
__EXCEPT_ALL
{
--
2.1.0

View File

@ -0,0 +1,4 @@
Author: Sebastian Lackner
Subject: Use assembly wrapper to run TLS callbacks and save EBP.
Revision: 1
Fixes: [21917] Use assembly wrapper to run TLS callbacks