diff --git a/meta-ohos-staging/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch b/meta-ohos-staging/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch new file mode 100644 index 0000000000000000000000000000000000000000..19a8092b163f49d310d09de2c438e1a8361dbfb0 --- /dev/null +++ b/meta-ohos-staging/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch @@ -0,0 +1,61 @@ +From 75316653c46b0cc1f50873d6a57cdae98bae91d5 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 17 Mar 2021 13:28:04 +0000 +Subject: [PATCH] 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 + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com> + +--- + Source/JavaScriptCore/runtime/OptionsList.h | 20 ++++++++++++++++---- + 1 file changed, 16 insertions(+), 4 deletions(-) + +diff --git a/Source/JavaScriptCore/runtime/OptionsList.h b/Source/JavaScriptCore/runtime/OptionsList.h +index 8ebd88e7..a8c15d8e 100644 +--- a/Source/JavaScriptCore/runtime/OptionsList.h ++++ b/Source/JavaScriptCore/runtime/OptionsList.h +@@ -75,6 +75,18 @@ constexpr bool enableWebAssemblyStreamingApi = false; + // 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 = 80 * 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, true, 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 enableWebAssemblyStreamingApi = false; + \ + 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, crashIfCantAllocateJITMemory, false, Normal, nullptr) \ + v(Unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \ +@@ -569,7 +581,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: diff --git a/meta-ohos-staging/recipes-sato/webkit/webkitgtk_2.28.2.bbappend b/meta-ohos-staging/recipes-sato/webkit/webkitgtk_2.28.2.bbappend new file mode 100644 index 0000000000000000000000000000000000000000..0ec26f9d0c6e4fae936499f2ab7cf90201315632 --- /dev/null +++ b/meta-ohos-staging/recipes-sato/webkit/webkitgtk_2.28.2.bbappend @@ -0,0 +1,6 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +SRC_URI += "file://musl-lower-stack-usage.patch"