diff options
author | A. Wilcox <AWilcox@Wilcox-Tech.com> | 2022-12-25 01:49:26 -0600 |
---|---|---|
committer | Zach van Rijn <me@zv.io> | 2022-12-25 11:03:04 -0600 |
commit | 0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988 (patch) | |
tree | 5ae067a124c5eb5a161542a1d83625ccba13906c /system/gcc | |
parent | 0f40628d7db93efde48cc048e7c9068e1aa84a17 (diff) | |
download | packages-0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988.tar.gz packages-0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988.tar.bz2 packages-0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988.tar.xz packages-0dd86764f0e6c25e6f6e6f38c72c35f4d34d6988.zip |
system/gcc: Ensure gccgo doesn't run off the stack
libucontext doesn't clear the stack frame below makecontext. This
caused us to end up crashing like Solaris[1].
Fixes: #832
[1]: https://gcc.gnu.org/PR52583#c21
Diffstat (limited to 'system/gcc')
-rw-r--r-- | system/gcc/341-gccgo-libucontext-stack.patch | 18 | ||||
-rw-r--r-- | system/gcc/APKBUILD | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/system/gcc/341-gccgo-libucontext-stack.patch b/system/gcc/341-gccgo-libucontext-stack.patch new file mode 100644 index 000000000..2befc5d32 --- /dev/null +++ b/system/gcc/341-gccgo-libucontext-stack.patch @@ -0,0 +1,18 @@ +Similar to Solaris, libucontext does not clear the stack below makecontext. +This causes the Go frontend to sometimes go below the stack. + +On 32-bit Arm systems, this resulted in #832. It is likely, though not known, +that this could have caused other issues we've seen in gccgo as well. + +--- gcc-8.5.0/libgo/runtime/go-callers.c.old 2021-05-14 03:42:11.000000000 -0500 ++++ gcc-8.5.0/libgo/runtime/go-callers.c 2022-12-25 01:46:15.834110528 -0600 +@@ -117,7 +117,8 @@ + Solaris (http://gcc.gnu.org/PR52583 comment #21). */ + if (function != NULL) + { +- if (__builtin_strcmp (function, "makecontext") == 0) ++ if (__builtin_strcmp (function, "makecontext") == 0 ++ || __builtin_strcmp (function, "libucontext_makecontext") == 0) + return 1; + if (filename != NULL) + { diff --git a/system/gcc/APKBUILD b/system/gcc/APKBUILD index ff4649fb9..6ce9887b6 100644 --- a/system/gcc/APKBUILD +++ b/system/gcc/APKBUILD @@ -181,6 +181,7 @@ source="https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz 338-gccgo-syscall.patch 339-gccgo-errstr.patch 340-gccgo-time64-stat.patch + 341-gccgo-libucontext-stack.patch add-classic_table-support.patch gcc-5.4.0-locale.patch @@ -580,6 +581,7 @@ c2916948b028e1e990e1953875b884561c0f8dd105c1ec03073795df9a47ec2c627cbc95ca0ec98a 0bdf592ec8444c6e253f1a7626b4e618b2e18e6d0b5a4548f90903f9de80a7cf3ea536750c2743f436a05faa1e7b65e52a391da9732dce51c4b00e23853e5365 338-gccgo-syscall.patch b32d496a3a04c2357200b75dbf7f667fb57bf5af4f0c68926bc58f6600e4f23caa48aad2eaf073f1408168cacf27e8f11a6062c65bf5bb67458eedef698871d4 339-gccgo-errstr.patch 4db4a00dff1d3cb3ecbc713659316782ac839478ff1fd7166cfa64a2c7cee0ba2a0d3fa23cb858af7d8f59a6ac2bdf40e63a45c307b89eefe2a4e888707f615b 340-gccgo-time64-stat.patch +71ee2ce239c62bedc90d0688a40e3e381e641ba9e322c6319c2f6a4362c17d60a232dcb32fd08f5ff9ed5c058c0a010362197839cb391d85bc4a6446943ad4b2 341-gccgo-libucontext-stack.patch 1860593584f629d24d5b6db14b0a3412e9f93449b663aaa4981301a0923db0159314905e694f27366fbfef72dce06636ab6df86862b7e9e9564847e03bee82c1 add-classic_table-support.patch 67a75a94fdba69de96b98dbc2978a50cb197857c464b81f7c956176da7066b3be937e40cb15e0870fc1e7382d662c5101bcd18cf457fc4112de41802042b51c4 gcc-5.4.0-locale.patch 65a4d8bf9cefcbc79e86015ef4376b2794492d6cae77065359b35bb4ed630dde6256982cd5e43ed837cbbdab366ea376da9f1c83f80ddf6dc53ab017b378c3cd backport-r267157-posix-conformant-snprintf.patch |