Rebase against e083986df52bd706d0c7e8ae8820a5d886942585.

This commit is contained in:
Sebastian Lackner 2015-08-12 16:36:26 +02:00
parent 6b398014f2
commit e265cf1024
14 changed files with 9 additions and 359 deletions

View File

@ -209,7 +209,7 @@ for more details.*
* MSYS2 expects correct handling of WRITECOPY memory protection ([Wine Bug #35561](https://bugs.winehq.org/show_bug.cgi?id=35561))
* Make it possible to change media center / tablet pc status ([Wine Bug #18732](https://bugs.winehq.org/show_bug.cgi?id=18732))
* MediaCoder needs CUDA for video encoding ([Wine Bug #37664](https://bugs.winehq.org/show_bug.cgi?id=37664))
* Move cookie initialization code from memory management to loader ([Wine Bug #39040](https://bugs.winehq.org/show_bug.cgi?id=39040))
* ~~Move cookie initialization code from memory management to loader~~ ([Wine Bug #39040](https://bugs.winehq.org/show_bug.cgi?id=39040))
* Multiple applications need EnumDisplayDevicesW implementation ([Wine Bug #34978](https://bugs.winehq.org/show_bug.cgi?id=34978))
* Need for Speed 3 installer requires devices in HKEY_DYN_DATA ([Wine Bug #7115](https://bugs.winehq.org/show_bug.cgi?id=7115))
* Other Pipelight-specific enhancements

2
debian/changelog vendored
View File

@ -2,6 +2,8 @@ wine-staging (1.7.50) UNRELEASED; urgency=low
* Add patch to implement remaining OpenMP locking functions.
* Added various patches for imagehlp cleanup (fixes Wine Staging Bug #502).
* Added patch to fix implementation of ntdll.MapViewOfSection.
* Removed patch to move security cookie initialization from memory management
to loader.
-- Sebastian Lackner <sebastian@fds-team.de> Tue, 11 Aug 2015 06:12:14 +0200
wine-staging (1.7.49) unstable; urgency=low

View File

@ -1,40 +0,0 @@
From 7148e6c97c72c999f56f811d2501b7bfc90fac5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Tue, 11 Aug 2015 03:42:07 +0200
Subject: imagehlp: Remove unused structure.
---
dlls/imagehlp/access.c | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/dlls/imagehlp/access.c b/dlls/imagehlp/access.c
index 9e1f187..6a33c0c 100644
--- a/dlls/imagehlp/access.c
+++ b/dlls/imagehlp/access.c
@@ -36,23 +36,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(imagehlp);
static PLOADED_IMAGE IMAGEHLP_pFirstLoadedImage=NULL;
-static LOADED_IMAGE IMAGEHLP_EmptyLoadedImage = {
- NULL, /* ModuleName */
- 0, /* hFile */
- NULL, /* MappedAddress */
- NULL, /* FileHeader */
- NULL, /* LastRvaSection */
- 0, /* NumberOfSections */
- NULL, /* Sections */
- 1, /* Characteristics */
- FALSE, /* fSystemImage */
- FALSE, /* fDOSImage */
- FALSE, /* fReadOnly */
- 0, /* Version */
- { &IMAGEHLP_EmptyLoadedImage.Links, &IMAGEHLP_EmptyLoadedImage.Links }, /* Links */
- 148, /* SizeOfImage; */
-};
-
DECLSPEC_HIDDEN extern HANDLE IMAGEHLP_hHeap;
/***********************************************************************
--
2.5.0

View File

@ -1,2 +1 @@
Fixes: Fix implementation of ntdll.MapViewOfSection
Depends: ntdll-Security_Cookie

View File

@ -1,179 +0,0 @@
From bf3a7b253745c148a65efc9678e7dbb9356c3cf0 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 8 Aug 2015 20:51:43 +0200
Subject: ntdll: Move cookie initialization code from memory management to
loader.
---
dlls/ntdll/loader.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/virtual.c | 49 -------------------------------------------
2 files changed, 59 insertions(+), 49 deletions(-)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index bef0ab1..fb7b171 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -50,6 +50,12 @@ WINE_DECLARE_DEBUG_CHANNEL(snoop);
WINE_DECLARE_DEBUG_CHANNEL(loaddll);
WINE_DECLARE_DEBUG_CHANNEL(imports);
+#ifdef _WIN64
+#define DEFAULT_SECURITY_COOKIE_64 (((ULONGLONG)0x00002b99 << 32) | 0x2ddfa232)
+#endif
+#define DEFAULT_SECURITY_COOKIE_32 0xbb40e64e
+#define DEFAULT_SECURITY_COOKIE_16 (DEFAULT_SECURITY_COOKIE_32 >> 16)
+
/* we don't want to include winuser.h */
#define RT_MANIFEST ((ULONG_PTR)24)
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID ((ULONG_PTR)2)
@@ -1602,6 +1608,55 @@ static void load_builtin_callback( void *module, const char *filename )
}
+/***********************************************************************
+ * set_security_cookie
+ *
+ * Create a random security cookie for buffer overflow protection. Make
+ * sure it does not accidentally match the default cookie value.
+ */
+static void set_security_cookie( void *module, SIZE_T len )
+{
+ static ULONG seed;
+ IMAGE_LOAD_CONFIG_DIRECTORY *loadcfg;
+ ULONG loadcfg_size;
+ ULONG_PTR *cookie;
+
+ loadcfg = RtlImageDirectoryEntryToData( module, TRUE, IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, &loadcfg_size );
+ if (!loadcfg) return;
+ if (loadcfg_size < offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie)) return;
+ if (!loadcfg->SecurityCookie) return;
+ if (loadcfg->SecurityCookie < (ULONG_PTR)module ||
+ loadcfg->SecurityCookie > (ULONG_PTR)module + len - sizeof(ULONG_PTR))
+ {
+ WARN( "security cookie %p outside of image %p-%p\n",
+ (void *)loadcfg->SecurityCookie, module, (char *)module + len );
+ return;
+ }
+
+ cookie = (ULONG_PTR *)loadcfg->SecurityCookie;
+ TRACE( "initializing security cookie %p\n", cookie );
+
+ if (!seed) seed = NtGetTickCount() ^ GetCurrentProcessId();
+ for (;;)
+ {
+ if (*cookie == DEFAULT_SECURITY_COOKIE_16)
+ *cookie = RtlRandom( &seed ) >> 16; /* leave the high word clear */
+ else if (*cookie == DEFAULT_SECURITY_COOKIE_32)
+ *cookie = RtlRandom( &seed );
+#ifdef DEFAULT_SECURITY_COOKIE_64
+ else if (*cookie == DEFAULT_SECURITY_COOKIE_64)
+ {
+ *cookie = RtlRandom( &seed );
+ /* fill up, but keep the highest word clear */
+ *cookie ^= (ULONG_PTR)RtlRandom( &seed ) << 16;
+ }
+#endif
+ else
+ break;
+ }
+}
+
+
/******************************************************************************
* load_native_dll (internal)
*/
@@ -1636,6 +1691,10 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
goto done;
}
+ /* randomize security cookie */
+
+ set_security_cookie( module, len );
+
/* fixup imports */
nt = RtlImageNtHeader( module );
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index 676675f..fe17518 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -61,12 +61,6 @@ WINE_DECLARE_DEBUG_CHANNEL(module);
#define MAP_NORESERVE 0
#endif
-#ifdef _WIN64
-#define DEFAULT_SECURITY_COOKIE_64 (((ULONGLONG)0x00002b99 << 32) | 0x2ddfa232)
-#endif
-#define DEFAULT_SECURITY_COOKIE_32 0xbb40e64e
-#define DEFAULT_SECURITY_COOKIE_16 (DEFAULT_SECURITY_COOKIE_32 >> 16)
-
/* File view */
struct file_view
{
@@ -1060,37 +1054,6 @@ static NTSTATUS stat_mapping_file( struct file_view *view, struct stat *st )
}
/***********************************************************************
- * set_security_cookie
- *
- * Create a random security cookie for buffer overflow protection. Make
- * sure it does not accidentally match the default cookie value.
- */
-static void set_security_cookie(ULONG_PTR *cookie)
-{
- static ULONG seed;
-
- if (!cookie) return;
- if (!seed) seed = NtGetTickCount() ^ GetCurrentProcessId();
- while (1)
- {
- if (*cookie == DEFAULT_SECURITY_COOKIE_16)
- *cookie = RtlRandom( &seed ) >> 16; /* leave the high word clear */
- else if (*cookie == DEFAULT_SECURITY_COOKIE_32)
- *cookie = RtlRandom( &seed );
-#ifdef DEFAULT_SECURITY_COOKIE_64
- else if (*cookie == DEFAULT_SECURITY_COOKIE_64)
- {
- *cookie = RtlRandom( &seed );
- /* fill up, but keep the highest word clear */
- *cookie ^= (ULONG_PTR)RtlRandom( &seed ) << 16;
- }
-#endif
- else
- break;
- }
-}
-
-/***********************************************************************
* map_image
*
* Map an executable (PE format) image into memory.
@@ -1103,8 +1066,6 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
IMAGE_SECTION_HEADER sections[96];
IMAGE_SECTION_HEADER *sec;
IMAGE_DATA_DIRECTORY *imports;
- IMAGE_LOAD_CONFIG_DIRECTORY *loadcfg;
- ULONG loadcfg_size;
NTSTATUS status = STATUS_CONFLICTING_ADDRESSES;
int i;
off_t pos;
@@ -1316,16 +1277,6 @@ static NTSTATUS map_image( HANDLE hmapping, int fd, char *base, SIZE_T total_siz
}
}
- /* randomize security cookie */
-
- loadcfg = RtlImageDirectoryEntryToData( (HMODULE)ptr, TRUE,
- IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, &loadcfg_size );
- if (loadcfg && loadcfg_size >= offsetof(IMAGE_LOAD_CONFIG_DIRECTORY, SecurityCookie) + sizeof(loadcfg->SecurityCookie) &&
- (ULONG_PTR)ptr <= loadcfg->SecurityCookie && loadcfg->SecurityCookie <= (ULONG_PTR)ptr + total_size - sizeof(ULONG_PTR))
- {
- set_security_cookie((ULONG_PTR *)loadcfg->SecurityCookie);
- }
-
/* set the image protections */
VIRTUAL_SetProt( view, ptr, ROUND_SIZE( 0, header_size ), VPROT_COMMITTED | VPROT_READ );
--
2.5.0

View File

@ -1 +0,0 @@
Fixes: [39040] Move cookie initialization code from memory management to loader

View File

@ -55,7 +55,7 @@ version()
echo "Copyright (C) 2014-2015 the Wine Staging project authors."
echo ""
echo "Patchset to be applied on upstream Wine:"
echo " commit 06e68ff6613042e78a5dd4b9066713d9beab0c6d"
echo " commit e083986df52bd706d0c7e8ae8820a5d886942585"
echo ""
}
@ -179,7 +179,6 @@ patch_enable_all ()
enable_ntdll_NtSetLdtEntries="$1"
enable_ntdll_Pipe_SpecialCharacters="$1"
enable_ntdll_RtlIpStringToAddress="$1"
enable_ntdll_Security_Cookie="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_Threading="$1"
enable_ntdll_User_Shared_Data="$1"
@ -622,9 +621,6 @@ patch_enable ()
ntdll-RtlIpStringToAddress)
enable_ntdll_RtlIpStringToAddress="$2"
;;
ntdll-Security_Cookie)
enable_ntdll_Security_Cookie="$2"
;;
ntdll-ThreadTime)
enable_ntdll_ThreadTime="$2"
;;
@ -1757,13 +1753,6 @@ if test "$enable_ntdll_WriteWatches" -eq 1; then
enable_ws2_32_WriteWatches=1
fi
if test "$enable_ntdll_NtMapViewOfSection" -eq 1; then
if test "$enable_ntdll_Security_Cookie" -gt 1; then
abort "Patchset ntdll-Security_Cookie disabled, but ntdll-NtMapViewOfSection depends on that."
fi
enable_ntdll_Security_Cookie=1
fi
if test "$enable_ntdll_Junction_Points" -eq 1; then
if test "$enable_ntdll_Fix_Free" -gt 1; then
abort "Patchset ntdll-Fix_Free disabled, but ntdll-Junction_Points depends on that."
@ -2996,12 +2985,10 @@ fi
if test "$enable_imagehlp_Cleanup" -eq 1; then
patch_apply imagehlp-Cleanup/0001-imagehlp-Catch-invalid-memory-access-in-CheckSumMapp.patch
patch_apply imagehlp-Cleanup/0002-imagehlp-Fix-checksum-calculation-for-odd-sizes.patch
patch_apply imagehlp-Cleanup/0003-imagehlp-Remove-unused-structure.patch
patch_apply imagehlp-Cleanup/0004-imagehlp-Implement-ImageLoad-and-cleanup-ImageUnload.patch
patch_apply imagehlp-Cleanup/0003-imagehlp-Implement-ImageLoad-and-cleanup-ImageUnload.patch
(
echo '+ { "Michael Müller", "imagehlp: Catch invalid memory access in CheckSumMappedFile and add tests.", 1 },';
echo '+ { "Michael Müller", "imagehlp: Fix checksum calculation for odd sizes.", 1 },';
echo '+ { "Michael Müller", "imagehlp: Remove unused structure.", 1 },';
echo '+ { "Michael Müller", "imagehlp: Implement ImageLoad and cleanup ImageUnload.", 1 },';
) >> "$patchlist"
fi
@ -3808,26 +3795,8 @@ if test "$enable_ntdll_Junction_Points" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Security_Cookie
# |
# | This patchset fixes the following Wine bugs:
# | * [#39040] Move cookie initialization code from memory management to loader
# |
# | Modified files:
# | * dlls/ntdll/loader.c, dlls/ntdll/virtual.c
# |
if test "$enable_ntdll_Security_Cookie" -eq 1; then
patch_apply ntdll-Security_Cookie/0001-ntdll-Move-cookie-initialization-code-from-memory-ma.patch
(
echo '+ { "Sebastian Lackner", "ntdll: Move cookie initialization code from memory management to loader.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-NtMapViewOfSection
# |
# | This patchset has the following dependencies:
# | * ntdll-Security_Cookie
# |
# | Modified files:
# | * dlls/kernel32/tests/loader.c, dlls/ntdll/loader.c, dlls/ntdll/virtual.c
# |
@ -5870,10 +5839,8 @@ fi
# | * dlls/winhttp/request.c, dlls/winhttp/tests/winhttp.c
# |
if test "$enable_winhttp_Request_Headers" -eq 1; then
patch_apply winhttp-Request_Headers/0001-winhttp-Remove-unused-variable-in-read_reply.patch
patch_apply winhttp-Request_Headers/0002-winhttp-Raw-request-headers-needs-to-be-terminated-u.patch
patch_apply winhttp-Request_Headers/0001-winhttp-Raw-request-headers-needs-to-be-terminated-u.patch
(
echo '+ { "Michael Müller", "winhttp: Remove unused variable in read_reply().", 1 },';
echo '+ { "Michael Müller", "winhttp: Raw request headers needs to be terminated using double \\\\r\\\\n.", 1 },';
) >> "$patchlist"
fi
@ -5929,12 +5896,10 @@ fi
# | * dlls/wininet/internet.c, dlls/wininet/tests/internet.c
# |
if test "$enable_wininet_Internet_Settings" -eq 1; then
patch_apply wininet-Internet_Settings/0001-wininet-Print-the-correct-function-name-in-ok-messag.patch
patch_apply wininet-Internet_Settings/0002-wininet-Disabling-proxy-should-return-success-when-n.patch
patch_apply wininet-Internet_Settings/0003-wininet-Allow-INTERNET_OPTION_SETTINGS_CHANGED-on-co.patch
patch_apply wininet-Internet_Settings/0004-wininet-Add-support-for-INTERNET_OPTION_SETTINGS_CHA.patch
patch_apply wininet-Internet_Settings/0001-wininet-Disabling-proxy-should-return-success-when-n.patch
patch_apply wininet-Internet_Settings/0002-wininet-Allow-INTERNET_OPTION_SETTINGS_CHANGED-on-co.patch
patch_apply wininet-Internet_Settings/0003-wininet-Add-support-for-INTERNET_OPTION_SETTINGS_CHA.patch
(
echo '+ { "Sebastian Lackner", "wininet: Print the correct function name in ok() messages.", 1 },';
echo '+ { "Michael Müller", "wininet: Disabling proxy should return success when no proxy was enabled.", 1 },';
echo '+ { "Michael Müller", "wininet: Allow INTERNET_OPTION_SETTINGS_CHANGED on connections.", 1 },';
echo '+ { "Michael Müller", "wininet: Add support for INTERNET_OPTION_SETTINGS_CHANGED in InternetSetOption.", 1 },';

View File

@ -1,45 +0,0 @@
From 15eaea1b23276347b7ac4d68dd0d9c0da709bf7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 9 Aug 2015 15:28:37 +0200
Subject: winhttp: Remove unused variable in read_reply().
---
dlls/winhttp/request.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c
index 740a582..607b502 100644
--- a/dlls/winhttp/request.c
+++ b/dlls/winhttp/request.c
@@ -2092,19 +2092,17 @@ static BOOL read_reply( request_t *request )
static const WCHAR crlf[] = {'\r','\n',0};
char buffer[MAX_REPLY_LEN];
- DWORD buflen, len, offset, received_len, crlf_len = 2; /* strlenW(crlf) */
+ DWORD buflen, len, offset, crlf_len = 2; /* strlenW(crlf) */
char *status_code, *status_text;
WCHAR *versionW, *status_textW, *raw_headers;
WCHAR status_codeW[4]; /* sizeof("nnn") */
if (!netconn_connected( &request->netconn )) return FALSE;
- received_len = 0;
do
{
buflen = MAX_REPLY_LEN;
if (!read_line( request, buffer, &buflen )) return FALSE;
- received_len += buflen;
/* first line should look like 'HTTP/1.x nnn OK' where nnn is the status code */
if (!(status_code = strchr( buffer, ' ' ))) return FALSE;
@@ -2157,7 +2155,6 @@ static BOOL read_reply( request_t *request )
buflen = MAX_REPLY_LEN;
if (!read_line( request, buffer, &buflen )) return TRUE;
- received_len += buflen;
if (!*buffer) break;
while (len - offset < buflen + crlf_len)
--
2.5.0

View File

@ -1,51 +0,0 @@
From d09b181f7f9cbba7d9b28e3a5db4058f852b5688 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Fri, 7 Aug 2015 22:16:08 +0200
Subject: wininet: Print the correct function name in ok() messages.
---
dlls/wininet/tests/internet.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 5e09525..2efde07 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -1111,29 +1111,29 @@ static void test_InternetSetOption(void)
SetLastError(0xdeadbeef);
ulArg = 11;
ret = InternetSetOptionA(NULL, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
- ok(ret == FALSE, "InternetQueryOption should've failed\n");
+ ok(ret == FALSE, "InternetSetOption should've failed\n");
ok(GetLastError() == ERROR_INTERNET_INCORRECT_HANDLE_TYPE, "GetLastError() = %x\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 11;
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, 20);
- ok(ret == FALSE, "InternetQueryOption should've failed\n");
+ ok(ret == FALSE, "InternetSetOption should've failed\n");
ok(GetLastError() == ERROR_INTERNET_BAD_OPTION_LENGTH, "GetLastError() = %d\n", GetLastError());
ulArg = 11;
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
- ok(ret == TRUE, "InternetQueryOption should've succeeded\n");
+ ok(ret == TRUE, "InternetSetOption should've succeeded\n");
SetLastError(0xdeadbeef);
ulArg = 4;
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
- ok(ret == FALSE, "InternetQueryOption should've failed\n");
+ ok(ret == FALSE, "InternetSetOption should've failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
SetLastError(0xdeadbeef);
ulArg = 16;
ret = InternetSetOptionA(req, INTERNET_OPTION_ERROR_MASK, (void*)&ulArg, sizeof(ULONG));
- ok(ret == FALSE, "InternetQueryOption should've failed\n");
+ ok(ret == FALSE, "InternetSetOption should've failed\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError() = %x\n", GetLastError());
ret = InternetCloseHandle(req);
--
2.5.0