summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/systemtap
diff options
context:
space:
mode:
authorVictor Kamensky via Openembedded-core <openembedded-core@lists.openembedded.org>2018-07-20 20:38:52 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-26 13:16:41 +0100
commit941da957f97ded9caee2d5ebb8ecc524498bb792 (patch)
treee0e313faf563689e2af1d154429710251250aef0 /meta/recipes-kernel/systemtap
parent201cfa33fe31d90c333cfbd465a16a392d5c4148 (diff)
downloadpoky-941da957f97ded9caee2d5ebb8ecc524498bb792.tar.gz
systemtap: 3.2 -> 3.3
Upgrade systemtap from 3.2 to 3.3: Removed all backported patches. Removed "remove quotes around -I include" pending patch since 3.3 got similar fix already. Resolved merge conflict in and regenerated monitor-option.patch patch. (From OE-Core rev: d8a60b324c340bf88e2e8650f4771030490709c5) Signed-off-by: Victor Kamensky <kamensky@cisco.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/systemtap')
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Added-a-couple-of-small-sysroot-fixes.patch42
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Delay-adding-sysroot-path-to-module-name-in-case-of-.patch61
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch277
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch215
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Make-sure-sysroot-paths-don-t-end-with-a-slash.patch128
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-Use-sysroot-when-looking-for-the-System.map-file.patch29
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch39
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch38
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-debuginfo-lookup-with-sysroot-case-do-not-remove-sys.patch42
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling-follow-u.patch40
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling.patch53
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/0001-sysroot-handle-symbolic-links-with-absolute-name-rel.patch117
-rw-r--r--meta/recipes-kernel/systemtap/systemtap/monitor-option.patch15
-rw-r--r--meta/recipes-kernel/systemtap/systemtap_git.inc16
14 files changed, 8 insertions, 1104 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Added-a-couple-of-small-sysroot-fixes.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Added-a-couple-of-small-sysroot-fixes.patch
deleted file mode 100644
index c0ceb5a412..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Added-a-couple-of-small-sysroot-fixes.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From a714658727206d2a98a7194b7e6d29dbd3e27b8d Mon Sep 17 00:00:00 2001
2From: David Smith <dsmith@redhat.com>
3Date: Mon, 19 Mar 2018 16:50:05 -0500
4Subject: [PATCH] Added a couple of small sysroot fixes.
5
6* tapsets.cxx (dwarf_builder::build): Fix commit 4ffecddf5.
7 (path_remove_sysroot): Fix extra '/' present at start of paths.
8
9Upstream-Status: Backport
10Signed-off-by: Victor Kamensky <kamensky@cisco.com>
11---
12 tapsets.cxx | 10 +++++++---
13 1 file changed, 7 insertions(+), 3 deletions(-)
14
15Index: git/tapsets.cxx
16===================================================================
17--- git.orig/tapsets.cxx
18+++ git/tapsets.cxx
19@@ -1395,7 +1395,8 @@ string path_remove_sysroot(const systemt
20 string retval = path;
21 if (!sess.sysroot.empty() &&
22 (pos = retval.find(sess.sysroot)) != string::npos)
23- retval.replace(pos, sess.sysroot.length(), "/");
24+ retval.replace(pos, sess.sysroot.length(),
25+ (sess.sysroot.back() == '/' ? "/": ""));
26 return retval;
27 }
28
29@@ -8412,8 +8413,11 @@ dwarf_builder::build(systemtap_session &
30
31 // PR13338: unquote glob results
32 module_name = unescape_glob_chars (module_name);
33- user_path = find_executable (module_name, "", sess.sysenv); // canonicalize it
34- if (!is_fully_resolved(user_path, sess.sysroot, sess.sysenv))
35+ user_path = find_executable (module_name, sess.sysroot, sess.sysenv); // canonicalize it
36+ // Note we don't need to pass the sysroot to
37+ // is_fully_resolved(), since we just passed it to
38+ // find_executable().
39+ if (!is_fully_resolved(user_path, "", sess.sysenv))
40 throw SEMANTIC_ERROR(_F("cannot find executable '%s'",
41 user_path.to_string().c_str()));
42
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Delay-adding-sysroot-path-to-module-name-in-case-of-.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Delay-adding-sysroot-path-to-module-name-in-case-of-.patch
deleted file mode 100644
index 89951a2f19..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Delay-adding-sysroot-path-to-module-name-in-case-of-.patch
+++ /dev/null
@@ -1,61 +0,0 @@
1From 4ffecddf5433d65a6f01241990c9d516586b1c79 Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Mon, 19 Mar 2018 08:53:51 -0500
4Subject: [PATCH] Delay adding sysroot path to module name in case of non
5 absolute executable
6
7Current stap code adds sysroot prematurely for probes that specify non
8absolute path name, i.e like "foo", so when find_executable called it
9receives full path as <sysroot>/foo and find_executable does not search
10PATH while applying sysroot.
11
12Fix delays adding sysroot till path inside of sysroot is searched first.
13
14Also fix missing sysroot addition in glob expansion case.
15
16Upstream-Status: Backport
17Signed-off-by: Victor Kamensky <kamensky@cisco.com>
18---
19 tapsets.cxx | 8 ++++----
20 1 file changed, 4 insertions(+), 4 deletions(-)
21
22Index: git/tapsets.cxx
23===================================================================
24--- git.orig/tapsets.cxx
25+++ git/tapsets.cxx
26@@ -746,7 +746,7 @@ base_query::base_query(dwflpp & dw, lite
27 pid_val = 0;
28 get_string_param(params, TOK_PROCESS, module_val);
29 }
30- module_val = find_executable (module_val, "", sess.sysenv);
31+ module_val = find_executable (module_val, sess.sysroot, sess.sysenv);
32 if (!is_fully_resolved(module_val, "", sess.sysenv))
33 throw SEMANTIC_ERROR(_F("cannot find executable '%s'",
34 module_val.to_string().c_str()));
35@@ -8287,7 +8287,6 @@ dwarf_builder::build(systemtap_session &
36 }
37 else
38 {
39- module_name = (string)sess.sysroot + (string)module_name;
40 filled_parameters[TOK_PROCESS] = new literal_string(module_name);
41 }
42 }
43@@ -8321,7 +8320,8 @@ dwarf_builder::build(systemtap_session &
44 assert (lit);
45
46 // Evaluate glob here, and call derive_probes recursively with each match.
47- const auto& globs = glob_executable (module_name);
48+ const auto& globs = glob_executable (sess.sysroot
49+ + string(module_name));
50 unsigned results_pre = finished_results.size();
51 for (auto it = globs.begin(); it != globs.end(); ++it)
52 {
53@@ -8413,7 +8413,7 @@ dwarf_builder::build(systemtap_session &
54 // PR13338: unquote glob results
55 module_name = unescape_glob_chars (module_name);
56 user_path = find_executable (module_name, "", sess.sysenv); // canonicalize it
57- if (!is_fully_resolved(user_path, "", sess.sysenv))
58+ if (!is_fully_resolved(user_path, sess.sysroot, sess.sysenv))
59 throw SEMANTIC_ERROR(_F("cannot find executable '%s'",
60 user_path.to_string().c_str()));
61
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch b/meta/recipes-kernel/systemtap/systemtap/0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch
deleted file mode 100644
index 460c3b7609..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch
+++ /dev/null
@@ -1,277 +0,0 @@
1From fbb26e17a4c026f05a497fc5d584516bad3b6950 Mon Sep 17 00:00:00 2001
2From: David Smith <dsmith@redhat.com>
3Date: Wed, 6 Dec 2017 14:37:42 -0600
4Subject: [PATCH] Fix PR22551 by updating the use of timers for the 4.15
5 kernel.
6
7* runtime/linux/timer_compatibility.h: New file.
8* runtime/time.c: Update timer callback function parameter type. Update
9 timer initialization.
10* runtime/transport/relay_v2.c: Ditto.
11* runtime/transport/transport.c: Ditto.
12* tapset-timers.cxx (timer_derived_probe_group::emit_module_decls):
13 Ditto. Handle old and new timer callback interface.
14* runtime/linux/runtime.h: Include timer_compatibility.h instead of timer.h.
15* tapset/linux/scsi.stp: Ditto.
16
17Upstream-Status: Backport
18Signed-off-by: Victor Kamensky <kamensky@cisco.com>
19
20---
21 runtime/linux/runtime.h | 2 +-
22 runtime/linux/timer_compatibility.h | 76 +++++++++++++++++++++++++++++++++++++
23 runtime/time.c | 7 ++--
24 runtime/transport/relay_v2.c | 8 ++--
25 runtime/transport/transport.c | 13 +++----
26 tapset-timers.cxx | 14 +++++--
27 tapset/linux/scsi.stp | 2 +-
28 7 files changed, 100 insertions(+), 22 deletions(-)
29 create mode 100644 runtime/linux/timer_compatibility.h
30
31diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
32index 9c585a2..df9b74c 100644
33--- a/runtime/linux/runtime.h
34+++ b/runtime/linux/runtime.h
35@@ -34,7 +34,7 @@
36 #include <linux/compat.h>
37 #include <linux/sched.h>
38 #include <linux/mm.h>
39-#include <linux/timer.h>
40+#include "timer_compatibility.h"
41 #include <linux/delay.h>
42 #include <linux/profile.h>
43 #include <linux/rcupdate.h>
44diff --git a/runtime/linux/timer_compatibility.h b/runtime/linux/timer_compatibility.h
45new file mode 100644
46index 0000000..ac03de9
47--- /dev/null
48+++ b/runtime/linux/timer_compatibility.h
49@@ -0,0 +1,76 @@
50+/*
51+ * linux/timer.h compatibility defines and inlines
52+ * Copyright (C) 2017 Red Hat Inc.
53+ *
54+ * This file is part of systemtap, and is free software. You can
55+ * redistribute it and/or modify it under the terms of the GNU General
56+ * Public License (GPL); either version 2, or (at your option) any
57+ * later version.
58+ */
59+
60+#ifndef _TIMER_COMPATIBILITY_H_
61+#define _TIMER_COMPATIBILITY_H_
62+
63+#include <linux/timer.h>
64+
65+/*
66+ * Starting with the 4.15 kernel, the timer interface
67+ * changed. Originally, you'd do something like:
68+ *
69+ * static void timer_func(unsigned long val);
70+ *
71+ * init_timer(&timer);
72+ * timer.expires = jiffies + STP_RELAY_TIMER_INTERVAL;
73+ * timer.function = timer_func;
74+ * timer.data = 0;
75+ * add_timer(&timer);
76+ *
77+ * The 'data' parameter would get passed to the callback
78+ * function. Starting with 4.15, you'd do something like this:
79+ *
80+ * static void timer_func(struct timer_list *val);
81+ *
82+ * timer_setup(&timer, timer_func, 0);
83+ * timer.expires = jiffies + STP_RELAY_TIMER_INTERVAL;
84+ * add_timer(&timer);
85+ *
86+ * With the new code, the timer that caused the callback gets passed
87+ * to the timer callback function. The 'data' field has been removed.
88+ *
89+ * So, we're going to use the new interface. To hide the differences
90+ * between the callback function parameter type, we'll define a new
91+ * type, 'stp_timer_callback_parameter_t'.
92+ *
93+ * If code needs to figure out the difference between the old and new
94+ * interface, it should test the TIMER_TRACE_FLAGMASK define (which
95+ * only exists in the new interface).
96+ */
97+
98+#if defined(TIMER_TRACE_FLAGMASK)
99+/* This is the >= 4.15 kernel interface. */
100+
101+typedef struct timer_list * stp_timer_callback_parameter_t;
102+
103+#else
104+/* This is the < 4.15 kernel interface. */
105+
106+typedef unsigned long stp_timer_callback_parameter_t;
107+
108+/**
109+ * timer_setup - prepare a timer for first use
110+ * @timer: the timer in question
111+ * @callback: the function to call when timer expires
112+ * @flags: any TIMER_* flags (note that anything other than 0 is an
113+ * error, since this compatibility function can't support any
114+ * of the TIMER_* flags)
115+ */
116+#define timer_setup(timer, callback, flags) \
117+ { \
118+ init_timer((timer)); \
119+ (timer)->function = callback; \
120+ (timer)->data = 0; \
121+ BUILD_BUG_ON_ZERO((flags) != 0); \
122+ }
123+#endif
124+
125+#endif /* _TIMER_COMPATIBILITY_H_ */
126diff --git a/runtime/time.c b/runtime/time.c
127index 2e666d5..91ceafa 100644
128--- a/runtime/time.c
129+++ b/runtime/time.c
130@@ -168,10 +168,10 @@ __stp_time_smp_callback(void *val)
131
132 /* The timer callback is in a softIRQ -- interrupts enabled. */
133 static void
134-__stp_time_timer_callback(unsigned long val)
135+__stp_time_timer_callback(stp_timer_callback_parameter_t unused)
136 {
137 stp_time_t *time =__stp_time_local_update();
138- (void) val;
139+ (void) unused;
140
141 /* PR6481: make sure IRQs are enabled before resetting the timer
142 (IRQs are disabled and then reenabled in
143@@ -200,9 +200,8 @@ __stp_init_time(void *info)
144 time->freq = __stp_get_freq();
145 __stp_time_local_update();
146
147- init_timer(&time->timer);
148+ timer_setup(&time->timer, __stp_time_timer_callback, 0);
149 time->timer.expires = jiffies + STP_TIME_SYNC_INTERVAL;
150- time->timer.function = __stp_time_timer_callback;
151
152 #ifndef STAPCONF_ADD_TIMER_ON
153 add_timer(&time->timer);
154diff --git a/runtime/transport/relay_v2.c b/runtime/transport/relay_v2.c
155index f81d75d..135951a 100644
156--- a/runtime/transport/relay_v2.c
157+++ b/runtime/transport/relay_v2.c
158@@ -30,7 +30,7 @@
159 #include <linux/debugfs.h>
160 #include <linux/mm.h>
161 #include <linux/relay.h>
162-#include <linux/timer.h>
163+#include "../linux/timer_compatibility.h"
164 #include "../uidgid_compatibility.h"
165 #include "relay_compat.h"
166
167@@ -120,7 +120,7 @@ static void __stp_relay_wakeup_readers(struct rchan_buf *buf)
168 wake_up_interruptible(&buf->read_wait);
169 }
170
171-static void __stp_relay_wakeup_timer(unsigned long val)
172+static void __stp_relay_wakeup_timer(stp_timer_callback_parameter_t unused)
173 {
174 #ifdef STP_BULKMODE
175 int i;
176@@ -151,10 +151,8 @@ static void __stp_relay_wakeup_timer(unsigned long val)
177 static void __stp_relay_timer_init(void)
178 {
179 atomic_set(&_stp_relay_data.wakeup, 0);
180- init_timer(&_stp_relay_data.timer);
181+ timer_setup(&_stp_relay_data.timer, __stp_relay_wakeup_timer, 0);
182 _stp_relay_data.timer.expires = jiffies + STP_RELAY_TIMER_INTERVAL;
183- _stp_relay_data.timer.function = __stp_relay_wakeup_timer;
184- _stp_relay_data.timer.data = 0;
185 add_timer(&_stp_relay_data.timer);
186 smp_mb();
187 }
188diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
189index 3400f22..320fd18 100644
190--- a/runtime/transport/transport.c
191+++ b/runtime/transport/transport.c
192@@ -311,7 +311,7 @@ static void _stp_detach(void)
193 }
194
195
196-static void _stp_ctl_work_callback(unsigned long val);
197+static void _stp_ctl_work_callback(stp_timer_callback_parameter_t unused);
198
199 /*
200 * Called when stapio opens the control channel.
201@@ -320,13 +320,12 @@ static void _stp_attach(void)
202 {
203 dbug_trans(1, "attach\n");
204 _stp_pid = current->pid;
205- if (_stp_namespaces_pid < 1)
206- _stp_namespaces_pid = _stp_pid;
207+ if (_stp_namespaces_pid < 1)
208+ _stp_namespaces_pid = _stp_pid;
209 _stp_transport_data_fs_overwrite(0);
210- init_timer(&_stp_ctl_work_timer);
211+
212+ timer_setup(&_stp_ctl_work_timer, _stp_ctl_work_callback, 0);
213 _stp_ctl_work_timer.expires = jiffies + STP_CTL_TIMER_INTERVAL;
214- _stp_ctl_work_timer.function = _stp_ctl_work_callback;
215- _stp_ctl_work_timer.data= 0;
216 add_timer(&_stp_ctl_work_timer);
217 }
218
219@@ -341,7 +340,7 @@ static void _stp_attach(void)
220 * notified. Reschedules itself if someone is still attached
221 * to the cmd channel.
222 */
223-static void _stp_ctl_work_callback(unsigned long val)
224+static void _stp_ctl_work_callback(stp_timer_callback_parameter_t unused)
225 {
226 int do_io = 0;
227 unsigned long flags;
228diff --git a/tapset-timers.cxx b/tapset-timers.cxx
229index 1a40bcd..0ab4d69 100644
230--- a/tapset-timers.cxx
231+++ b/tapset-timers.cxx
232@@ -122,9 +122,13 @@ timer_derived_probe_group::emit_module_decls (systemtap_session& s)
233 s.op->newline(-1) << "};";
234 s.op->newline();
235
236- s.op->newline() << "static void enter_timer_probe (unsigned long val) {";
237+ s.op->newline() << "static void enter_timer_probe (stp_timer_callback_parameter_t val) {";
238+ s.op->newline() << "#if defined(TIMER_TRACE_FLAGMASK)";
239+ s.op->newline(1) << "struct stap_timer_probe* stp = container_of(val, struct stap_timer_probe, timer_list);";
240+ s.op->newline(-1) << "#else";
241 s.op->newline(1) << "struct stap_timer_probe* stp = & stap_timer_probes [val];";
242- s.op->newline() << "if ((atomic_read (session_state()) == STAP_SESSION_STARTING) ||";
243+ s.op->newline(-1) << "#endif";
244+ s.op->newline(1) << "if ((atomic_read (session_state()) == STAP_SESSION_STARTING) ||";
245 s.op->newline() << " (atomic_read (session_state()) == STAP_SESSION_RUNNING))";
246 s.op->newline(1) << "mod_timer (& stp->timer_list, jiffies + ";
247 emit_interval (s.op);
248@@ -148,9 +152,11 @@ timer_derived_probe_group::emit_module_init (systemtap_session& s)
249 s.op->newline() << "for (i=0; i<" << probes.size() << "; i++) {";
250 s.op->newline(1) << "struct stap_timer_probe* stp = & stap_timer_probes [i];";
251 s.op->newline() << "probe_point = stp->probe->pp;";
252- s.op->newline() << "init_timer (& stp->timer_list);";
253- s.op->newline() << "stp->timer_list.function = & enter_timer_probe;";
254+
255+ s.op->newline() << "timer_setup (& stp->timer_list, enter_timer_probe, 0);";
256+ s.op->newline() << "#if !defined(TIMER_TRACE_FLAGMASK)";
257 s.op->newline() << "stp->timer_list.data = i;"; // NB: important!
258+ s.op->newline() << "#endif";
259 // copy timer renew calculations from above :-(
260 s.op->newline() << "stp->timer_list.expires = jiffies + ";
261 emit_interval (s.op);
262diff --git a/tapset/linux/scsi.stp b/tapset/linux/scsi.stp
263index 44f686c..3577942 100644
264--- a/tapset/linux/scsi.stp
265+++ b/tapset/linux/scsi.stp
266@@ -14,7 +14,7 @@
267 #include <scsi/scsi_cmnd.h>
268 #include <scsi/scsi_device.h>
269 #include <scsi/scsi_host.h>
270-#include <linux/timer.h>
271+#include "linux/timer_compatibility.h"
272 #include <linux/blkdev.h>
273 %}
274
275--
2762.7.4
277
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
deleted file mode 100644
index a1b0bff02a..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Fixes-for-gcc-8.patch
+++ /dev/null
@@ -1,215 +0,0 @@
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/0001-Make-sure-sysroot-paths-don-t-end-with-a-slash.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Make-sure-sysroot-paths-don-t-end-with-a-slash.patch
deleted file mode 100644
index 7cd9030eac..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Make-sure-sysroot-paths-don-t-end-with-a-slash.patch
+++ /dev/null
@@ -1,128 +0,0 @@
1From 41efad04730be89889d1483719f9a6c9396dc250 Mon Sep 17 00:00:00 2001
2From: David Smith <dsmith@redhat.com>
3Date: Wed, 14 Mar 2018 17:05:25 -0500
4Subject: [PATCH] Make sure sysroot paths don't end with a slash.
5
6* session.cxx (parse_cmdline): Make sure a sysroot path does not end with
7 a '/', since we build paths like: sysroot + "/lib/modules". If the
8 sysroot path ends with a '/', we end up with paths like
9 '/SYSROOT//lib/modules'.
10 (setup_kernel_release): Take a string parameter, not a character pointer.
11* session.h: Update setup_kernel_release() prototype.
12
13Upstream-Status: Backport
14Signed-off-by: Victor Kamensky <kamensky@cisco.com>
15---
16 session.cxx | 34 ++++++++++++++++++++++++++--------
17 session.h | 2 +-
18 2 files changed, 27 insertions(+), 9 deletions(-)
19
20Index: git/session.cxx
21===================================================================
22--- git.orig/session.cxx
23+++ git/session.cxx
24@@ -722,6 +722,9 @@ systemtap_session::parse_cmdline (int ar
25 client_options_disallowed_for_unprivileged = "";
26 std::set<std::string> additional_unwindsym_modules;
27 struct rlimit our_rlimit;
28+ bool sysroot_option_seen = false;
29+ string kernel_release_value;
30+
31 while (true)
32 {
33 char * num_endptr;
34@@ -887,7 +890,7 @@ systemtap_session::parse_cmdline (int ar
35 // Note that '-' must come last in a regex bracket expression.
36 assert_regexp_match("-r parameter from client", optarg, "^[a-z0-9_.+-]+$");
37 server_args.push_back (string ("-") + (char)grc + optarg);
38- setup_kernel_release(optarg);
39+ kernel_release_value = optarg;
40 break;
41
42 case 'a':
43@@ -1473,7 +1476,7 @@ systemtap_session::parse_cmdline (int ar
44 if (client_options) {
45 cerr << _F("ERROR: %s invalid with %s", "--sysroot", "--client-options") << endl;
46 return 1;
47- } else if (!sysroot.empty()) {
48+ } else if (sysroot_option_seen) {
49 cerr << "ERROR: multiple --sysroot options not supported" << endl;
50 return 1;
51 } else {
52@@ -1487,11 +1490,17 @@ systemtap_session::parse_cmdline (int ar
53
54 sysroot = string(spath);
55 free (spath);
56- if (sysroot[sysroot.size() - 1] != '/')
57- sysroot.append("/");
58
59- break;
60+ // We do path creation like this:
61+ // sysroot + "/lib/modules"
62+ // So, we don't want the sysroot path to end with a '/',
63+ // otherwise we'll end up with '/foo//lib/modules'.
64+ if (sysroot.back() == '/') {
65+ sysroot.pop_back();
66+ }
67 }
68+ sysroot_option_seen = true;
69+ break;
70
71 case LONG_OPT_SYSENV:
72 if (client_options) {
73@@ -1501,7 +1510,7 @@ systemtap_session::parse_cmdline (int ar
74 string sysenv_str = optarg;
75 string value;
76 size_t pos;
77- if (sysroot.empty()) {
78+ if (! sysroot_option_seen) {
79 cerr << "ERROR: --sysenv must follow --sysroot" << endl;
80 return 1;
81 }
82@@ -1646,6 +1655,15 @@ systemtap_session::parse_cmdline (int ar
83 }
84 }
85
86+ if (! kernel_release_value.empty())
87+ {
88+ setup_kernel_release(kernel_release_value);
89+ }
90+ else if (! sysroot.empty())
91+ {
92+ kernel_build_tree = sysroot + "/lib/modules/" + kernel_release + "/build";
93+ }
94+
95 return 0;
96 }
97
98@@ -2152,7 +2170,7 @@ void systemtap_session::insert_loaded_mo
99 }
100
101 void
102-systemtap_session::setup_kernel_release (const char* kstr)
103+systemtap_session::setup_kernel_release (const string& kstr)
104 {
105 // Sometimes we may get dupes here... e.g. a server may have a full
106 // -r /path/to/kernel followed by a client's -r kernel.
107@@ -2183,7 +2201,7 @@ systemtap_session::setup_kernel_release
108 else
109 {
110 update_release_sysroot = true;
111- kernel_release = string (kstr);
112+ kernel_release = kstr;
113 if (!kernel_release.empty())
114 kernel_build_tree = "/lib/modules/" + kernel_release + "/build";
115
116Index: git/session.h
117===================================================================
118--- git.orig/session.h
119+++ git/session.h
120@@ -144,7 +144,7 @@ public:
121
122 // NB: It is very important for all of the above (and below) fields
123 // to be cleared in the systemtap_session ctor (session.cxx).
124- void setup_kernel_release (const char* kstr);
125+ void setup_kernel_release (const std::string& kstr);
126 void insert_loaded_modules ();
127
128 // command line parsing
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-Use-sysroot-when-looking-for-the-System.map-file.patch b/meta/recipes-kernel/systemtap/systemtap/0001-Use-sysroot-when-looking-for-the-System.map-file.patch
deleted file mode 100644
index b2820b31e8..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-Use-sysroot-when-looking-for-the-System.map-file.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1From 436063d5e4738a9b03535d330a2242be5118e745 Mon Sep 17 00:00:00 2001
2From: David Smith <dsmith@redhat.com>
3Date: Thu, 8 Mar 2018 16:01:58 -0600
4Subject: [PATCH] Use sysroot when looking for the System.map file.
5
6Add sysroot to system_map_path + "/boot/System.map" case. Otherwise
7stap tries to look symbols on host system and it produce error like this:
8
9> Kernel symbol table /boot/System.map-4.9.78-yocto-standard unavailable, (No such file or directory)
10
11Upstream-Status: Backport
12Signed-off-by: Victor Kamensky <kamensky@cisco.com>
13---
14 session.cxx | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17Index: git/session.cxx
18===================================================================
19--- git.orig/session.cxx
20+++ git/session.cxx
21@@ -2013,7 +2013,7 @@ systemtap_session::parse_kernel_function
22 clog << _F("Kernel symbol table %s unavailable, (%s)",
23 system_map_path.c_str(), strerror(errno)) << endl;
24
25- system_map_path = "/boot/System.map-" + kernel_release;
26+ system_map_path = sysroot + "/boot/System.map-" + kernel_release;
27 system_map.clear();
28 system_map.open(system_map_path.c_str(), ifstream::in);
29 if (! system_map.is_open())
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch b/meta/recipes-kernel/systemtap/systemtap/0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch
deleted file mode 100644
index 98181a1294..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch
+++ /dev/null
@@ -1,39 +0,0 @@
1From 183c7a7a8167333c873525f7908913837b8dc3cb Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Tue, 20 Mar 2018 12:41:05 -0500
4Subject: [PATCH] _stp_umodule_relocate needs target file path, not host file
5 path
6
7Strip of sysroot from module name is required when _stp_umodule_relocate
8call is generated. Otherwise path won't match path on target and could
9will fail to calculated address within the file.
10
11Upstream-Status: Backport
12Signed-off-by: Victor Kamensky <kamensky@cisco.com>
13---
14 loc2stap.cxx | 5 ++++-
15 1 file changed, 4 insertions(+), 1 deletion(-)
16
17diff --git a/loc2stap.cxx b/loc2stap.cxx
18index 4818ee0..e09954f 100644
19--- a/loc2stap.cxx
20+++ b/loc2stap.cxx
21@@ -17,6 +17,7 @@
22
23 #include "loc2stap.h"
24 #include "dwflpp.h"
25+#include "tapsets.h"
26
27 #if ! _ELFUTILS_PREREQ(0, 153)
28 #define DW_OP_GNU_entry_value 0xf3
29@@ -106,7 +107,9 @@ location_context::translate_address(Dwarf_Addr addr)
30 c = "/* pragma:vma */ "
31 "({ unsigned long addr = 0; "
32 "addr = _stp_umodule_relocate (\""
33- + resolve_path(dw->module_name.c_str()) + "\", "
34+ + path_remove_sysroot(dw->sess,
35+ resolve_path(dw->module_name.c_str()))
36+ + "\", "
37 + lex_cast_hex (addr)
38 + ", current); addr; })";
39 }
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch b/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch
deleted file mode 100644
index 7996fdde73..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-buildrun-remove-quotes-around-I-include-line.patch
+++ /dev/null
@@ -1,38 +0,0 @@
1From 75c4aec6de3a615909f3283eac585760de101b8c Mon Sep 17 00:00:00 2001
2From: Saul Wold <sgw@linux.intel.com>
3Date: Tue, 7 Mar 2017 10:46:12 -0800
4Subject: [PATCH] buildrun: remove quotes around -I include line
5
6By having the quotes, the kernel Makefile addtree macro adds the
7kernel $srctree directory as a prefix and causes compilation failures.
8Removing the quotes resolves the issue.
9
10This is trimmed from the verbose output of the GCC command line
11Before:
12 -I/srv/sdb/builds/4.9/tmp/work-shared/qemux86-64/kernel-source/"/srv/sdb/releases/jethro/builds/4.1/tmp/sysroots/x86_64-linux/usr/share/systemtap/runtime"
13
14After:
15 -I/srv/sdb/builds/4.9/tmp/sysroots/x86_64-linux/usr/share/systemtap/runtime
16
17Upstream-Status: Pending
18Signed-off-by: Saul Wold <sgw@linux.intel.com>
19---
20 buildrun.cxx | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
22
23diff --git a/buildrun.cxx b/buildrun.cxx
24index aaea64c..8a8ee9f 100644
25--- a/buildrun.cxx
26+++ b/buildrun.cxx
27@@ -495,7 +495,7 @@ compile_pass (systemtap_session& s)
28 #if CHECK_POINTER_ARITH_PR5947
29 o << "EXTRA_CFLAGS += -Wpointer-arith" << endl;
30 #endif
31- o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl;
32+ o << "EXTRA_CFLAGS += -I" << s.runtime_path << endl;
33 // XXX: this may help ppc toc overflow
34 // o << "CFLAGS := $(subst -Os,-O2,$(CFLAGS)) -fminimal-toc" << endl;
35 o << "obj-m := " << s.module_name << ".o" << endl;
36--
372.7.4
38
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-debuginfo-lookup-with-sysroot-case-do-not-remove-sys.patch b/meta/recipes-kernel/systemtap/systemtap/0001-debuginfo-lookup-with-sysroot-case-do-not-remove-sys.patch
deleted file mode 100644
index 160642db08..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-debuginfo-lookup-with-sysroot-case-do-not-remove-sys.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1From b29e448e12040ed8f4d83743a14db0f138a7cc67 Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Wed, 14 Mar 2018 16:54:08 -0500
4Subject: [PATCH] debuginfo lookup with sysroot case do not remove sysroot from
5 file_name
6
7If sysroot option is passed, and debug symbols reside in sysroot along
8with executable <foo> in <foo_dir>/.debug/<foo_file> directory,
9stap fails to find debuginfo because it strips out sysroot path
10from file_name so dwfl_standard_find_debuginfo ends up looking at
11host <foo_dir>/.debug/<foo_file> rather then checking
12<sysroot>/<foo_dir>/.debug/<foo_file>.
13
14Upstream-Status: Backport
15Signed-off-by: Victor Kamensky <kamensky@cisco.com>
16---
17 setupdwfl.cxx | 12 ------------
18 1 file changed, 12 deletions(-)
19
20diff --git a/setupdwfl.cxx b/setupdwfl.cxx
21index 11e0bb2..2a87982 100644
22--- a/setupdwfl.cxx
23+++ b/setupdwfl.cxx
24@@ -627,18 +627,6 @@ internal_find_debuginfo (Dwfl_Module *mod,
25
26 call_dwfl_standard_find_debuginfo:
27
28- if (current_session_for_find_debuginfo)
29- {
30- string sysroot = current_session_for_find_debuginfo->sysroot + "/*";
31- int found = fnmatch(sysroot.c_str(), file_name, 0);
32-
33- if (found)
34- {
35- file_name = file_name
36- + current_session_for_find_debuginfo->sysroot.length() - 1;
37- }
38- }
39-
40 /* Call the original dwfl_standard_find_debuginfo */
41 return dwfl_standard_find_debuginfo(mod, userdata, modname, base,
42 file_name, debuglink_file,
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling-follow-u.patch b/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling-follow-u.patch
deleted file mode 100644
index 6fe7d4d1cf..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling-follow-u.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From 7e11f129ff370ce5f39812ce2ae6ce40818a347f Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Thu, 22 Mar 2018 16:02:02 -0500
4Subject: [PATCH] sysroot: fix short release -r option handling follow up
5
6In case of sysroot set and short release -r option it does not make sense
7to pass short release name into dwfl_linux_kernel_report_offline
8function. This function is not aware about sysroot and it won't look for
9kernel modules under sysroot directory.
10
11Upstream-Status: Backport
12Signed-off-by: Victor Kamensky <kamensky@cisco.com>
13---
14 setupdwfl.cxx | 10 +++++++++-
15 1 file changed, 9 insertions(+), 1 deletion(-)
16
17diff --git a/setupdwfl.cxx b/setupdwfl.cxx
18index c419afa..0cf5810 100644
19--- a/setupdwfl.cxx
20+++ b/setupdwfl.cxx
21@@ -367,7 +367,15 @@ setup_dwfl_kernel (unsigned *modules_found, systemtap_session &s)
22 // hard-code this magic here.
23 string lib_path = s.sysroot + "/lib/modules/" + s.kernel_release + "/build";
24 if (s.kernel_build_tree == lib_path)
25- elfutils_kernel_path = s.kernel_release;
26+ {
27+ if (s.sysroot != "")
28+ // If we have sysroot set does not make sense to pass
29+ // short release to dwfl, it won't take a sysroot into
30+ // account. Let's construct full path in such case.
31+ elfutils_kernel_path = string(s.sysroot + "/lib/modules/" + s.kernel_release);
32+ else
33+ elfutils_kernel_path = s.kernel_release;
34+ }
35 else
36 elfutils_kernel_path = s.kernel_build_tree;
37 offline_modules_found = 0;
38--
392.7.4
40
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling.patch b/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling.patch
deleted file mode 100644
index b31d6274e2..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-fix-short-release-r-option-handling.patch
+++ /dev/null
@@ -1,53 +0,0 @@
1From a9ce89bcd2d78728faef59bda60e75510972cd56 Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Wed, 14 Mar 2018 17:09:44 -0500
4Subject: [PATCH] sysroot: fix short release -r option handling
5
6* setupdwfl.cxx (debuginfo_path_insert_sysroot): Add a '/' to the end of
7 the sysroot for path_insert_sysroot().
8 (setup_dwfl_kernel): Simplify logic when finding the kernel path to send
9 to elfutils.
10
11Upstream-Status: Backport
12Signed-off-by: Victor Kamensky <kamensky@cisco.com>
13---
14 setupdwfl.cxx | 19 ++++++++++++-------
15 1 file changed, 12 insertions(+), 7 deletions(-)
16
17diff --git a/setupdwfl.cxx b/setupdwfl.cxx
18index 2a87982..f6c3157 100644
19--- a/setupdwfl.cxx
20+++ b/setupdwfl.cxx
21@@ -339,6 +339,13 @@ static char * path_insert_sysroot(string sysroot, string path)
22
23 void debuginfo_path_insert_sysroot(string sysroot)
24 {
25+ // FIXME: This is a short-term fix, until we expect sysroot paths to
26+ // always end with a '/' (and never be empty).
27+ //
28+ // The path_insert_sysroot() function assumes that sysroot has a '/'
29+ // on the end. Make sure that is true.
30+ if (sysroot.back() != '/')
31+ sysroot.push_back('/');
32 debuginfo_path = path_insert_sysroot(sysroot, debuginfo_path);
33 debuginfo_usr_path = path_insert_sysroot(sysroot, debuginfo_usr_path);
34 }
35@@ -358,13 +365,11 @@ setup_dwfl_kernel (unsigned *modules_found, systemtap_session &s)
36 // no way to set the dwfl_callback.debuginfo_path and always
37 // passs the plain kernel_release here. So instead we have to
38 // hard-code this magic here.
39- string lib_path = "/lib/modules/" + s.kernel_release + "/build";
40- if (s.kernel_build_tree == string(s.sysroot + lib_path) ||
41- (s.kernel_build_tree == lib_path
42- && s.sysroot == "/"))
43- elfutils_kernel_path = s.kernel_release;
44- else
45- elfutils_kernel_path = s.kernel_build_tree;
46+ string lib_path = s.sysroot + "/lib/modules/" + s.kernel_release + "/build";
47+ if (s.kernel_build_tree == lib_path)
48+ elfutils_kernel_path = s.kernel_release;
49+ else
50+ elfutils_kernel_path = s.kernel_build_tree;
51 offline_modules_found = 0;
52
53 // First try to report full path modules.
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-handle-symbolic-links-with-absolute-name-rel.patch b/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-handle-symbolic-links-with-absolute-name-rel.patch
deleted file mode 100644
index 8a3d39a5b8..0000000000
--- a/meta/recipes-kernel/systemtap/systemtap/0001-sysroot-handle-symbolic-links-with-absolute-name-rel.patch
+++ /dev/null
@@ -1,117 +0,0 @@
1From 2041085d1a700201dc088991ca8136e7935bf42f Mon Sep 17 00:00:00 2001
2From: Victor Kamensky <kamensky@cisco.com>
3Date: Wed, 21 Mar 2018 11:35:26 -0500
4Subject: [PATCH] sysroot: handle symbolic links with absolute name relative to
5 sysroot
6
7In case of symbolic link found under sysroot point to absolute path,
8instead of trying to look for such absolute path in host system,
9apply sysroot prefix first.
10
11Upstream-Status: Backport
12Signed-off-by: Victor Kamensky <kamensky@cisco.com>
13---
14 util.cxx | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
15 1 file changed, 76 insertions(+)
16
17Index: git/util.cxx
18===================================================================
19--- git.orig/util.cxx
20+++ git/util.cxx
21@@ -441,6 +441,64 @@ split_lines(const char *buf, size_t n)
22 return lines;
23 }
24
25+static string
26+follow_link(const string& name, const string& sysroot)
27+{
28+ char *linkname;
29+ ssize_t r;
30+ string retpath;
31+ struct stat st;
32+
33+ const char *f = name.c_str();
34+
35+ lstat(f, &st);
36+
37+ linkname = (char *) malloc(st.st_size + 1);
38+
39+ if (linkname)
40+ {
41+ r = readlink(f, linkname, st.st_size + 1);
42+ linkname[st.st_size] = '\0';
43+ /*
44+ * If we have non-empty sysroot and we got link that
45+ * points to absolute path name, we need to look at
46+ * this path relative to sysroot itself. access and
47+ * stat will follow symbolic links correctly only in
48+ * case with empty sysroot.
49+ */
50+ while (r != -1 && linkname && linkname[0] == '/')
51+ {
52+ string fname1 = sysroot + linkname;
53+ const char *f1 = fname1.c_str();
54+ if (access(f1, X_OK) == 0
55+ && stat(f1, &st) == 0
56+ && S_ISREG(st.st_mode))
57+ {
58+ retpath = fname1;
59+ break;
60+ }
61+ else if (lstat(f1, &st) == 0
62+ && S_ISLNK(st.st_mode))
63+ {
64+ free(linkname);
65+ linkname = (char *) malloc(st.st_size + 1);
66+ if (linkname)
67+ {
68+ r = readlink(f1, linkname, st.st_size + 1);
69+ linkname[st.st_size] = '\0';
70+ }
71+ }
72+ else
73+ {
74+ break;
75+ }
76+ }
77+ }
78+ free(linkname);
79+
80+ return retpath;
81+}
82+
83 // Resolve an executable name to a canonical full path name, with the
84 // same policy as execvp(). A program name not containing a slash
85 // will be searched along the $PATH.
86@@ -465,6 +523,14 @@ string find_executable(const string& nam
87 if (name.find('/') != string::npos) // slash in the path already?
88 {
89 retpath = sysroot + name;
90+
91+ const char *f = retpath.c_str();
92+ if (sysroot != ""
93+ && lstat(f, &st) == 0
94+ && S_ISLNK(st.st_mode))
95+ {
96+ retpath = follow_link(f, sysroot);
97+ }
98 }
99 else // Nope, search $PATH.
100 {
101@@ -493,6 +559,16 @@ string find_executable(const string& nam
102 retpath = fname;
103 break;
104 }
105+ else if (sysroot != ""
106+ && lstat(f, &st) == 0
107+ && S_ISLNK(st.st_mode))
108+ {
109+ retpath = follow_link(f, sysroot);
110+ if (retpath != "")
111+ {
112+ break;
113+ }
114+ }
115 }
116 }
117 }
diff --git a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch b/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch
index b7ee0701b1..9313a5aba3 100644
--- a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch
+++ b/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch
@@ -13,18 +13,18 @@ Signed-off-by: Ross Burton <ross.burton@intel.com>
13 configure.ac | 5 ++++- 13 configure.ac | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-) 14 1 file changed, 4 insertions(+), 1 deletion(-)
15 15
16diff --git a/configure.ac b/configure.ac 16Index: git/configure.ac
17index 6bd0c5fc4..2ea9b3cbf 100644 17===================================================================
18--- a/configure.ac 18--- git.orig/configure.ac
19+++ b/configure.ac 19+++ git/configure.ac
20@@ -752,13 +752,16 @@ dnl We want either (or both) python probe support. 20@@ -766,13 +766,16 @@ dnl We want either (or both) python prob
21 AM_CONDITIONAL([HAVE_PYTHON_PROBES], 21 AM_CONDITIONAL([HAVE_PYTHON_PROBES],
22 [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"]) 22 [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"])
23 23
24+AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor],[Disable monitor])) 24+AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor],[Disable monitor]))
25+if test "$enable_monitor" != "no"; then 25+if test "$enable_monitor" != "no"; then
26 dnl Check for presence of json-c and ncurses for use in monitor mode 26 dnl Check for presence of json-c and ncurses for use in monitor mode
27 PKG_CHECK_MODULES([jsonc], [json-c >= 0.12], [have_jsonc=yes], [have_jsonc=no]) 27 PKG_CHECK_MODULES([jsonc], [json-c >= 0.11], [have_jsonc=yes], [have_jsonc=no])
28 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no]) 28 PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no])
29-AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"]) 29-AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"])
30 if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then 30 if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then
@@ -35,6 +35,3 @@ index 6bd0c5fc4..2ea9b3cbf 100644
35 35
36 AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ 36 AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [
37 old_CFLAGS="$CFLAGS" 37 old_CFLAGS="$CFLAGS"
38--
392.11.0
40
diff --git a/meta/recipes-kernel/systemtap/systemtap_git.inc b/meta/recipes-kernel/systemtap/systemtap_git.inc
index e2f5204a02..a1e05579e6 100644
--- a/meta/recipes-kernel/systemtap/systemtap_git.inc
+++ b/meta/recipes-kernel/systemtap/systemtap_git.inc
@@ -1,7 +1,7 @@
1LICENSE = "GPLv2" 1LICENSE = "GPLv2"
2LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" 2LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
3SRCREV = "4051c70c9318c837981384cbb23f3e9eb1bd0892" 3SRCREV = "48867d1cface9445d58e3c6e14497770b7eb77e1"
4PV = "3.2" 4PV = "3.3"
5 5
6SRC_URI = "git://sourceware.org/git/systemtap.git \ 6SRC_URI = "git://sourceware.org/git/systemtap.git \
7 file://configure-allow-to-disable-libvirt.patch \ 7 file://configure-allow-to-disable-libvirt.patch \
@@ -10,19 +10,7 @@ SRC_URI = "git://sourceware.org/git/systemtap.git \
10 file://no-msgfmt-check.patch \ 10 file://no-msgfmt-check.patch \
11 file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \ 11 file://0001-Do-not-let-configure-write-a-python-location-into-th.patch \
12 file://0001-Install-python-modules-to-correct-library-dir.patch \ 12 file://0001-Install-python-modules-to-correct-library-dir.patch \
13 file://0001-buildrun-remove-quotes-around-I-include-line.patch \
14 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \ 13 file://0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch \
15 file://0001-Fix-PR22551-by-updating-the-use-of-timers-for-the-4..patch \
16 file://0001-Fixes-for-gcc-8.patch \
17 file://0001-Use-sysroot-when-looking-for-the-System.map-file.patch \
18 file://0001-debuginfo-lookup-with-sysroot-case-do-not-remove-sys.patch \
19 file://0001-Make-sure-sysroot-paths-don-t-end-with-a-slash.patch \
20 file://0001-sysroot-fix-short-release-r-option-handling.patch \
21 file://0001-Delay-adding-sysroot-path-to-module-name-in-case-of-.patch \
22 file://0001-Added-a-couple-of-small-sysroot-fixes.patch \
23 file://0001-_stp_umodule_relocate-needs-target-file-path-not-hos.patch \
24 file://0001-sysroot-handle-symbolic-links-with-absolute-name-rel.patch \
25 file://0001-sysroot-fix-short-release-r-option-handling-follow-u.patch \
26 " 14 "
27 15
28COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux' 16COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm|aarch64|microblazeel|mips).*-linux'