diff options
| -rw-r--r-- | meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch | 77 | ||||
| -rw-r--r-- | meta/recipes-sato/webkit/webkitgtk_2.34.5.bb | 1 |
2 files changed, 0 insertions, 78 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 deleted file mode 100644 index d8d36fad6b..0000000000 --- a/meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | From 358a8f053c367aab7fba8ab059244e0530c7ff82 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Wed, 17 Mar 2021 13:24:57 -0700 | ||
| 4 | Subject: [PATCH] reduce thread stack and heap usage for javascriptcore on musl | ||
| 5 | |||
| 6 | default sizes for musl are smaller compared to glibc, this matches | ||
| 7 | to musl defaults, avoid stack overflow crashes in jscore | ||
| 8 | |||
| 9 | This is based on Alpine Linux's patch based on suggestion from | ||
| 10 | https://bugs.webkit.org/show_bug.cgi?id=187485 | ||
| 11 | |||
| 12 | Real solution would entail more as the suggestions to increase | ||
| 13 | stack size via -Wl,-z,stack-size=N does not work fully and also | ||
| 14 | setting DEFAULT_THREAD_STACK_SIZE_IN_KB alone is not enough either | ||
| 15 | |||
| 16 | This patch only changes behavior when using musl, the defaults for | ||
| 17 | glibc in OE remains same | ||
| 18 | |||
| 19 | Upstream-Status: Accepted | ||
| 20 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 21 | |||
| 22 | --- | ||
| 23 | Source/JavaScriptCore/runtime/OptionsList.h | 18 +++++++++++++++--- | ||
| 24 | Source/WTF/wtf/Threading.h | 4 ++++ | ||
| 25 | 2 files changed, 19 insertions(+), 3 deletions(-) | ||
| 26 | |||
| 27 | diff --git a/Source/JavaScriptCore/runtime/OptionsList.h b/Source/JavaScriptCore/runtime/OptionsList.h | ||
| 28 | index a0c2170e..9e107af7 100644 | ||
| 29 | --- a/Source/JavaScriptCore/runtime/OptionsList.h | ||
| 30 | +++ b/Source/JavaScriptCore/runtime/OptionsList.h | ||
| 31 | @@ -77,6 +77,18 @@ bool canUseWebAssemblyFastMemory(); | ||
| 32 | // On instantiation of the first VM instance, the Options will be write protected | ||
| 33 | // and cannot be modified thereafter. | ||
| 34 | |||
| 35 | +#if OS(LINUX) && !defined(__GLIBC__) | ||
| 36 | +// non-glibc options on linux ( musl ) | ||
| 37 | +constexpr unsigned jscMaxPerThreadStack = 128 * KB; | ||
| 38 | +constexpr unsigned jscSoftReservedZoneSize = 32 * KB; | ||
| 39 | +constexpr unsigned jscReservedZoneSize = 16 * KB; | ||
| 40 | +#else | ||
| 41 | +//default | ||
| 42 | +constexpr unsigned jscMaxPerThreadStack = 4 * MB; | ||
| 43 | +constexpr unsigned jscSoftReservedZoneSize = 128 * KB; | ||
| 44 | +constexpr unsigned jscReservedZoneSize = 64 * KB; | ||
| 45 | +#endif | ||
| 46 | + | ||
| 47 | #define FOR_EACH_JSC_OPTION(v) \ | ||
| 48 | v(Bool, useKernTCSM, defaultTCSMValue(), Normal, "Note: this needs to go before other options since they depend on this value.") \ | ||
| 49 | v(Bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \ | ||
| 50 | @@ -92,9 +104,9 @@ bool canUseWebAssemblyFastMemory(); | ||
| 51 | \ | ||
| 52 | v(Bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \ | ||
| 53 | \ | ||
| 54 | - v(Unsigned, maxPerThreadStackUsage, 5 * MB, Normal, "Max allowed stack usage by the VM") \ | ||
| 55 | - v(Unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \ | ||
| 56 | - 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).") \ | ||
| 57 | + v(Unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \ | ||
| 58 | + v(Unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \ | ||
| 59 | + 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).") \ | ||
| 60 | \ | ||
| 61 | v(Bool, crashOnDisallowedVMEntry, ASSERT_ENABLED, Normal, "Forces a crash if we attempt to enter the VM when disallowed") \ | ||
| 62 | v(Bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \ | ||
| 63 | diff --git a/Source/WTF/wtf/Threading.h b/Source/WTF/wtf/Threading.h | ||
| 64 | index 178f9808..95ec5a85 100644 | ||
| 65 | --- a/Source/WTF/wtf/Threading.h | ||
| 66 | +++ b/Source/WTF/wtf/Threading.h | ||
| 67 | @@ -67,6 +67,10 @@ | ||
| 68 | #undef None | ||
| 69 | #endif | ||
| 70 | |||
| 71 | +#if OS(LINUX) && !defined(__GLIBC__) | ||
| 72 | +#define DEFAULT_THREAD_STACK_SIZE_IN_KB 128 | ||
| 73 | +#endif | ||
| 74 | + | ||
| 75 | namespace WTF { | ||
| 76 | |||
| 77 | class AbstractLocker; | ||
diff --git a/meta/recipes-sato/webkit/webkitgtk_2.34.5.bb b/meta/recipes-sato/webkit/webkitgtk_2.34.5.bb index 227ac2bf72..e6362bedc3 100644 --- a/meta/recipes-sato/webkit/webkitgtk_2.34.5.bb +++ b/meta/recipes-sato/webkit/webkitgtk_2.34.5.bb | |||
| @@ -16,7 +16,6 @@ SRC_URI = "https://www.webkitgtk.org/releases/${BPN}-${PV}.tar.xz \ | |||
| 16 | file://0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch \ | 16 | file://0001-Tweak-gtkdoc-settings-so-that-gtkdoc-generation-work.patch \ |
| 17 | file://0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch \ | 17 | file://0001-Enable-THREADS_PREFER_PTHREAD_FLAG.patch \ |
| 18 | file://reduce-memory-overheads.patch \ | 18 | file://reduce-memory-overheads.patch \ |
| 19 | file://musl-lower-stack-usage.patch \ | ||
| 20 | file://0001-Fix-build-without-opengl-or-es.patch \ | 19 | file://0001-Fix-build-without-opengl-or-es.patch \ |
| 21 | file://reproducibility.patch \ | 20 | file://reproducibility.patch \ |
| 22 | " | 21 | " |
