1 |
commit: 60e4a8942f1e6ab43491beab75db633bb53bc857 |
2 |
Author: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Jul 2 17:27:36 2019 +0000 |
4 |
Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jul 2 17:27:36 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=60e4a894 |
7 |
|
8 |
media-libs/mesa: Fix stack overflow issues with musl, upstream patch |
9 |
|
10 |
Package-Manager: Portage-2.3.68, Repoman-2.3.16 |
11 |
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org> |
12 |
|
13 |
.../files/mesa-19.1.0-cache_stack_overflow.patch | 56 ++++++++++++++++++++++ |
14 |
.../{mesa-19.1.1.ebuild => mesa-19.1.1-r1.ebuild} | 1 + |
15 |
2 files changed, 57 insertions(+) |
16 |
|
17 |
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 |
18 |
new file mode 100644 |
19 |
index 0000000..3d6a8df |
20 |
--- /dev/null |
21 |
+++ b/media-libs/mesa/files/mesa-19.1.0-cache_stack_overflow.patch |
22 |
@@ -0,0 +1,56 @@ |
23 |
+From 594d2ec43022871f3b9ad2737e9d7bb97991b2bb Mon Sep 17 00:00:00 2001 |
24 |
+From: Jory Pratt <anarchy@g.o> |
25 |
+Date: Mon, 17 Jun 2019 09:57:46 -0500 |
26 |
+Subject: [PATCH] The disk cache code tries to allocate a 256 Kbyte buffer on |
27 |
+ the stack. Since musl only gives 80 Kbyte of stack space per thread, this |
28 |
+ causes a trap. |
29 |
+ |
30 |
+Signed-off-by: Jory Pratt <anarchy@g.o> |
31 |
+--- |
32 |
+ src/util/disk_cache.c | 9 ++++++++- |
33 |
+ 1 file changed, 8 insertions(+), 1 deletion(-) |
34 |
+ |
35 |
+diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c |
36 |
+index 9977c38..c23abdb 100644 |
37 |
+--- a/src/util/disk_cache.c |
38 |
++++ b/src/util/disk_cache.c |
39 |
+@@ -732,7 +732,7 @@ static size_t |
40 |
+ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, |
41 |
+ const char *filename) |
42 |
+ { |
43 |
+- unsigned char out[BUFSIZE]; |
44 |
++ unsigned char *out; |
45 |
+ |
46 |
+ /* allocate deflate state */ |
47 |
+ z_stream strm; |
48 |
+@@ -749,6 +749,11 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, |
49 |
+ /* compress until end of in_data */ |
50 |
+ size_t compressed_size = 0; |
51 |
+ int flush; |
52 |
++ |
53 |
++ out = calloc(1, BUFSIZE); |
54 |
++ if (out == NULL) |
55 |
++ return 0; |
56 |
++ |
57 |
+ do { |
58 |
+ int remaining = in_data_size - BUFSIZE; |
59 |
+ flush = remaining > 0 ? Z_NO_FLUSH : Z_FINISH; |
60 |
+@@ -770,6 +775,7 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, |
61 |
+ ssize_t written = write_all(dest, out, have); |
62 |
+ if (written == -1) { |
63 |
+ (void)deflateEnd(&strm); |
64 |
++ free(out); |
65 |
+ return 0; |
66 |
+ } |
67 |
+ } while (strm.avail_out == 0); |
68 |
+@@ -784,6 +790,7 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, |
69 |
+ |
70 |
+ /* clean up and return */ |
71 |
+ (void)deflateEnd(&strm); |
72 |
++ free(out); |
73 |
+ return compressed_size; |
74 |
+ } |
75 |
+ |
76 |
+-- |
77 |
+2.22.0 |
78 |
+ |
79 |
|
80 |
diff --git a/media-libs/mesa/mesa-19.1.1.ebuild b/media-libs/mesa/mesa-19.1.1-r1.ebuild |
81 |
similarity index 99% |
82 |
rename from media-libs/mesa/mesa-19.1.1.ebuild |
83 |
rename to media-libs/mesa/mesa-19.1.1-r1.ebuild |
84 |
index 759f4d0..a7bff8c 100644 |
85 |
--- a/media-libs/mesa/mesa-19.1.1.ebuild |
86 |
+++ b/media-libs/mesa/mesa-19.1.1-r1.ebuild |
87 |
@@ -244,6 +244,7 @@ PATCHES=( |
88 |
"${FILESDIR}"/${PN}-18-musl-invocation_name.patch |
89 |
"${FILESDIR}"/${PN}-18-musl-pthread.patch |
90 |
"${FILESDIR}"/${PN}-18.2.4-add-disable-tls-support.patch |
91 |
+ "${FILESDIR}"/${PN}-19.1.0-cache_stack_overflow.patch |
92 |
) |
93 |
|
94 |
llvm_check_deps() { |