[PATCH] ntdll: report a failed executable mmap on nonexec filesystems

Marcus Meissner meissner at suse.de
Fri Dec 10 08:51:43 CST 2010


Hi,

Otherwise it is not really obvious we tried to load executable
code from a nonexec filesystem.

Ciao, Marcus
---
 dlls/ntdll/virtual.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index d7a04c3..b6bb904 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -877,6 +877,9 @@ 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. */
-- 
1.7.1



More information about the wine-patches mailing list