summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2018-04-01 00:19:45 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-03 23:53:20 +0100
commit4f7e90a0afa9ca685d5c4356255df33f95d915b8 (patch)
tree5f4f3ac323d975435df1f6a72f464ed59c8eef0e /meta
parenta36e4bb2f83f006a413571c89bffb0ece3e04b12 (diff)
downloadpoky-4f7e90a0afa9ca685d5c4356255df33f95d915b8.tar.gz
systemtap: Backport a fix for build with gcc8
(From OE-Core rev: b751e865375b325df4083d85af191da4dc3a27ee) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch215
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.inc1
2 files changed, 216 insertions, 0 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch
new file mode 100644
index 0000000000..a1b0bff02a
--- /dev/null
+++ b/meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch
@@ -0,0 +1,215 @@
1From 4ffe00f1d9eac332d928f7dc01fe250dc32b1bb8 Mon Sep 17 00:00:00 2001
2From: Stan Cox <scox@redhat.com>
3Date: Tue, 13 Feb 2018 22:38:03 -0500
4Subject: [PATCH] Fixes for gcc 8
5
6* includes/sys/sdt.h (__SDT_COND_SIGNED): Add CT, cast type argument
7
8Author: Will Cohen <wcohen.redhat.com>
9
10* stap-serverd.cxx (generate_mok, handleRequest, handle_connection):
11 Catch format overflow
12
13* translate.cxx (translate_pass): Use ref in catch.
14---
15Upstream-Status: Backport
16Signed-off-by: Khem Raj <raj.khem@gmail.com>
17
18 includes/sys/sdt.h | 20 ++++++++--------
19 stap-serverd.cxx | 67 +++++++++++++++++++++++++++++++++++++++++++++++-------
20 translate.cxx | 2 +-
21 3 files changed, 70 insertions(+), 19 deletions(-)
22
23diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h
24index 940f74483..c0c5a492c 100644
25--- a/includes/sys/sdt.h
26+++ b/includes/sys/sdt.h
27@@ -119,8 +119,8 @@ struct __sdt_type
28
29 #define __SDT_ALWAYS_SIGNED(T) \
30 template<> struct __sdt_type<T> { static const bool __sdt_signed = true; };
31-#define __SDT_COND_SIGNED(T) \
32-template<> struct __sdt_type<T> { static const bool __sdt_signed = ((T)(-1) < 1); };
33+#define __SDT_COND_SIGNED(T,CT) \
34+template<> struct __sdt_type<T> { static const bool __sdt_signed = ((CT)(-1) < 1); };
35 __SDT_ALWAYS_SIGNED(signed char)
36 __SDT_ALWAYS_SIGNED(short)
37 __SDT_ALWAYS_SIGNED(int)
38@@ -141,14 +141,14 @@ __SDT_ALWAYS_SIGNED(const volatile short)
39 __SDT_ALWAYS_SIGNED(const volatile int)
40 __SDT_ALWAYS_SIGNED(const volatile long)
41 __SDT_ALWAYS_SIGNED(const volatile long long)
42-__SDT_COND_SIGNED(char)
43-__SDT_COND_SIGNED(wchar_t)
44-__SDT_COND_SIGNED(volatile char)
45-__SDT_COND_SIGNED(volatile wchar_t)
46-__SDT_COND_SIGNED(const char)
47-__SDT_COND_SIGNED(const wchar_t)
48-__SDT_COND_SIGNED(const volatile char)
49-__SDT_COND_SIGNED(const volatile wchar_t)
50+__SDT_COND_SIGNED(char, char)
51+__SDT_COND_SIGNED(wchar_t, wchar_t)
52+__SDT_COND_SIGNED(volatile char, char)
53+__SDT_COND_SIGNED(volatile wchar_t, wchar_t)
54+__SDT_COND_SIGNED(const char, char)
55+__SDT_COND_SIGNED(const wchar_t, wchar_t)
56+__SDT_COND_SIGNED(const volatile char, char)
57+__SDT_COND_SIGNED(const volatile wchar_t, wchar_t)
58 #if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
59 /* __SDT_COND_SIGNED(char16_t) */
60 /* __SDT_COND_SIGNED(char32_t) */
61diff --git a/stap-serverd.cxx b/stap-serverd.cxx
62index 7cf76c617..41f77ee9e 100644
63--- a/stap-serverd.cxx
64+++ b/stap-serverd.cxx
65@@ -1607,6 +1607,7 @@ generate_mok(string &mok_fingerprint)
66 char tmpdir[PATH_MAX] = { '\0' };
67 string public_cert_path, private_cert_path, destdir;
68 mode_t old_umask;
69+ int retlen;
70
71 mok_fingerprint.clear ();
72
73@@ -1631,7 +1632,14 @@ generate_mok(string &mok_fingerprint)
74 }
75
76 // Make a temporary directory to store results in.
77- snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
78+ retlen = snprintf (tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", mok_path.c_str ());
79+ if (retlen < 0 || retlen >= PATH_MAX)
80+ {
81+ server_error (_F("Could not create %s name", "temporary directory"));
82+ tmpdir[0] = '\0';
83+ goto cleanup;
84+ }
85+
86 if (mkdtemp (tmpdir) == NULL)
87 {
88 server_error (_F("Could not create temporary directory %s: %s", tmpdir,
89@@ -1704,6 +1712,7 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
90 unsigned u;
91 unsigned i;
92 FILE* f;
93+ int retlen;
94
95 // Save the server version. Do this early, so the client knows what version of the server
96 // it is dealing with, even if the request is not fully completed.
97@@ -1782,7 +1791,12 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
98 struct stat st;
99 char *arg;
100
101- snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
102+ retlen = snprintf (stapargfile, PATH_MAX, "%s/argv%d", requestDirName.c_str (), i);
103+ if (retlen < 0 || retlen >= PATH_MAX)
104+ {
105+ server_error (_F("Error creating %s name", "path"));
106+ return;
107+ }
108
109 rc = stat(stapargfile, & st);
110 if (rc) break;
111@@ -1888,7 +1902,15 @@ handleRequest (const string &requestDirName, const string &responseDirName, stri
112 {
113 glob_t globber;
114 char pattern[PATH_MAX];
115- snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
116+ int retlen;
117+
118+ retlen = snprintf (pattern, PATH_MAX, "%s/*.ko", new_staptmpdir.c_str());
119+ if (retlen < 0 || retlen >= PATH_MAX)
120+ {
121+ server_error (_F("Error creating %s name", "pattern"));
122+ return;
123+ }
124+
125 rc = glob (pattern, GLOB_ERR, NULL, &globber);
126 if (rc)
127 server_error (_F("Unable to find a module in %s", new_staptmpdir.c_str()));
128@@ -2164,6 +2186,7 @@ handle_connection (void *arg)
129 copy for each connection.*/
130 vector<string> argv;
131 PRInt32 bytesRead;
132+ int retlen;
133
134 /* Detatch to avoid a memory leak */
135 if(max_threads > 0)
136@@ -2213,7 +2236,13 @@ handle_connection (void *arg)
137 #endif
138
139 secStatus = SECFailure;
140- snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
141+ retlen = snprintf(tmpdir, PATH_MAX, "%s/stap-server.XXXXXX", getenv("TMPDIR") ?: "/tmp");
142+ if (retlen < 0 || retlen >= PATH_MAX)
143+ {
144+ server_error (_F("Error creating %s name", "temporary directory"));
145+ tmpdir[0]=0; /* prevent /bin/rm */
146+ goto cleanup;
147+ }
148 rc1 = mkdtemp(tmpdir);
149 if (! rc1)
150 {
151@@ -2223,9 +2252,20 @@ handle_connection (void *arg)
152 }
153
154 /* Create a temporary files names and directories. */
155- snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
156+ retlen = snprintf (requestFileName, PATH_MAX, "%s/request.zip", tmpdir);
157+ if (retlen < 0 || retlen >= PATH_MAX)
158+ {
159+ server_error (_F("Error creating %s name", "request.zip path"));
160+ goto cleanup;
161+ }
162+
163+ retlen = snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
164+ if (retlen < 0 || retlen >= PATH_MAX)
165+ {
166+ server_error (_F("Error creating %s name", "request directory path"));
167+ goto cleanup;
168+ }
169
170- snprintf (requestDirName, PATH_MAX, "%s/request", tmpdir);
171 rc = mkdir(requestDirName, 0700);
172 if (rc)
173 {
174@@ -2233,7 +2273,13 @@ handle_connection (void *arg)
175 goto cleanup;
176 }
177
178- snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
179+ retlen = snprintf (responseDirName, PATH_MAX, "%s/response", tmpdir);
180+ if (retlen < 0 || retlen >= PATH_MAX)
181+ {
182+ server_error (_F("Error creating %s name", "response directory path"));
183+ goto cleanup;
184+ }
185+
186 rc = mkdir(responseDirName, 0700);
187 if (rc)
188 {
189@@ -2243,7 +2289,12 @@ handle_connection (void *arg)
190 // Set this early, since it gets used for errors to be returned to the client.
191 stapstderr = string(responseDirName) + "/stderr";
192
193- snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
194+ retlen = snprintf (responseFileName, PATH_MAX, "%s/response.zip", tmpdir);
195+ if (retlen < 0 || retlen >= PATH_MAX)
196+ {
197+ server_error (_F("Error creating %s name", "response.zip path"));
198+ goto cleanup;
199+ }
200
201 /* Read data from the socket.
202 * If the user is requesting/requiring authentication, authenticate
203diff --git a/translate.cxx b/translate.cxx
204index 1240a80ec..4ade06fdd 100644
205--- a/translate.cxx
206+++ b/translate.cxx
207@@ -7860,7 +7860,7 @@ translate_pass (systemtap_session& s)
208 if (versions.size() >= 3 && s.verbose > 1)
209 clog << _F("ignoring extra parts of compat version: %s", s.compatible.c_str()) << endl;
210 }
211- catch (const runtime_error)
212+ catch (const runtime_error&)
213 {
214 throw SEMANTIC_ERROR(_F("parse error in compatibility version: %s", s.compatible.c_str()));
215 }
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc
index f51bd28fd8..4d887ed4d2 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.inc
+++ b/meta/recipes-kernel/systemtap/systemtap_git.inc
@@ -14,6 +14,7 @@ SRC_URI = "git://sourceware.org/git/systemtap.git \
14 file://0001-buildrun-remove-quotes-around-I-include-line.patch \ 14 file://0001-buildrun-remove-quotes-around-I-include-line.patch \
15 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ 15 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \
16 file://0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch \ 16 file://0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch \
17 file://0001-Fixes-for-gcc-8.patch \
17 " 18 "
18 19
19COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux' 20COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux'