Skip to content
Snippets Groups Projects
Verified Commit 6c2350a9 authored by Andrei Gherzan's avatar Andrei Gherzan :penguin:
Browse files

webkitgtk: Add staging fix for musl support

This fix was already pushed to oe-core mailing list[1]. Patch was also
rebased for the `dunfell` branch and included in the staging layer while
it gets merged in upstream.

[1] https://lists.openembedded.org/g/openembedded-core/message/149590



Signed-off-by: Andrei Gherzan's avatarAndrei Gherzan <andrei.gherzan@huawei.com>
parent 59b05faa
No related branches found
No related tags found
No related merge requests found
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:
# SPDX-FileCopyrightText: Huawei Inc.
#
# SPDX-License-Identifier: Apache-2.0
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://musl-lower-stack-usage.patch"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment