Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b8d0a59a
Commit
b8d0a59a
authored
Sep 12, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Get rid of the VPROT_VALLOC flag.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1c8a36a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
virtual.c
dlls/ntdll/virtual.c
+11
-9
No files found.
dlls/ntdll/virtual.c
View file @
b8d0a59a
...
@@ -84,7 +84,6 @@ struct file_view
...
@@ -84,7 +84,6 @@ struct file_view
#define VPROT_WRITEWATCH 0x40
#define VPROT_WRITEWATCH 0x40
/* per-mapping protection flags */
/* per-mapping protection flags */
#define VPROT_SYSTEM 0x0200
/* system view (underlying mmap not under our control) */
#define VPROT_SYSTEM 0x0200
/* system view (underlying mmap not under our control) */
#define VPROT_VALLOC 0x0400
/* allocated by VirtualAlloc */
/* Conversion from VPROT_* to Win32 flags */
/* Conversion from VPROT_* to Win32 flags */
static
const
BYTE
VIRTUAL_Win32Flags
[
16
]
=
static
const
BYTE
VIRTUAL_Win32Flags
[
16
]
=
...
@@ -169,6 +168,10 @@ static void *preload_reserve_end;
...
@@ -169,6 +168,10 @@ static void *preload_reserve_end;
static
BOOL
use_locks
;
static
BOOL
use_locks
;
static
BOOL
force_exec_prot
;
/* whether to force PROT_EXEC on all PROT_READ mmaps */
static
BOOL
force_exec_prot
;
/* whether to force PROT_EXEC on all PROT_READ mmaps */
static
inline
int
is_view_valloc
(
const
struct
file_view
*
view
)
{
return
!
(
view
->
protect
&
(
SEC_FILE
|
SEC_RESERVE
|
SEC_COMMIT
));
}
/***********************************************************************
/***********************************************************************
* get_page_vprot
* get_page_vprot
...
@@ -897,7 +900,7 @@ static NTSTATUS set_protection( struct file_view *view, void *base, SIZE_T size,
...
@@ -897,7 +900,7 @@ static NTSTATUS set_protection( struct file_view *view, void *base, SIZE_T size,
NTSTATUS
status
;
NTSTATUS
status
;
if
((
status
=
get_vprot_flags
(
protect
,
&
vprot
,
view
->
protect
&
SEC_IMAGE
)))
return
status
;
if
((
status
=
get_vprot_flags
(
protect
,
&
vprot
,
view
->
protect
&
SEC_IMAGE
)))
return
status
;
if
(
view
->
protect
&
VPROT_VALLOC
)
if
(
is_view_valloc
(
view
)
)
{
{
if
(
vprot
&
VPROT_WRITECOPY
)
return
STATUS_INVALID_PAGE_PROTECTION
;
if
(
vprot
&
VPROT_WRITECOPY
)
return
STATUS_INVALID_PAGE_PROTECTION
;
}
}
...
@@ -1712,7 +1715,7 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi
...
@@ -1712,7 +1715,7 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
((
status
=
map_view
(
&
view
,
NULL
,
size
,
0xffff
,
0
,
if
((
status
=
map_view
(
&
view
,
NULL
,
size
,
0xffff
,
0
,
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
|
VPROT_VALLOC
))
!=
STATUS_SUCCESS
)
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
))
!=
STATUS_SUCCESS
)
goto
done
;
goto
done
;
#ifdef VALGRIND_STACK_REGISTER
#ifdef VALGRIND_STACK_REGISTER
...
@@ -2172,7 +2175,6 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_
...
@@ -2172,7 +2175,6 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_
{
{
if
(
!
(
status
=
get_vprot_flags
(
protect
,
&
vprot
,
FALSE
)))
if
(
!
(
status
=
get_vprot_flags
(
protect
,
&
vprot
,
FALSE
)))
{
{
vprot
|=
VPROT_VALLOC
;
if
(
type
&
MEM_COMMIT
)
vprot
|=
VPROT_COMMITTED
;
if
(
type
&
MEM_COMMIT
)
vprot
|=
VPROT_COMMITTED
;
if
(
type
&
MEM_WRITE_WATCH
)
vprot
|=
VPROT_WRITEWATCH
;
if
(
type
&
MEM_WRITE_WATCH
)
vprot
|=
VPROT_WRITEWATCH
;
if
(
protect
&
PAGE_NOCACHE
)
vprot
|=
SEC_NOCACHE
;
if
(
protect
&
PAGE_NOCACHE
)
vprot
|=
SEC_NOCACHE
;
...
@@ -2266,7 +2268,7 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
...
@@ -2266,7 +2268,7 @@ NTSTATUS WINAPI NtFreeVirtualMemory( HANDLE process, PVOID *addr_ptr, SIZE_T *si
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
(
!
(
view
=
VIRTUAL_FindView
(
base
,
size
))
||
!
(
view
->
protect
&
VPROT_VALLOC
))
if
(
!
(
view
=
VIRTUAL_FindView
(
base
,
size
))
||
!
is_view_valloc
(
view
))
{
{
status
=
STATUS_INVALID_PARAMETER
;
status
=
STATUS_INVALID_PARAMETER
;
}
}
...
@@ -2547,8 +2549,8 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
...
@@ -2547,8 +2549,8 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
info
->
Protect
=
(
vprot
&
VPROT_COMMITTED
)
?
VIRTUAL_GetWin32Prot
(
vprot
,
view
->
protect
)
:
0
;
info
->
Protect
=
(
vprot
&
VPROT_COMMITTED
)
?
VIRTUAL_GetWin32Prot
(
vprot
,
view
->
protect
)
:
0
;
info
->
AllocationProtect
=
VIRTUAL_GetWin32Prot
(
view
->
protect
,
view
->
protect
);
info
->
AllocationProtect
=
VIRTUAL_GetWin32Prot
(
view
->
protect
,
view
->
protect
);
if
(
view
->
protect
&
SEC_IMAGE
)
info
->
Type
=
MEM_IMAGE
;
if
(
view
->
protect
&
SEC_IMAGE
)
info
->
Type
=
MEM_IMAGE
;
else
if
(
view
->
protect
&
VPROT_VALLOC
)
info
->
Type
=
MEM_PRIVATE
;
else
if
(
view
->
protect
&
(
SEC_FILE
|
SEC_RESERVE
|
SEC_COMMIT
))
info
->
Type
=
MEM_MAPPED
;
else
info
->
Type
=
MEM_
MAPPED
;
else
info
->
Type
=
MEM_
PRIVATE
;
for
(
ptr
=
base
;
ptr
<
base
+
range_size
;
ptr
+=
page_size
)
for
(
ptr
=
base
;
ptr
<
base
+
range_size
;
ptr
+=
page_size
)
if
((
get_page_vprot
(
ptr
)
^
vprot
)
&
~
VPROT_WRITEWATCH
)
break
;
if
((
get_page_vprot
(
ptr
)
^
vprot
)
&
~
VPROT_WRITEWATCH
)
break
;
info
->
RegionSize
=
ptr
-
base
;
info
->
RegionSize
=
ptr
-
base
;
...
@@ -2927,7 +2929,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
...
@@ -2927,7 +2929,7 @@ NTSTATUS WINAPI NtUnmapViewOfSection( HANDLE process, PVOID addr )
}
}
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
server_enter_uninterrupted_section
(
&
csVirtual
,
&
sigset
);
if
((
view
=
VIRTUAL_FindView
(
addr
,
0
))
&&
!
(
view
->
protect
&
VPROT_VALLOC
))
if
((
view
=
VIRTUAL_FindView
(
addr
,
0
))
&&
!
is_view_valloc
(
view
))
{
{
delete_view
(
view
);
delete_view
(
view
);
status
=
STATUS_SUCCESS
;
status
=
STATUS_SUCCESS
;
...
@@ -3210,7 +3212,7 @@ NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID addr1, PVOID addr2)
...
@@ -3210,7 +3212,7 @@ NTSTATUS WINAPI NtAreMappedFilesTheSame(PVOID addr1, PVOID addr2)
if
(
!
view1
||
!
view2
)
if
(
!
view1
||
!
view2
)
status
=
STATUS_INVALID_ADDRESS
;
status
=
STATUS_INVALID_ADDRESS
;
else
if
(
(
view1
->
protect
&
VPROT_VALLOC
)
||
(
view2
->
protect
&
VPROT_VALLOC
))
else
if
(
is_view_valloc
(
view1
)
||
is_view_valloc
(
view2
))
status
=
STATUS_CONFLICTING_ADDRESSES
;
status
=
STATUS_CONFLICTING_ADDRESSES
;
else
if
(
view1
==
view2
)
else
if
(
view1
==
view2
)
status
=
STATUS_SUCCESS
;
status
=
STATUS_SUCCESS
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment