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
2e364d25
Commit
2e364d25
authored
Nov 17, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fall back to read() on noexec filesystems also for non-image mappings.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
02d0d68b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
virtual.c
dlls/ntdll/virtual.c
+23
-12
No files found.
dlls/ntdll/virtual.c
View file @
2e364d25
...
...
@@ -1164,18 +1164,29 @@ static NTSTATUS map_file_into_view( struct file_view *view, int fd, size_t start
if
(
mmap
(
(
char
*
)
view
->
base
+
start
,
size
,
prot
,
flags
,
fd
,
offset
)
!=
(
void
*
)
-
1
)
goto
done
;
if
((
errno
==
EPERM
)
&&
(
prot
&
PROT_EXEC
))
ERR
(
"failed to set %08x protection on file map, noexec filesystem?
\n
"
,
prot
);
/* mmap() failed; if this is because the file offset is not */
/* page-aligned (EINVAL), or because the underlying filesystem */
/* does not support mmap() (ENOEXEC,ENODEV), we do it by hand. */
if
((
errno
!=
ENOEXEC
)
&&
(
errno
!=
EINVAL
)
&&
(
errno
!=
ENODEV
))
return
FILE_GetNtStatus
();
if
(
flags
&
MAP_SHARED
)
/* we cannot fake shared mappings */
{
if
(
errno
==
EINVAL
)
return
STATUS_INVALID_PARAMETER
;
ERR
(
"shared writable mmap not supported, broken filesystem?
\n
"
);
return
STATUS_NOT_SUPPORTED
;
switch
(
errno
)
{
case
EINVAL
:
/* file offset is not page-aligned, fall back to read() */
if
(
flags
&
MAP_SHARED
)
return
STATUS_INVALID_PARAMETER
;
break
;
case
ENOEXEC
:
case
ENODEV
:
/* filesystem doesn't support mmap(), fall back to read() */
if
(
flags
&
MAP_SHARED
)
{
ERR
(
"shared writable mmap not supported, broken filesystem?
\n
"
);
return
STATUS_NOT_SUPPORTED
;
}
break
;
case
EPERM
:
/* noexec filesystem, fall back to read() */
if
(
flags
&
MAP_SHARED
)
{
if
(
prot
&
PROT_EXEC
)
ERR
(
"failed to set PROT_EXEC on file map, noexec filesystem?
\n
"
);
return
STATUS_ACCESS_DENIED
;
}
if
(
prot
&
PROT_EXEC
)
WARN
(
"failed to set PROT_EXEC on file map, noexec filesystem?
\n
"
);
break
;
default:
return
FILE_GetNtStatus
();
}
}
...
...
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