2014-10-18 23:54:16 -07:00
|
|
|
From 566ff0e978e59354160a1d2cdde79cb9e5ead244 Mon Sep 17 00:00:00 2001
|
2014-10-03 18:24:43 -07:00
|
|
|
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
|
|
|
Date: Sat, 4 Oct 2014 03:22:09 +0200
|
|
|
|
Subject: ntdll: Only enable true WRITECOPY protection when a special
|
|
|
|
environment variable is set.
|
|
|
|
|
|
|
|
---
|
|
|
|
dlls/ntdll/virtual.c | 23 ++++++++++++++++++++++-
|
|
|
|
1 file changed, 22 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
2014-10-18 23:54:16 -07:00
|
|
|
index d26fe26..02e32fb 100644
|
2014-10-03 18:24:43 -07:00
|
|
|
--- a/dlls/ntdll/virtual.c
|
|
|
|
+++ b/dlls/ntdll/virtual.c
|
|
|
|
@@ -166,6 +166,21 @@ static const char *VIRTUAL_GetProtStr( BYTE prot )
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
+/* This might look like a hack, but it actually isn't - the 'experimental' version
|
|
|
|
+ * is correct, but it already has revealed a couple of additional Wine bugs, which
|
|
|
|
+ * were not triggered before, and there are probably some more.
|
|
|
|
+ * To avoid breaking Wine for everyone, the new correct implementation has to be
|
|
|
|
+ * manually enabled, until it is tested a bit more. */
|
|
|
|
+static inline BOOL experimental_WRITECOPY( void )
|
|
|
|
+{
|
|
|
|
+ static int enabled = -1;
|
|
|
|
+ if (enabled == -1)
|
|
|
|
+ {
|
2014-11-03 16:47:28 -08:00
|
|
|
+ const char *str = getenv("STAGING_WRITECOPY");
|
2014-10-03 18:24:43 -07:00
|
|
|
+ enabled = str && (atoi(str) != 0);
|
|
|
|
+ }
|
|
|
|
+ return enabled;
|
|
|
|
+}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* VIRTUAL_GetUnixProt
|
|
|
|
@@ -181,7 +196,13 @@ static int VIRTUAL_GetUnixProt( BYTE vprot )
|
|
|
|
if (vprot & VPROT_WRITE) prot |= PROT_WRITE | PROT_READ;
|
|
|
|
if (vprot & VPROT_EXEC) prot |= PROT_EXEC | PROT_READ;
|
|
|
|
#if defined(__i386__)
|
2014-10-18 23:54:16 -07:00
|
|
|
- if (vprot & VPROT_WRITECOPY) prot = (prot & ~PROT_WRITE) | PROT_READ;
|
2014-10-03 18:24:43 -07:00
|
|
|
+ if (vprot & VPROT_WRITECOPY)
|
|
|
|
+ {
|
|
|
|
+ if (experimental_WRITECOPY())
|
2014-10-18 23:54:16 -07:00
|
|
|
+ prot = (prot & ~PROT_WRITE) | PROT_READ;
|
2014-10-03 18:24:43 -07:00
|
|
|
+ else
|
|
|
|
+ prot |= PROT_WRITE | PROT_READ;
|
|
|
|
+ }
|
|
|
|
#else
|
|
|
|
/* FIXME: Architecture needs implementation of signal_init_early. */
|
|
|
|
if (vprot & VPROT_WRITECOPY) prot |= PROT_WRITE | PROT_READ;
|
|
|
|
--
|
2014-10-18 23:54:16 -07:00
|
|
|
2.1.2
|
2014-10-03 18:24:43 -07:00
|
|
|
|