diff options
author | Jory Pratt <anarchy@gentoo.org> | 2019-07-02 12:27:36 -0500 |
---|---|---|
committer | Jory Pratt <anarchy@gentoo.org> | 2019-07-02 12:27:36 -0500 |
commit | 60e4a8942f1e6ab43491beab75db633bb53bc857 (patch) | |
tree | ee0d20592bf9929e7f6143947da4b309edf58ab7 | |
parent | media-libs/mesa: fix tls issue in 19.1.1 (diff) | |
download | musl-60e4a894.tar.gz musl-60e4a894.tar.bz2 musl-60e4a894.zip |
media-libs/mesa: Fix stack overflow issues with musl, upstream patch
Package-Manager: Portage-2.3.68, Repoman-2.3.16
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
-rw-r--r-- | media-libs/mesa/files/mesa-19.1.0-cache_stack_overflow.patch | 56 | ||||
-rw-r--r-- | media-libs/mesa/mesa-19.1.1-r1.ebuild (renamed from media-libs/mesa/mesa-19.1.1.ebuild) | 1 |
2 files changed, 57 insertions, 0 deletions
diff --git a/media-libs/mesa/files/mesa-19.1.0-cache_stack_overflow.patch b/media-libs/mesa/files/mesa-19.1.0-cache_stack_overflow.patch new file mode 100644 index 00000000..3d6a8dfa --- /dev/null +++ b/media-libs/mesa/files/mesa-19.1.0-cache_stack_overflow.patch @@ -0,0 +1,56 @@ +From 594d2ec43022871f3b9ad2737e9d7bb97991b2bb Mon Sep 17 00:00:00 2001 +From: Jory Pratt <anarchy@gentoo.org> +Date: Mon, 17 Jun 2019 09:57:46 -0500 +Subject: [PATCH] The disk cache code tries to allocate a 256 Kbyte buffer on + the stack. Since musl only gives 80 Kbyte of stack space per thread, this + causes a trap. + +Signed-off-by: Jory Pratt <anarchy@gentoo.org> +--- + src/util/disk_cache.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c +index 9977c38..c23abdb 100644 +--- a/src/util/disk_cache.c ++++ b/src/util/disk_cache.c +@@ -732,7 +732,7 @@ static size_t + deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, + const char *filename) + { +- unsigned char out[BUFSIZE]; ++ unsigned char *out; + + /* allocate deflate state */ + z_stream strm; +@@ -749,6 +749,11 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, + /* compress until end of in_data */ + size_t compressed_size = 0; + int flush; ++ ++ out = calloc(1, BUFSIZE); ++ if (out == NULL) ++ return 0; ++ + do { + int remaining = in_data_size - BUFSIZE; + flush = remaining > 0 ? Z_NO_FLUSH : Z_FINISH; +@@ -770,6 +775,7 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, + ssize_t written = write_all(dest, out, have); + if (written == -1) { + (void)deflateEnd(&strm); ++ free(out); + return 0; + } + } while (strm.avail_out == 0); +@@ -784,6 +790,7 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, + + /* clean up and return */ + (void)deflateEnd(&strm); ++ free(out); + return compressed_size; + } + +-- +2.22.0 + diff --git a/media-libs/mesa/mesa-19.1.1.ebuild b/media-libs/mesa/mesa-19.1.1-r1.ebuild index 759f4d0b..a7bff8cb 100644 --- a/media-libs/mesa/mesa-19.1.1.ebuild +++ b/media-libs/mesa/mesa-19.1.1-r1.ebuild @@ -244,6 +244,7 @@ PATCHES=( "${FILESDIR}"/${PN}-18-musl-invocation_name.patch "${FILESDIR}"/${PN}-18-musl-pthread.patch "${FILESDIR}"/${PN}-18.2.4-add-disable-tls-support.patch + "${FILESDIR}"/${PN}-19.1.0-cache_stack_overflow.patch ) llvm_check_deps() { |