diff options
| author | Khem Raj <raj.khem@gmail.com> | 2021-03-17 13:24:57 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-20 18:54:55 +0000 |
| commit | c9dd83cd206617b441ee4a96719999496a229468 (patch) | |
| tree | 05b6b0d75fe4e345c4a632991ff38fa1c43733d3 /meta | |
| parent | 3407f8566de53c7d990fd5be7458c2dda49c87cb (diff) | |
| download | poky-c9dd83cd206617b441ee4a96719999496a229468.tar.gz | |
webkitgtk: Reduce stack and heap sizes for jsc on musl
Fixes
[YOCTO #14281]
(From OE-Core rev: 5be97052ecfd5cc510651dddeb1291183240d1f3)
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')
| -rw-r--r-- | meta/recipes-sato/webkit/webkitgtk/musl-lower-stack-usage.patch | 74 | ||||
| -rw-r--r-- | meta/recipes-sato/webkit/webkitgtk_2.30.5.bb | 1 |
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 @@ | |||
| 1 | reduce thread stack and heap usage for javascriptcore on musl | ||
| 2 | |||
| 3 | default sizes for musl are smaller compared to glibc, this matches | ||
| 4 | to musl defaults, avoid stack overflow crashes in jscore | ||
| 5 | |||
| 6 | This is based on Alpine Linux's patch based on suggestion from | ||
| 7 | https://bugs.webkit.org/show_bug.cgi?id=187485 | ||
| 8 | |||
| 9 | Real solution would entail more as the suggestions to increase | ||
| 10 | stack size via -Wl,-z,stack-size=N does not work fully and also | ||
| 11 | setting DEFAULT_THREAD_STACK_SIZE_IN_KB alone is not enough either | ||
| 12 | |||
| 13 | This patch only changes behavior when using musl, the defaults for | ||
| 14 | glibc in OE remains same | ||
| 15 | |||
| 16 | Upstream-Status: Pending | ||
| 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 18 | |||
| 19 | --- a/Source/JavaScriptCore/runtime/OptionsList.h | ||
| 20 | +++ b/Source/JavaScriptCore/runtime/OptionsList.h | ||
| 21 | @@ -75,6 +75,18 @@ constexpr bool enableWebAssemblyStreamin | ||
| 22 | // On instantiation of the first VM instance, the Options will be write protected | ||
| 23 | // and cannot be modified thereafter. | ||
| 24 | |||
| 25 | +#if OS(LINUX) && !defined(__GLIBC__) | ||
| 26 | +// non-glibc options on linux ( musl ) | ||
| 27 | +constexpr unsigned jscMaxPerThreadStack = 128 * KB; | ||
| 28 | +constexpr unsigned jscSoftReservedZoneSize = 32 * KB; | ||
| 29 | +constexpr unsigned jscReservedZoneSize = 16 * KB; | ||
| 30 | +#else | ||
| 31 | +//default | ||
| 32 | +constexpr unsigned jscMaxPerThreadStack = 4 * MB; | ||
| 33 | +constexpr unsigned jscSoftReservedZoneSize = 128 * KB; | ||
| 34 | +constexpr unsigned jscReservedZoneSize = 64 * KB; | ||
| 35 | +#endif | ||
| 36 | + | ||
| 37 | #define FOR_EACH_JSC_OPTION(v) \ | ||
| 38 | v(Bool, useKernTCSM, defaultTCSMValue(), Normal, "Note: this needs to go before other options since they depend on this value.") \ | ||
| 39 | v(Bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \ | ||
| 40 | @@ -90,9 +102,9 @@ constexpr bool enableWebAssemblyStreamin | ||
| 41 | \ | ||
| 42 | v(Bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \ | ||
| 43 | \ | ||
| 44 | - v(Unsigned, maxPerThreadStackUsage, 5 * MB, Normal, "Max allowed stack usage by the VM") \ | ||
| 45 | - v(Unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \ | ||
| 46 | - 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).") \ | ||
| 47 | + v(Unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \ | ||
| 48 | + v(Unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \ | ||
| 49 | + 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).") \ | ||
| 50 | \ | ||
| 51 | v(Bool, crashOnDisallowedVMEntry, ASSERT_ENABLED, Normal, "Forces a crash if we attempt to enter the VM when disallowed") \ | ||
| 52 | v(Bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \ | ||
| 53 | @@ -601,7 +613,7 @@ public: | ||
| 54 | bool init(const char*); | ||
| 55 | bool isInRange(unsigned); | ||
| 56 | const char* rangeString() const { return (m_state > InitError) ? m_rangeString : s_nullRangeStr; } | ||
| 57 | - | ||
| 58 | + | ||
| 59 | void dump(PrintStream& out) const; | ||
| 60 | |||
| 61 | private: | ||
| 62 | --- a/Source/WTF/wtf/Threading.h | ||
| 63 | +++ b/Source/WTF/wtf/Threading.h | ||
| 64 | @@ -56,6 +56,10 @@ | ||
| 65 | #include <array> | ||
| 66 | #endif | ||
| 67 | |||
| 68 | +#if OS(LINUX) && !defined(__GLIBC__) | ||
| 69 | +#define DEFAULT_THREAD_STACK_SIZE_IN_KB 128 | ||
| 70 | +#endif | ||
| 71 | + | ||
| 72 | namespace WTF { | ||
| 73 | |||
| 74 | 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 \ | |||
| 20 | file://include_xutil.patch \ | 20 | file://include_xutil.patch \ |
| 21 | file://reduce-memory-overheads.patch \ | 21 | file://reduce-memory-overheads.patch \ |
| 22 | file://0001-Extend-atomics-check-to-include-1-byte-CAS-test.patch \ | 22 | file://0001-Extend-atomics-check-to-include-1-byte-CAS-test.patch \ |
| 23 | file://musl-lower-stack-usage.patch \ | ||
| 23 | " | 24 | " |
| 24 | 25 | ||
| 25 | SRC_URI[sha256sum] = "7d0dab08e3c5ae07bec80b2822ef42e952765d5724cac86eb23999bfed5a7f1f" | 26 | SRC_URI[sha256sum] = "7d0dab08e3c5ae07bec80b2822ef42e952765d5724cac86eb23999bfed5a7f1f" |
