diff options
Diffstat (limited to 'meta/recipes-kernel/systemtap/systemtap')
8 files changed, 201 insertions, 179 deletions
diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch b/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch new file mode 100644 index 0000000000..0801cb57ec --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-PR28778-gcc-warning-tweak-for-sprintf-precision-para.patch @@ -0,0 +1,45 @@ +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@arm.com> + +From b0422e9e5a539164af75cddcaeb01bceca56bf12 Mon Sep 17 00:00:00 2001 +From: "Frank Ch. Eigler" <fche@redhat.com> +Date: Thu, 13 Jan 2022 18:33:15 -0500 +Subject: [PATCH] PR28778: gcc warning tweak for sprintf precision parameter + +A precision=-1 sentinel value got interpreted as UINT_MAX in a +context, leading to diagnostics like: + +/usr/share/systemtap/runtime/vsprintf.c:341:23: error: 'strnlen' specified bound 4294967295 may exceed maximum object size 2147483647 [-Werror=stringop-overread] + +Adding a clamp_t() around the parameter field to keep it limited to +STP_BUFFER_SIZE (8K by default), which is apprx. the limit for a +single printf. +--- + runtime/vsprintf.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c +index cd31a938b..606f685e8 100644 +--- a/runtime/vsprintf.c ++++ b/runtime/vsprintf.c +@@ -338,7 +338,7 @@ _stp_vsprint_memory(char * str, char * end, const char * ptr, + if (format == 's') { + if ((unsigned long)ptr < PAGE_SIZE) + ptr = "<NULL>"; +- len = strnlen(ptr, precision); ++ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); + } + else if (precision > 0) + len = precision; +@@ -410,7 +410,7 @@ _stp_vsprint_memory_size(const char * ptr, int width, int precision, + if (format == 's') { + if ((unsigned long)ptr < PAGE_SIZE) + ptr = "<NULL>"; +- len = strnlen(ptr, precision); ++ len = strnlen(ptr, clamp_t(size_t, precision, 0, STP_BUFFER_SIZE)); + } + else if (precision > 0) + len = precision; +-- +2.25.1 + diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch b/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch new file mode 100644 index 0000000000..931310db53 --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-PR28804-tune-default-stap-s-buffer-size-on-small-RAM.patch @@ -0,0 +1,84 @@ +Upstream-Status: Backport +Signed-off-by: Ross Burton <ross.burton@arm.com> + +PR28804: tune default stap -s ## buffer size on small RAM machines + +Insert a forgotten division by num_online_cpu() to adjust downward the +calculated bufsize. Tweak normal defaults back to 128 * 2 * 64K +(16MB) per CPU, as the stap man page indicates. This may need further +tweaking when balancing against staprun consumption performance, but +at least we have the docs lined up with the code at the moment. + +PR28804: tune default stap -s ## buffer size on small RAM machines + +Use si_meminfo to limit default buffer size. Note in the man page +that the "-s ##" parameter is per-CPU. + +diff --git a/man/stap.1.in b/man/stap.1.in +index 55dbc2c93..285a27b34 100644 +--- a/man/stap.1.in ++++ b/man/stap.1.in +@@ -239,8 +239,8 @@ and average amount of time spent in each probe-point. Also shows + the derivation for each probe-point. + .TP + .BI \-s " NUM" +-Use NUM megabyte buffers for kernel-to-user data transfer. On a +-multiprocessor in bulk mode, this is a per-processor amount. ++Use NUM megabyte buffers for kernel-to-user data transfer per processor. ++The default is 16MB, or less on smaller memory machines. + .TP + .BI \-I " DIR" + Add the given directory to the tapset search directory. See the +diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c +index 18ecccea2..44afff814 100644 +--- a/runtime/transport/transport.c ++++ b/runtime/transport/transport.c +@@ -72,8 +72,11 @@ static inline void _stp_unlock_inode(struct inode *inode); + #include "procfs.c" + #include "control.c" + +-static unsigned _stp_nsubbufs = 256; +-static unsigned _stp_subbuf_size = 8 * STP_BUFFER_SIZE; /* 64K */ ++/* set default buffer parameters. User may override these via stap -s #, and ++ the runtime may auto-shrink it on low memory machines too. */ ++/* NB: Note default in man/stap.1.in */ ++static unsigned _stp_nsubbufs = 128; ++static unsigned _stp_subbuf_size = 2 * STP_BUFFER_SIZE; /* 2 * 64K */ + + /* module parameters */ + static int _stp_bufsize; +@@ -602,17 +605,30 @@ static int _stp_transport_init(void) + _stp_need_kallsyms_stext = 0; + #endif + +- if (_stp_bufsize) { +- unsigned size = _stp_bufsize * 1024 * 1024; ++ if (_stp_bufsize == 0) { // option not specified? ++ struct sysinfo si; ++ long _stp_bufsize_avail; ++ si_meminfo(&si); ++ _stp_bufsize_avail = (long)((si.freeram + si.bufferram) / 4 / num_online_cpus()) ++ << PAGE_SHIFT; // limit to quarter of free ram total ++ if ((_stp_nsubbufs * _stp_subbuf_size * num_online_cpus()) > _stp_bufsize_avail) { ++ _stp_bufsize = max_t (int, 1, _stp_bufsize_avail / 1024 / 1024); ++ dbug_trans(1, "Shrinking default _stp_bufsize to %d MB/cpu due to low free memory\n", _stp_bufsize); ++ } ++ } ++ ++ if (_stp_bufsize) { // overridden by user or by si_meminfo heuristic? ++ long size = _stp_bufsize * 1024 * 1024; + _stp_subbuf_size = 65536; ++ // bump up subbuf size from 64K to 1M to keep _stp_nsubbufs not too large + while (size / _stp_subbuf_size > 64 && + _stp_subbuf_size < 1024 * 1024) { + _stp_subbuf_size <<= 1; + } + _stp_nsubbufs = size / _stp_subbuf_size; +- dbug_trans(1, "Using %d subbufs of size %d\n", _stp_nsubbufs, _stp_subbuf_size); + } +- ++ dbug_trans(1, "Using %d subbufs of size %d\n", _stp_nsubbufs, _stp_subbuf_size); ++ + ret = _stp_transport_fs_init(THIS_MODULE->name); + if (ret) + goto err0; diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-staprun-address-ncurses-6.3-failures.patch b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-address-ncurses-6.3-failures.patch new file mode 100644 index 0000000000..1decf21593 --- /dev/null +++ b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-address-ncurses-6.3-failures.patch @@ -0,0 +1,61 @@ +From 191f528da19193d713d94ee252e2485efd9af4d3 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex@linutronix.de> +Date: Mon, 25 Oct 2021 17:59:24 +0200 +Subject: [PATCH] staprun: address ncurses 6.3 failures + +Upstream-Status: Submitted [by email to smakarov@redhat.com,systemtap@sourceware.org] +Signed-off-by: Alexander Kanavin <alex@linutronix.de> +--- + staprun/monitor.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/staprun/monitor.c b/staprun/monitor.c +index 478634c09..f4fbfd686 100644 +--- a/staprun/monitor.c ++++ b/staprun/monitor.c +@@ -448,12 +448,12 @@ void monitor_render(void) + if (active_window == 0) + wattron(status, A_BOLD); + wprintw(status, "\n%*s\t%*s\t%*s\t%*s\t%*s\t%*s\t%s\n", +- width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), +- width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), +- width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), +- width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), +- width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), +- width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), ++ (int)width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), ++ (int)width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), ++ (int)width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), ++ (int)width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), ++ (int)width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), ++ (int)width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), + HIGHLIGHT("name", p_name, comp_fn_index)); + if (active_window == 0) + wattroff(status, A_BOLD); +@@ -466,17 +466,17 @@ void monitor_render(void) + json_object *probe, *field; + probe = json_object_array_get_idx(jso_probe_list, i); + json_object_object_get_ex(probe, "index", &field); +- wprintw(status, "%*s\t", width[p_index], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_index], json_object_get_string(field)); + json_object_object_get_ex(probe, "state", &field); +- wprintw(status, "%*s\t", width[p_state], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_state], json_object_get_string(field)); + json_object_object_get_ex(probe, "hits", &field); +- wprintw(status, "%*s\t", width[p_hits], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_hits], json_object_get_string(field)); + json_object_object_get_ex(probe, "min", &field); +- wprintw(status, "%*s\t", width[p_min], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_min], json_object_get_string(field)); + json_object_object_get_ex(probe, "avg", &field); +- wprintw(status, "%*s\t", width[p_avg], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_avg], json_object_get_string(field)); + json_object_object_get_ex(probe, "max", &field); +- wprintw(status, "%*s\t", width[p_max], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_max], json_object_get_string(field)); + getyx(status, discard, cur_x); + json_object_object_get_ex(probe, "name", &field); + wprintw(status, "%.*s", max_cols-cur_x-1, json_object_get_string(field)); +-- +2.20.1 + diff --git a/meta/recipes-kernel/systemtap/systemtap/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch index 9f11648fef..e2f8b3b057 100644 --- a/meta/recipes-kernel/systemtap/systemtap/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch +++ b/meta/recipes-kernel/systemtap/systemtap/0001-staprun-stapbpf-don-t-support-installing-a-non-root.patch @@ -14,49 +14,24 @@ Signed-off-by: Saul Wold <sgw@linux.intel.com> staprun/Makefile.am | 12 ++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) -diff --git a/stapbpf/Makefile.am b/stapbpf/Makefile.am -index 421b044ef..f7daeb2b2 100644 ---- a/stapbpf/Makefile.am -+++ b/stapbpf/Makefile.am -@@ -39,11 +39,11 @@ git_version.stamp ../git_version.h: +Index: git/stapbpf/Makefile.am +=================================================================== +--- git.orig/stapbpf/Makefile.am ++++ git/stapbpf/Makefile.am +@@ -41,10 +41,10 @@ # Why the "id -u" condition? This way, an unprivileged user can run # make install, and have "sudo stap ...." or "sudo stapbpf ...." work later. -install-exec-hook: -- if [ `id -u` -eq 0 ]; then \ -- getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr; \ -- getent group stapusr >/dev/null \ -- && chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ +- if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \ +- || groupadd -f -g 156 -r stapusr); then \ +- chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ - && chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \ - fi +#install-exec-hook: -+# if [ `id -u` -eq 0 ]; then \ -+# getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr; \ -+# getent group stapusr >/dev/null \ -+# && chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ ++## if [ `id -u` -eq 0 ] && (getent group stapusr >/dev/null \ ++## || groupadd -f -g 156 -r stapusr); then \ ++## chgrp stapusr "$(DESTDIR)$(bindir)/stapbpf" \ +# && chmod 04110 "$(DESTDIR)$(bindir)/stapbpf"; \ +# fi endif -diff --git a/staprun/Makefile.am b/staprun/Makefile.am -index 4073aa01c..2925e34c3 100644 ---- a/staprun/Makefile.am -+++ b/staprun/Makefile.am -@@ -72,9 +72,9 @@ git_version.stamp ../git_version.h: - - # Why the "id -u" condition? This way, an unprivileged user can run - # make install, and have "sudo stap ...." or "sudo staprun ...." work later. --install-exec-hook: -- if [ `id -u` -eq 0 ]; then \ -- getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr; \ -- getent group stapusr >/dev/null && chgrp stapusr "$(DESTDIR)$(bindir)/staprun"; \ -- chmod 04110 "$(DESTDIR)$(bindir)/staprun"; \ -- fi -+#install-exec-hook: -+# if [ `id -u` -eq 0 ]; then \ -+# getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr; \ -+# getent group stapusr >/dev/null && chgrp stapusr "$(DESTDIR)$(bindir)/staprun"; \ -+# chmod 04110 "$(DESTDIR)$(bindir)/staprun"; \ -+# fi --- -2.11.0 - diff --git a/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch b/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch deleted file mode 100644 index b4f2fbc066..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/configure-allow-to-disable-libvirt.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5eb10d90af9178edb65e6091ae939d1b5b19bb78 Mon Sep 17 00:00:00 2001 -From: Wenzong Fan <wenzong.fan@windriver.com> -Date: Tue, 23 Sep 2014 04:47:10 -0400 -Subject: [PATCH] systemtap: allow to disable libvirt - -Upstream-Status: Pending - -Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> ---- - configure.ac | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index a631ae7..cb4885b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -525,10 +525,15 @@ dnl Check for the libvirt and libxml2 devel packages - - dnl We require libvirt >= 1.0.2 because stapvirt relies on the - dnl virDomainOpenChannel function, which was implemented in 1.0.2. --PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [ -- have_libvirt=yes -- AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed]) -- ], [have_libvirt=no]) -+AC_ARG_ENABLE([libvirt], -+ AS_HELP_STRING([--disable-libvirt], [Do not use libvirt even if present])) -+ -+if test "$enable_libvirt" != no; then -+ PKG_CHECK_MODULES([libvirt], [libvirt >= 1.0.2], [ -+ have_libvirt=yes -+ AC_DEFINE([HAVE_LIBVIRT],[1],[Define to 1 if libvirt development libraries are installed]) -+ ], [have_libvirt=no]) -+fi - AM_CONDITIONAL([HAVE_LIBVIRT], [test "${have_libvirt}" = "yes"]) - PKG_CHECK_MODULES([libxml2], [libxml-2.0], [ - have_libxml2=yes --- -1.7.9.5 - diff --git a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch b/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch deleted file mode 100644 index 9313a5aba3..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/monitor-option.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 93fc4744fedf6fc593ee656968da97f7b1862ada Mon Sep 17 00:00:00 2001 -From: Ross Burton <ross.burton@intel.com> -Date: Tue, 4 Oct 2016 16:37:53 +0100 -Subject: [PATCH 4/6] systemtap: rationalise dependencies - -Add an option to explicitly disable the monitor (and therefore the dependency on -json-c and ncurses). - -Upstream-Status: Pending -Signed-off-by: Ross Burton <ross.burton@intel.com> - ---- - configure.ac | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -Index: git/configure.ac -=================================================================== ---- git.orig/configure.ac -+++ git/configure.ac -@@ -766,13 +766,16 @@ dnl We want either (or both) python prob - AM_CONDITIONAL([HAVE_PYTHON_PROBES], - [test "x$have_python2_support" = "xyes" -o "x$have_python3_support" = "xyes"]) - -+AC_ARG_ENABLE([monitor], AS_HELP_STRING([--disable-monitor],[Disable monitor])) -+if test "$enable_monitor" != "no"; then - dnl Check for presence of json-c and ncurses for use in monitor mode - PKG_CHECK_MODULES([jsonc], [json-c >= 0.11], [have_jsonc=yes], [have_jsonc=no]) - PKG_CHECK_MODULES([ncurses], [ncurses], [have_ncurses=yes], [have_ncurses=no]) --AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes"]) - if test "${have_jsonc}" == "yes" -a "${have_ncurses}" == yes; then - AC_DEFINE([HAVE_MONITOR_LIBS],[1],[Define to 1 if json-c and ncurses libraries are installed]) - fi -+fi -+AM_CONDITIONAL([HAVE_MONITOR_LIBS], [test "${have_jsonc}" == "yes" -a "${have_ncurses}" == "yes" -a "$enable_monitor" != "no"]) - - AC_CACHE_CHECK([for assembler .section "?" flags support], stap_cv_sectionq, [ - old_CFLAGS="$CFLAGS" diff --git a/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch b/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch deleted file mode 100644 index 2c860b19e5..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/no-msgfmt-check.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 43f1b04449bb1cf7e0092263f1c2a25f3fca08ef Mon Sep 17 00:00:00 2001 -From: Ross Burton <ross.burton@intel.com> -Date: Tue, 8 Nov 2016 23:07:41 +0000 -Subject: [PATCH 5/6] systemtap: remove explicit msgfmt check - -There is no need to explicitly check that msgfmt was found as the gettext macros -handle this for us if NLS is enabled. - -Upstream-Status: Pending -Signed-off-by: Ross Burton <ross.burton@intel.com> - ---- - configure.ac | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 2ea9b3cbf..95417f59c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -36,10 +36,6 @@ AC_CHECK_FUNCS(openat) - AM_GNU_GETTEXT(external) - AM_GNU_GETTEXT_VERSION([0.19.4]) - --if test "x$GMSGFMT" = "x:"; then -- AC_MSG_ERROR([missing gnu /usr/bin/msgfmt]) --fi -- - # We want the 'PYTHON' varible to be python version 2. We also want - # our custom 'PYTHON3' varible to be python version 3. - # --- -2.11.0 - diff --git a/meta/recipes-kernel/systemtap/systemtap/x32_abi_time.patch b/meta/recipes-kernel/systemtap/systemtap/x32_abi_time.patch deleted file mode 100644 index 28a7eae407..0000000000 --- a/meta/recipes-kernel/systemtap/systemtap/x32_abi_time.patch +++ /dev/null @@ -1,34 +0,0 @@ -Fix time_t print because in x32 ABI is long long int instead of long int. - -Upstream-Status: Pending - -Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> - -diff --git a/cache.cxx b/cache.cxx -index 3546b30..19c77ca 100644 ---- a/cache.cxx -+++ b/cache.cxx -@@ -294,7 +294,11 @@ clean_cache(systemtap_session& s) - { - //interval not passed, don't continue - if (s.verbose > 1) -+#if defined(__x86_64__) && defined (__ILP32__) -+ clog << _F("Cache cleaning skipped, interval not reached %lld s / %lu s.", -+#else - clog << _F("Cache cleaning skipped, interval not reached %lu s / %lu s.", -+#endif - (current_time.tv_sec-sb.st_mtime), cache_clean_interval) << endl; - return; - } -@@ -302,7 +306,11 @@ clean_cache(systemtap_session& s) - { - //interval reached, continue - if (s.verbose > 1) -+#if defined(__x86_64__) && defined (__ILP32__) -+ clog << _F("Cleaning cache, interval reached %lld s > %lu s.", -+#else - clog << _F("Cleaning cache, interval reached %lu s > %lu s.", -+#endif - (current_time.tv_sec-sb.st_mtime), cache_clean_interval) << endl; - } - |