From 0856267750b15efaf93e6941ffb23b2ebb192f25 Mon Sep 17 00:00:00 2001 From: Karim Pinter Date: Fri, 7 Feb 2025 16:03:48 +0200 Subject: [PATCH] Set allocated memory to 0 on VxWorks When VxWorks is configured with RTP_MEM_FILL false for performance reasons, then it is not filling the allocated memory to 0, causing the QML engine to crash, because it is expecting that it is filled with 0s. This change handles this scenario by calling memset 0 on the allocated memory. Qt needs to be configured with QT_RTP_MEM_FILL define. Task-number: QTBUG-133305 Pick-to: 6.8 6.9 Change-Id: I885c3cad7d81a11b8a0c125ddc098751b9643392 Reviewed-by: Ulf Hermann --- src/3rdparty/masm/wtf/OSAllocatorPosix.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp index daa35a3cd7..02d3bf707c 100644 --- a/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp +++ b/src/3rdparty/masm/wtf/OSAllocatorPosix.cpp @@ -185,6 +185,11 @@ void* OSAllocator::reserveAndCommit(size_t bytes, Usage usage, bool writable, bo #endif CRASH(); } +#if OS(VXWORKS) && defined(QT_RTP_MEM_FILL) && QT_RTP_MEM_FILL + // page allocator expects mmap'ed memory to be zero'ed + memset(result, 0, bytes); +#endif + if (result && includesGuardPages) { // We use mmap to remap the guardpages rather than using mprotect as // mprotect results in multiple references to the code region. This