summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-03-17 13:24:57 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-03-20 18:50:05 +0000
commit5be97052ecfd5cc510651dddeb1291183240d1f3 (patch)
tree3f1da5f674f4c5066f9e5654325a8caf913bde7b /meta/recipes-sato
parent237411b48d639bd325a54d5a1c9168b776f485e1 (diff)
downloadopenembedded-core-5be97052ecfd5cc510651dddeb1291183240d1f3.tar.gz
webkitgtk: Reduce stack and heap sizes for jsc on musl
Fixes [YOCTO #14281] Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Andrei Gherzan <andrei@gherzan.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-sato')
-rw-r--r--meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch74
-rw-r--r--meta/recipes-sato/webkit/webkitgtk_2.30.5.bb1
2 files changed, 75 insertions, 0 deletions
diff --git a/meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch b/meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch
new file mode 100644
index 0000000000..dc3a71d932
--- /dev/null
+++ b/meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch
@@ -0,0 +1,74 @@
+reduce thread stack and heap usage for javascriptcore on musl
+
+default sizes for musl are smaller compared to glibc, this matches
+to musl defaults, avoid stack overflow crashes in jscore
+
+This is based on Alpine Linux's patch based on suggestion from
+https://bugs.webkit.org/show_bug.cgi?id=187485
+
+Real solution would entail more as the suggestions to increase
+stack size via -Wl,-z,stack-size=N does not work fully and also
+setting DEFAULT_THREAD_STACK_SIZE_IN_KB alone is not enough either
+
+This patch only changes behavior when using musl, the defaults for
+glibc in OE remains same
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+--- a/Source/JavaScriptCore/runtime/OptionsList.h
++++ b/Source/JavaScriptCore/runtime/OptionsList.h
+@@ -75,6 +75,18 @@ constexpr bool enableWebAssemblyStreamin
+ // On instantiation of the first VM instance, the Options will be write protected
+ // and cannot be modified thereafter.
+
++#if OS(LINUX) && !defined(__GLIBC__)
++// non-glibc options on linux ( musl )
++constexpr unsigned jscMaxPerThreadStack = 128 * KB;
++constexpr unsigned jscSoftReservedZoneSize = 32 * KB;
++constexpr unsigned jscReservedZoneSize = 16 * KB;
++#else
++//default
++constexpr unsigned jscMaxPerThreadStack = 4 * MB;
++constexpr unsigned jscSoftReservedZoneSize = 128 * KB;
++constexpr unsigned jscReservedZoneSize = 64 * KB;
++#endif
++
+ #define FOR_EACH_JSC_OPTION(v) \
+ v(Bool, useKernTCSM, defaultTCSMValue(), Normal, "Note: this needs to go before other options since they depend on this value.") \
+ v(Bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \
+@@ -90,9 +102,9 @@ constexpr bool enableWebAssemblyStreamin
+ \
+ v(Bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
+ \
+- v(Unsigned, maxPerThreadStackUsage, 5 * MB, Normal, "Max allowed stack usage by the VM") \
+- v(Unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
+- v(Unsigned, reservedZoneSize, 64 * KB, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
++ v(Unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \
++ v(Unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
++ v(Unsigned, reservedZoneSize, jscReservedZoneSize, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
+ \
+ v(Bool, crashOnDisallowedVMEntry, ASSERT_ENABLED, Normal, "Forces a crash if we attempt to enter the VM when disallowed") \
+ v(Bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
+@@ -601,7 +613,7 @@ public:
+ bool init(const char*);
+ bool isInRange(unsigned);
+ const char* rangeString() const { return (m_state > InitError) ? m_rangeString : s_nullRangeStr; }
+-
++
+ void dump(PrintStream& out) const;
+
+ private:
+--- a/Source/WTF/wtf/Threading.h
++++ b/Source/WTF/wtf/Threading.h
+@@ -56,6 +56,10 @@
+ #include <array>
+ #endif
+
++#if OS(LINUX) && !defined(__GLIBC__)
++#define DEFAULT_THREAD_STACK_SIZE_IN_KB 128
++#endif
++
+ namespace WTF {
+
+ class AbstractLocker;
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.30.5.bb b/meta/recipes-sato/webkit/webkitgtk_2.30.5.bb
index d0a41f48c7..36d33f550d 100644
--- a/meta/recipes-sato/webkit/webkitgtk_2.30.5.bb
+++ b/meta/recipes-sato/webkit/webkitgtk_2.30.5.bb
@@ -20,6 +20,7 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \
file://include_xutil.patch \
file://reduce-memory-overheads.patch \
file://0001-Extend-atomics-check-to-include-1-byte-CAS-test.patch \
+ file://musl-lower-stack-usage.patch \
"
SRC_URI[sha256sum] = "7d0dab08e3c5ae07bec80b2822ef42e952765d5724cac86eb23999bfed5a7f1f"