aboutsummaryrefslogtreecommitdiffstats
path: root/src/3rdparty
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2016-11-22 10:20:47 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2016-11-22 09:59:02 +0000
commitb160cd4eda1c2a8284f4eb0d10e715f98c8bda88 (patch)
tree9cbbb97585fc3ad71adbf39e70ff18dd31527d03 /src/3rdparty
parent5b2c71877a34597b82d2ce81494b9e91c7e31cb8 (diff)
Allow for the QML engine to run on "hardened" Linux systems
Similar to WinRT let's test whether we can allocate executable memory before enabling the JIT. The caller code will fall back to the interpreter. Task-number: QTBUG-56758 Change-Id: I63d6830c6acc8cb316333162be212e1764483baa Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/3rdparty')
-rw-r--r--src/3rdparty/masm/wtf/OSAllocatorPosix.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
index bbf11e4488..0c902c7172 100644
--- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
+++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp
@@ -191,6 +191,16 @@ void OSAllocator::releaseDecommitted(void* address, size_t bytes)
bool OSAllocator::canAllocateExecutableMemory()
{
+ int flags = MAP_PRIVATE | MAP_ANON;
+#if PLATFORM(IOS)
+ if (executable)
+ flags |= MAP_JIT;
+#endif
+ const auto size = pageSize();
+ void *testPage = mmap(nullptr, size, PROT_READ | PROT_WRITE | PROT_EXEC, flags, /*fd*/-1, /*offset*/0);
+ if (testPage == MAP_FAILED)
+ return false;
+ munmap(testPage, size);
return true;
}