Skip to content

Commit

Permalink
Rebase against 2346a4012aed5a150cd971ca1e929528722a4d12.
Browse files Browse the repository at this point in the history
  • Loading branch information
zfigura committed Sep 1, 2018
1 parent 90c47aa commit 94f314c
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 425 deletions.
@@ -1,18 +1,18 @@
From a99b0eeff3202d63f55f252ceb7cf364549d812c Mon Sep 17 00:00:00 2001
From 77f6fbe85432f4bc61b1b9b27a0992a1f6269344 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 10 Nov 2014 04:05:38 +0100
Subject: winedevice: Avoid invalid memory access when relocation block
Subject: ntoskrnl.exe: Avoid invalid memory access when relocation block
addresses memory outside of the current page.

---
programs/winedevice/device.c | 49 ++++++++++++++++++++++++++++++++++++++------
dlls/ntoskrnl.exe/ntoskrnl.c | 49 ++++++++++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 6 deletions(-)

diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index 94132ed..6bcc2b2 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -63,6 +63,39 @@ static LDR_MODULE *find_ldr_module( HMODULE module )
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 577f5b3..8649863 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -3208,6 +3208,39 @@ static LDR_MODULE *find_ldr_module( HMODULE module )
return ldr;
}

Expand Down Expand Up @@ -52,7 +52,7 @@ index 94132ed..6bcc2b2 100644
/* load the driver module file */
static HMODULE load_driver_module( const WCHAR *name )
{
@@ -86,7 +119,7 @@ static HMODULE load_driver_module( const WCHAR *name )
@@ -3231,7 +3264,7 @@ static HMODULE load_driver_module( const WCHAR *name )
if (nt->OptionalHeader.SectionAlignment < info.PageSize ||
!(nt->FileHeader.Characteristics & IMAGE_FILE_DLL))
{
Expand All @@ -61,7 +61,7 @@ index 94132ed..6bcc2b2 100644
IMAGE_BASE_RELOCATION *rel, *end;

if ((rel = RtlImageDirectoryEntryToData( module, TRUE, IMAGE_DIRECTORY_ENTRY_BASERELOC, &size )))
@@ -94,20 +127,24 @@ static HMODULE load_driver_module( const WCHAR *name )
@@ -3239,20 +3272,24 @@ static HMODULE load_driver_module( const WCHAR *name )
WINE_TRACE( "%s: relocating from %p to %p\n",
wine_dbgstr_w(name), (char *)module - delta, module );
end = (IMAGE_BASE_RELOCATION *)((char *)rel + size);
Expand Down Expand Up @@ -92,5 +92,5 @@ index 94132ed..6bcc2b2 100644
}

--
2.7.1
2.7.4

@@ -1,2 +1 @@
Fixes: [28254] Fix crash of winedevice when relocation entry crosses page boundary
Disabled: True
21 changes: 20 additions & 1 deletion patches/patchinstall.sh
Expand Up @@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "a1e0a029b0ce80e6561e0656ae4530fb1a8d4316"
echo "2346a4012aed5a150cd971ca1e929528722a4d12"
}

# Show version information
Expand Down Expand Up @@ -255,6 +255,7 @@ patch_enable_all ()
enable_ntdll_futex_condition_var="$1"
enable_ntdll_set_full_cpu_context="$1"
enable_ntoskrnl_Stubs="$1"
enable_ntoskrnl_exe_Fix_Relocation="$1"
enable_nvapi_Stub_DLL="$1"
enable_nvcuda_CUDA_Support="$1"
enable_nvcuvid_CUDA_Video_Support="$1"
Expand Down Expand Up @@ -943,6 +944,9 @@ patch_enable ()
ntoskrnl-Stubs)
enable_ntoskrnl_Stubs="$2"
;;
ntoskrnl.exe-Fix_Relocation)
enable_ntoskrnl_exe_Fix_Relocation="$2"
;;
nvapi-Stub_DLL)
enable_nvapi_Stub_DLL="$2"
;;
Expand Down Expand Up @@ -5605,6 +5609,21 @@ if test "$enable_ntoskrnl_Stubs" -eq 1; then
) >> "$patchlist"
fi

# Patchset ntoskrnl.exe-Fix_Relocation
# |
# | This patchset fixes the following Wine bugs:
# | * [#28254] Fix crash of winedevice when relocation entry crosses page boundary
# |
# | Modified files:
# | * dlls/ntoskrnl.exe/ntoskrnl.c
# |
if test "$enable_ntoskrnl_exe_Fix_Relocation" -eq 1; then
patch_apply ntoskrnl.exe-Fix_Relocation/0001-ntoskrnl.exe-Avoid-invalid-memory-access-when-reloca.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "ntoskrnl.exe: Avoid invalid memory access when relocation block addresses memory outside of the current page.", 1 },';
) >> "$patchlist"
fi

# Patchset nvcuvid-CUDA_Video_Support
# |
# | This patchset has the following (direct or indirect) dependencies:
Expand Down

0 comments on commit 94f314c

Please sign in to comment.