diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2022-10-10 12:48:49 +0200 |
---|---|---|
committer | Sami Shalayel <sami.shalayel@qt.io> | 2022-12-09 20:04:56 +0100 |
commit | 4677b2bdd68b71c66d080652dd01e1f49b40f581 (patch) | |
tree | da7580e04f943e65fb7ee0e0594f3c66efcbacf7 /src/qml/CMakeLists.txt | |
parent | 8333954f7e3cccf4994c4e9996efac71db497acb (diff) |
QML: Add an accurate stack bounds checker
This re-introduces a stack bounds checker. The previous stack bounds
checker was removed in commit 74f75a3a120b07bbfe6904512b338db8850874e4
because the cost of determining the stack base was deemed too high.
Indeed, determining the stack base on linux using the pthread functions
costs about 200.000 instructions and the cost grows with the number of
concurrently running threads.
However, by reading /proc/self/maps directly we can trim this to about
125k instructions. Furthermore, with the new implementation we only need
to do this once per engine. Calling JavaScript functions of the same
engine from different threads is not supported. So we don't have to
consider the case of checking the bounds of a different thread than the
one the engine was created in. Furthermore, we get a more accurate
number now, which means we don't have to re-check when we get near the
boundary.
Also, change QV4::markChildQObjectsRecursively() to use an actual
QQueue instead of being recursive. This avoids the stack from overflowing when the stack is already almost full, and was leading to
crashes in the stackOverflow tests.
Make the stack smaller for the the tst_qquickloader::stackOverflow{,2} tests to run faster in the CI (and avoid the timeout).
Task-number: QTBUG-106875
Fixes: QTBUG-108182
Change-Id: Ia5d13caa7d072526ff2a3e1713ec7781afc154a9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/CMakeLists.txt')
-rw-r--r-- | src/qml/CMakeLists.txt | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt index 686c9dfb24..c3457768bf 100644 --- a/src/qml/CMakeLists.txt +++ b/src/qml/CMakeLists.txt @@ -232,6 +232,7 @@ qt_internal_add_qml_module(Qml memory/qv4heap_p.h memory/qv4mm.cpp memory/qv4mm_p.h memory/qv4mmdefs_p.h + memory/qv4stacklimits.cpp memory/qv4stacklimits_p.h memory/qv4writebarrier_p.h parser/qqmljsast.cpp parser/qqmljsast_p.h parser/qqmljsastfwd_p.h @@ -499,6 +500,11 @@ qt_internal_extend_target(Qml CONDITION WIN32 shell32 ) +qt_internal_extend_target(Qml CONDITION LINUX AND QT_FEATURE_dlopen + LIBRARIES + dl +) + #### Keys ignored in scope 7:.:.:qml.pro:solaris-cc_x_: # QMAKE_CXXFLAGS_RELEASE = "--O2" |