From fa8670d5473a212b6392c243a2e3d45ef13a7ef5 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 1 May 2016 16:46:46 +0200 Subject: [PATCH] Added patch to fill stack with meaningful values in call_process_entry mis-align workaround. --- ...ack-with-meaningful-values-in-call_p.patch | 28 +++++++++++++++++++ .../kernel32-Misalign_Workaround/definition | 1 + patches/patchinstall.sh | 19 +++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 patches/kernel32-Misalign_Workaround/0001-kernel32-Fill-stack-with-meaningful-values-in-call_p.patch create mode 100644 patches/kernel32-Misalign_Workaround/definition diff --git a/patches/kernel32-Misalign_Workaround/0001-kernel32-Fill-stack-with-meaningful-values-in-call_p.patch b/patches/kernel32-Misalign_Workaround/0001-kernel32-Fill-stack-with-meaningful-values-in-call_p.patch new file mode 100644 index 00000000..bde6f2bf --- /dev/null +++ b/patches/kernel32-Misalign_Workaround/0001-kernel32-Fill-stack-with-meaningful-values-in-call_p.patch @@ -0,0 +1,28 @@ +From 46302575f68264f8b097a663bee06e8624fa69ad Mon Sep 17 00:00:00 2001 +From: Sebastian Lackner +Date: Sun, 1 May 2016 16:45:31 +0200 +Subject: kernel32: Fill stack with meaningful values in call_process_entry + mis-align workaround. + +--- + dlls/kernel32/process.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c +index 4771108..28ec659 100644 +--- a/dlls/kernel32/process.c ++++ b/dlls/kernel32/process.c +@@ -1064,7 +1064,9 @@ __ASM_GLOBAL_FUNC( call_process_entry, + __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") + "movl %esp,%ebp\n\t" + __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") +- "subl $12,%esp\n\t" /* deliberately mis-align the stack by 8, Doom 3 needs this */ ++ "pushl 4(%ebp)\n\t" /* deliberately mis-align the stack by 8, Doom 3 needs this */ ++ "pushl 4(%ebp)\n\t" /* Driller expects readable address at this offset */ ++ "pushl 4(%ebp)\n\t" + "pushl 8(%ebp)\n\t" + "call *12(%ebp)\n\t" + "leave\n\t" +-- +2.8.0 + diff --git a/patches/kernel32-Misalign_Workaround/definition b/patches/kernel32-Misalign_Workaround/definition new file mode 100644 index 00000000..1c46e61d --- /dev/null +++ b/patches/kernel32-Misalign_Workaround/definition @@ -0,0 +1 @@ +Fixes: [24374] Fill stack with meaningful values in call_process_entry mis-align workaround diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 78060b28..d8891708 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -169,6 +169,7 @@ patch_enable_all () enable_kernel32_GetCurrentPackageFamilyName="$1" enable_kernel32_GetShortPathName="$1" enable_kernel32_LocaleNameToLCID="$1" + enable_kernel32_Misalign_Workaround="$1" enable_kernel32_Named_Pipe="$1" enable_kernel32_NeedCurrentDirectoryForExePath="$1" enable_kernel32_Profile="$1" @@ -676,6 +677,9 @@ patch_enable () kernel32-LocaleNameToLCID) enable_kernel32_LocaleNameToLCID="$2" ;; + kernel32-Misalign_Workaround) + enable_kernel32_Misalign_Workaround="$2" + ;; kernel32-Named_Pipe) enable_kernel32_Named_Pipe="$2" ;; @@ -3999,6 +4003,21 @@ if test "$enable_kernel32_LocaleNameToLCID" -eq 1; then ) >> "$patchlist" fi +# Patchset kernel32-Misalign_Workaround +# | +# | This patchset fixes the following Wine bugs: +# | * [#24374] Fill stack with meaningful values in call_process_entry mis-align workaround +# | +# | Modified files: +# | * dlls/kernel32/process.c +# | +if test "$enable_kernel32_Misalign_Workaround" -eq 1; then + patch_apply kernel32-Misalign_Workaround/0001-kernel32-Fill-stack-with-meaningful-values-in-call_p.patch + ( + echo '+ { "Sebastian Lackner", "kernel32: Fill stack with meaningful values in call_process_entry mis-align workaround.", 1 },'; + ) >> "$patchlist" +fi + # Patchset rpcrt4-Pipe_Transport # | # | Modified files: