diff --git a/0001-Add-init-type-cast-to-resolve-gcc-issue.patch b/0001-Add-init-type-cast-to-resolve-gcc-issue.patch deleted file mode 100644 index 62c58bc..0000000 --- a/0001-Add-init-type-cast-to-resolve-gcc-issue.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Qiang Wei -Subject: [PATCH] Add int type cast to resolve gcc issue for option - Wformat=2. - -In ncruses 6.3 version, there is type complain for function wprintw - when gcc has option -Wformat=2. - -Signed-off-by: Qiang Wei ---- a/staprun/monitor.c 2022-03-09 06:45:30.534000000 +0000 -+++ b/staprun/monitor.c 2022-03-09 06:48:49.804000000 +0000 -@@ -448,12 +448,12 @@ - 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 @@ - 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)); diff --git a/0001-PR29094-Include-rpm-rpmcrypto.h-when-required.patch b/0001-PR29094-Include-rpm-rpmcrypto.h-when-required.patch deleted file mode 100644 index bedaf75..0000000 --- a/0001-PR29094-Include-rpm-rpmcrypto.h-when-required.patch +++ /dev/null @@ -1,93 +0,0 @@ -From d752cdd14eefd0dd0c81bb5b4d7787394335a49e Mon Sep 17 00:00:00 2001 -From: William Cohen -Date: Wed, 27 Apr 2022 14:14:17 -0400 -Subject: [PATCH] PR29094: Include rpm/rpmcrypto.h when required - -rpm-4.18.0 moved the prototypes for rpmFreeCrypto() into a new header, -/usr/include/rpm/rpmcrypto.h. Have the configure check for it -and include it when required. ---- - config.in | 3 +++ - configure | 19 +++++++++++++++++++ - configure.ac | 6 ++++++ - rpm_finder.cxx | 3 +++ - 4 files changed, 31 insertions(+) - -diff --git a/config.in b/config.in -index 64740c9..12cd394 100644 ---- a/config.in -+++ b/config.in -@@ -88,6 +88,9 @@ - /* have librpm */ - #undef HAVE_LIBRPM - -+/* have rpmcrypto.h */ -+#undef HAVE_RPMCRYPTO_H -+ - /* have librpmio */ - #undef HAVE_LIBRPMIO - -diff --git a/configure b/configure -index abc4e7f..3694dbb 100755 ---- a/configure -+++ b/configure -@@ -11524,6 +11524,25 @@ $as_echo "$as_me: WARNING: cannot find librpmio" >&2;} - fi - fi - -+for ac_header in rpm/rpmcrypto.h -+do : -+ ac_fn_c_check_header_mongrel "$LINENO" "rpm/rpmcrypto.h" "ac_cv_header_rpm_rpmcrypto_h" "$ac_includes_default" -+if test "x$ac_cv_header_rpm_rpmcrypto_h" = xyes; then : -+ cat >>confdefs.h <<_ACEOF -+#define HAVE_RPM_RPMCRYPTO_H 1 -+_ACEOF -+ -+ -+$as_echo "#define HAVE_RPMCRYPTO_H 1" >>confdefs.h -+ -+ have_rpmcrypto_h=yes -+ { $as_echo "$as_me:${as_lineno-$LINENO}: separate rpm/rpmcrypto.h" >&5 -+$as_echo "$as_me: separate rpm/rpmcrypto.h" >&6;} -+fi -+ -+done -+ -+ - LIBS_no_readline=$LIBS - - have_libreadline="no" -diff --git a/configure.ac b/configure.ac -index 4ef80b7..ccb4fe0 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -490,6 +490,12 @@ if test "$with_rpm" != "no"; then - fi - fi - -+dnl Look for rpmcrypto.h -+AC_CHECK_HEADERS([rpm/rpmcrypto.h], [ -+ AC_DEFINE([HAVE_RPMCRYPTO_H],[1],[have rpmcrypto_h]) -+ have_rpmcrypto_h=yes -+ AC_MSG_NOTICE([separate rpm/rpmcrypto.h])]) -+ - dnl Look for readline. - dnl - dnl First save the orignal value of LIBS. -diff --git a/rpm_finder.cxx b/rpm_finder.cxx -index 206669b..052058a 100644 ---- a/rpm_finder.cxx -+++ b/rpm_finder.cxx -@@ -26,6 +26,9 @@ extern "C" { - #include - #include - #include -+#ifdef HAVE_RPMCRYPTO_H -+#include -+#endif - #include - - #ifndef xfree --- -1.8.3.1 - diff --git a/0001-PR30405-stapkp_init-we-should-not-disable-preemption.patch b/0001-PR30405-stapkp_init-we-should-not-disable-preemption.patch new file mode 100644 index 0000000..865d015 --- /dev/null +++ b/0001-PR30405-stapkp_init-we-should-not-disable-preemption.patch @@ -0,0 +1,37 @@ +From ff265fa1ed86b85e021ec0f16a28ab48c237414a Mon Sep 17 00:00:00 2001 +From: "Yichun Zhang (agentzh)" +Date: Sat, 6 May 2023 15:21:14 -0700 +Subject: [PATCH] PR30405: stapkp_init(): we should not disable preemption + around the kallsyms_on_each_symbol() call + +--- + runtime/linux/kprobes.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c +index 09f0e0665..1875092c5 100644 +--- a/runtime/linux/kprobes.c ++++ b/runtime/linux/kprobes.c +@@ -763,9 +763,7 @@ stapkp_init(struct stap_kprobe_probe *probes, + #ifdef STAPCONF_MODULE_MUTEX + mutex_lock(&module_mutex); + #endif +- preempt_disable(); + kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); +- preempt_enable(); + #ifdef STAPCONF_MODULE_MUTEX + mutex_unlock(&module_mutex); + #endif +@@ -835,9 +833,7 @@ stapkp_refresh(const char *modname, + #ifdef STAPCONF_MODULE_MUTEX + mutex_lock(&module_mutex); + #endif +- preempt_disable(); + kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); +- preempt_enable(); + #ifdef STAPCONF_MODULE_MUTEX + mutex_unlock(&module_mutex); + #endif +-- +2.39.1 + diff --git a/0001-PR30415-conflicting-types-for-kallsyms_on_each_symbo.patch b/0001-PR30415-conflicting-types-for-kallsyms_on_each_symbo.patch new file mode 100644 index 0000000..5cb96bc --- /dev/null +++ b/0001-PR30415-conflicting-types-for-kallsyms_on_each_symbo.patch @@ -0,0 +1,231 @@ +From 33fae2d0107fb6166b4eac3fdffd277829849ab0 Mon Sep 17 00:00:00 2001 +From: Martin Cermak +Date: Fri, 2 Jun 2023 23:28:07 +0200 +Subject: [PATCH] =?UTF-8?q?PR30415:=20conflicting=20types=20for=20?= + =?UTF-8?q?=E2=80=98kallsyms=5Fon=5Feach=5Fsymbol=E2=80=99?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + runtime/linux/kprobes.c | 28 ++++++++++++++++++++++++- + runtime/linux/runtime.h | 8 +++++-- + runtime/sym.c | 39 +++++++++++++++++++++++++++++++++++ + runtime/transport/symbols.c | 4 ++++ + runtime/transport/transport.c | 1 + + staprun/staprun.c | 13 +++++++++++- + 6 files changed, 89 insertions(+), 4 deletions(-) + +diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c +index 1875092c5..6b30f2c52 100644 +--- a/runtime/linux/kprobes.c ++++ b/runtime/linux/kprobes.c +@@ -28,6 +28,9 @@ extern void *_stp_kallsyms_on_each_symbol; + #endif + #endif + ++// No export check and gates. This one seems simply like a non-export. ++extern void *_stp_module_kallsyms_on_each_symbol; ++ + #if defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL) && defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED) + #define USE_KALLSYMS_ON_EACH_SYMBOL (1) + #elif defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL) +@@ -684,7 +687,7 @@ struct stapkp_symbol_data { + + + static int +-stapkp_symbol_callback(void *data, const char *name, ++__stapkp_symbol_callback(void *data, const char *name, + struct module *mod, unsigned long addr) + { + struct stapkp_symbol_data *sd = data; +@@ -733,6 +736,19 @@ stapkp_symbol_callback(void *data, const char *name, + return 0; + } + ++static int ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0) ++stapkp_symbol_callback(void *data, const char *name, ++ unsigned long addr) ++{ ++ struct module *mod = NULL; ++#else ++stapkp_symbol_callback(void *data, const char *name, ++ struct module *mod, unsigned long addr) ++{ ++#endif ++ return __stapkp_symbol_callback(data, name, mod, addr); ++} + + static int + stapkp_init(struct stap_kprobe_probe *probes, +@@ -764,6 +780,11 @@ stapkp_init(struct stap_kprobe_probe *probes, + mutex_lock(&module_mutex); + #endif + kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0) ++ module_kallsyms_on_each_symbol(sd.modname, stapkp_symbol_callback, &sd); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0) ++ module_kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); ++#endif + #ifdef STAPCONF_MODULE_MUTEX + mutex_unlock(&module_mutex); + #endif +@@ -834,6 +855,11 @@ stapkp_refresh(const char *modname, + mutex_lock(&module_mutex); + #endif + kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0) ++ module_kallsyms_on_each_symbol(sd.modname, stapkp_symbol_callback, &sd); ++#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0) ++ module_kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); ++#endif + #ifdef STAPCONF_MODULE_MUTEX + mutex_unlock(&module_mutex); + #endif +diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h +index 86d64fd0d..f7b3cdcf0 100644 +--- a/runtime/linux/runtime.h ++++ b/runtime/linux/runtime.h +@@ -221,11 +221,15 @@ static void *_stp_kallsyms_lookup_name; + #ifndef CONFIG_PPC64 + #define STAPCONF_KALLSYMS_ON_EACH_SYMBOL + #if !defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED) +-// XXX Should not be static, since it is linked into kprobes.c. +-static void *_stp_kallsyms_on_each_symbol; ++// Not static, since it is linked into kprobes.c: ++void *_stp_kallsyms_on_each_symbol; + #endif + #endif + ++// No export check and gates. This one seems simply like a non-export. ++// Not static, since it is linked into kprobes.c: ++void *_stp_module_kallsyms_on_each_symbol; ++ + // PR13489, inode-uprobes sometimes lacks the necessary SYMBOL_EXPORT's. + #if !defined(STAPCONF_TASK_USER_REGSET_VIEW_EXPORTED) + static void *kallsyms_task_user_regset_view; +diff --git a/runtime/sym.c b/runtime/sym.c +index fc81ac5e8..29171b45f 100644 +--- a/runtime/sym.c ++++ b/runtime/sym.c +@@ -1155,9 +1155,15 @@ unsigned long kallsyms_lookup_name (const char *name) + typedef typeof(&kallsyms_on_each_symbol) kallsyms_on_each_symbol_fn; + + // XXX Will be linked in place of the kernel's kallsyms_on_each_symbol: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0) ++int kallsyms_on_each_symbol(int (*fn)(void *, const char *, ++ unsigned long), ++ void *data) ++#else + int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, + unsigned long), + void *data) ++#endif + { + /* First, try to use a kallsyms_lookup_name address passed to us + through the relocation mechanism. */ +@@ -1170,6 +1176,39 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, + _stp_error("BUG: attempting to use unavailable kallsyms_on_each_symbol!!\n"); + return 0; + } ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0) ++typedef typeof(&module_kallsyms_on_each_symbol) module_kallsyms_on_each_symbol_fn; ++ ++// XXX Will be linked in place of the kernel's module_kallsyms_on_each_symbol: ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0) ++int module_kallsyms_on_each_symbol(const char *modname, ++ int (*fn)(void *, const char *, ++ unsigned long), ++ void *data) ++#else ++int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, ++ unsigned long), ++ void *data) ++#endif ++{ ++ /* First, try to use a kallsyms_lookup_name address passed to us ++ through the relocation mechanism. */ ++ if (_stp_module_kallsyms_on_each_symbol != NULL) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0) ++ return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(modname, fn, data); ++#else ++ return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(fn, data); ++#endif ++ ++ /* Next, give up and signal a BUG. We should have detected ++ that this function is not available and used a different ++ mechanism! */ ++ _stp_error("BUG: attempting to use unavailable module_kallsyms_on_each_symbol!!\n"); ++ return 0; ++} ++#endif ++ + #endif + + +diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c +index 7f2fe0fc8..3af9a1098 100644 +--- a/runtime/transport/symbols.c ++++ b/runtime/transport/symbols.c +@@ -119,6 +119,10 @@ static void _stp_do_relocation(const char __user *buf, size_t count) + _stp_kallsyms_on_each_symbol = (void *) msg.address; + } + #endif ++ if (!strcmp ("kernel", msg.module) ++ && !strcmp ("module_kallsyms_on_each_symbol", msg.reloc)) { ++ _stp_module_kallsyms_on_each_symbol = (void *) msg.address; ++ } + + _stp_kmodule_update_address(msg.module, msg.reloc, msg.address); + } +diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c +index 3db76badf..cf57d4286 100644 +--- a/runtime/transport/transport.c ++++ b/runtime/transport/transport.c +@@ -614,6 +614,7 @@ static int _stp_transport_init(void) + #if defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL) && !defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED) + _stp_kallsyms_on_each_symbol = NULL; + #endif ++ _stp_module_kallsyms_on_each_symbol = NULL; + #if defined(CONFIG_KALLSYMS) && !defined(STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED) + _stp_need_kallsyms_stext = 0; + #endif +diff --git a/staprun/staprun.c b/staprun/staprun.c +index edd1bc67a..8437f3af6 100644 +--- a/staprun/staprun.c ++++ b/staprun/staprun.c +@@ -640,6 +640,7 @@ int send_relocation_kernel () + int found_stext = 0; + int found_kallsyms_lookup_name = 0; + int found_kallsyms_on_each_symbol = 0; ++ int found_module_kallsyms_on_each_symbol = 0; + int done_with_kallsyms = 0; + char *line = NULL; + size_t linesz = 0; +@@ -681,10 +682,20 @@ int send_relocation_kernel () + + found_kallsyms_on_each_symbol = 1; + } ++ else if (linesize - pos == sizeof "module_kallsyms_on_each_symbol" ++ && !strcmp(line + pos, "module_kallsyms_on_each_symbol" "\n")) ++ { ++ rc = send_a_relocation ("kernel", "module_kallsyms_on_each_symbol", address); ++ if (rc != 0) // non fatal, follows perror() ++ dbug(1, "Relocation was reloc module_kallsyms_on_each_symbol=%llx\n", address); ++ ++ found_module_kallsyms_on_each_symbol = 1; ++ } + } + done_with_kallsyms = found_stext + && found_kallsyms_lookup_name +- && found_kallsyms_on_each_symbol; ++ && found_kallsyms_on_each_symbol ++ && found_module_kallsyms_on_each_symbol; + } + free (line); + fclose (kallsyms); +-- +2.39.1 + diff --git a/0001-Support-newer-kernels-with-struct-module_memory.patch b/0001-Support-newer-kernels-with-struct-module_memory.patch new file mode 100644 index 0000000..55fcf28 --- /dev/null +++ b/0001-Support-newer-kernels-with-struct-module_memory.patch @@ -0,0 +1,67 @@ +From c893e0eaa4dedc90fafc9353ea00fc34ad4b6d42 Mon Sep 17 00:00:00 2001 +From: William Cohen +Date: Wed, 17 May 2023 10:38:31 -0400 +Subject: [PATCH] Support newer kernels with struct module_memory + +The upstream kernel commit ac3b43283923440900b4f36ca5f9f0b1ca43b70e +changed the structures for modules. The runtime printing of kernel +information accessed information about modules and the fields in +module structure. A test has been added to the autoconf list to +determine the appropriate fields to get information about the +module. +--- + buildrun.cxx | 2 ++ + runtime/linux/autoconf-module_memory.c | 3 +++ + runtime/linux/print.c | 6 ++++++ + 3 files changed, 11 insertions(+) + create mode 100644 runtime/linux/autoconf-module_memory.c + +diff --git a/buildrun.cxx b/buildrun.cxx +index a4a254c7d..7f4ad860d 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -512,6 +512,8 @@ compile_pass (systemtap_session& s) + + output_autoconf(s, o, cs, "autoconf-module_layout.c", + "STAPCONF_MODULE_LAYOUT", NULL); ++ output_autoconf(s, o, cs, "autoconf-module_memory.c", ++ "STAPCONF_MODULE_MEMORY", NULL); + output_autoconf(s, o, cs, "autoconf-mod_kallsyms.c", + "STAPCONF_MOD_KALLSYMS", NULL); + output_exportconf(s, o2, "get_user_pages_remote", "STAPCONF_GET_USER_PAGES_REMOTE"); +diff --git a/runtime/linux/autoconf-module_memory.c b/runtime/linux/autoconf-module_memory.c +new file mode 100644 +index 000000000..db04b8d2e +--- /dev/null ++++ b/runtime/linux/autoconf-module_memory.c +@@ -0,0 +1,3 @@ ++#include ++ ++struct module_memory ml; +diff --git a/runtime/linux/print.c b/runtime/linux/print.c +index 57a157986..594b155be 100644 +--- a/runtime/linux/print.c ++++ b/runtime/linux/print.c +@@ -361,6 +361,11 @@ static void _stp_print_kernel_info(char *sname, char *vstr, int ctx, int num_pro + (unsigned long) (THIS_MODULE->core_layout.size - THIS_MODULE->core_layout.text_size)/1024, + (unsigned long) (THIS_MODULE->core_layout.text_size)/1024, + #else ++#if STAPCONF_MODULE_MEMORY ++ (unsigned long) THIS_MODULE->mem[MOD_TEXT].base, ++ (unsigned long) (THIS_MODULE->mem[MOD_DATA].size)/1024, ++ (unsigned long) (THIS_MODULE->mem[MOD_TEXT].size)/1024, ++#else + #ifndef STAPCONF_GRSECURITY + (unsigned long) THIS_MODULE->module_core, + (unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size)/1024, +@@ -370,6 +375,7 @@ static void _stp_print_kernel_info(char *sname, char *vstr, int ctx, int num_pro + (unsigned long) (THIS_MODULE->core_size_rw - THIS_MODULE->core_size_rx)/1024, + (unsigned long) (THIS_MODULE->core_size_rx)/1024, + #endif ++#endif + #endif + ctx/1024, + _stp_allocated_net_memory/1024, +-- +2.39.1 + diff --git a/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch b/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch deleted file mode 100644 index 20608e0..0000000 --- a/0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch +++ /dev/null @@ -1,51 +0,0 @@ -From f199d1982ef8a6c6d5c06c082d057b8793bcc6aa Mon Sep 17 00:00:00 2001 -From: Serhei Makarov -Date: Fri, 21 Jan 2022 18:21:46 -0500 -Subject: [PATCH] gcc12 c++ compatibility re-tweak for rhel6: use function - pointer instead of lambdas instead of ptr_fun<> - -Saving 2 lines in ltrim/rtrim is probably not a good reason to drop -compatibility with the RHEL6 system compiler. Actually declaring a -named function and passing the function pointer is compatible with -everything. ---- - util.cxx | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) - -diff --git a/util.cxx b/util.cxx -index e9286eca3..ad36259c9 100644 ---- a/util.cxx -+++ b/util.cxx -@@ -1757,21 +1757,24 @@ flush_to_stream (const string &fname, ostream &o) - return 1; // Failure - } - -+int -+not_isspace(unsigned char c) -+{ -+ return !std::isspace(c); -+} -+ - // trim from start (in place) - void - ltrim(std::string &s) - { -- s.erase(s.begin(), -- std::find_if(s.begin(), s.end(), -- [](unsigned char c) { return !std::isspace(c); })); -+ s.erase(s.begin(), std::find_if(s.begin(), s.end(), not_isspace)); - } - - // trim from end (in place) - void - rtrim(std::string &s) - { -- s.erase(std::find_if(s.rbegin(), s.rend(), -- [](unsigned char c) { return !std::isspace(c); }).base(), s.end()); -+ s.erase(std::find_if(s.rbegin(), s.rend(), not_isspace).base(), s.end()); - } - - // trim from both ends (in place) --- -2.21.0.windows.1 - diff --git a/0001-gcc12-c-compatibility-tweak-use-lambdas-instead-of-p.patch b/0001-gcc12-c-compatibility-tweak-use-lambdas-instead-of-p.patch deleted file mode 100644 index 70a9f04..0000000 --- a/0001-gcc12-c-compatibility-tweak-use-lambdas-instead-of-p.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 56c498d95c4749f15980da73b4933e7443b3f26c Mon Sep 17 00:00:00 2001 -From: Jonathan Wakely -Date: Tue, 18 Jan 2022 15:52:18 -0500 -Subject: [PATCH] gcc12 c++ compatibility tweak: use lambdas instead of - ptr_fun<> - -Even while stap is a c++11 code base, such cleanups make code -nicer to look at. ---- - util.cxx | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/util.cxx b/util.cxx -index c20f76003..e9286eca3 100644 ---- a/util.cxx -+++ b/util.cxx -@@ -1763,7 +1763,7 @@ ltrim(std::string &s) - { - s.erase(s.begin(), - std::find_if(s.begin(), s.end(), -- std::not1(std::ptr_fun(std::isspace)))); -+ [](unsigned char c) { return !std::isspace(c); })); - } - - // trim from end (in place) -@@ -1771,7 +1771,7 @@ void - rtrim(std::string &s) - { - s.erase(std::find_if(s.rbegin(), s.rend(), -- std::not1(std::ptr_fun(std::isspace))).base(), s.end()); -+ [](unsigned char c) { return !std::isspace(c); }).base(), s.end()); - } - - // trim from both ends (in place) --- -2.21.0.windows.1 - diff --git a/0001-python-3.11-removed-direct-access-to-PyFrameObject-m.patch b/0001-python-3.11-removed-direct-access-to-PyFrameObject-m.patch deleted file mode 100644 index e429d6f..0000000 --- a/0001-python-3.11-removed-direct-access-to-PyFrameObject-m.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 069e109c95d1afca17cd3781b39f220cf8b39978 Mon Sep 17 00:00:00 2001 -From: Stan Cox -Date: Wed, 13 Jul 2022 09:49:51 -0400 -Subject: [PATCH] python 3.11 removed direct access to PyFrameObject members - -Take into account the change in PyFrameObject definition to allow -building systemtap with python 3.11. Additional support for python -3.11 is forthcoming. ---- - python/HelperSDT/_HelperSDT.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/python/HelperSDT/_HelperSDT.c b/python/HelperSDT/_HelperSDT.c -index 967cb6077..4d287132e 100644 ---- a/python/HelperSDT/_HelperSDT.c -+++ b/python/HelperSDT/_HelperSDT.c -@@ -14,7 +14,13 @@ - // PR25841: ensure that the libHelperSDT.so file contains debuginfo - // for the tapset helper functions, so they don't have to look into libpython* - #include -+// python 3.11 removed direct access to PyFrameObject members -+// https://docs.python.org/3.11/whatsnew/3.11.html#c-api-changes -+#if PY_MAJOR_VERSION <= 3 && PY_MINOR_VERSION < 11 - PyFrameObject _dummy_frame; -+#else -+//PyFrameObject *_dummy_frame; -+#endif - #include - PyVarObject _dummy_var; - #include --- -2.21.0.windows.1 - diff --git a/huawei-fix-py3example-script-run-fail.patch b/huawei-fix-py3example-script-run-fail.patch deleted file mode 100644 index 63df37c..0000000 --- a/huawei-fix-py3example-script-run-fail.patch +++ /dev/null @@ -1,59 +0,0 @@ -From af456ec9eefd320b496ce54686ca2099c26ca301 Mon Sep 17 00:00:00 2001 -From: langfei -Date: Wed, 5 Jul 2023 10:32:14 +0800 -Subject: [PATCH] fix py3example script run fail - -Signed-off-by: langfei ---- - .../general/tapset/python_local.stpm | 37 ++++++++++++++++++- - 1 file changed, 36 insertions(+), 1 deletion(-) - -diff --git a/testsuite/systemtap.examples/general/tapset/python_local.stpm b/testsuite/systemtap.examples/general/tapset/python_local.stpm -index 84f9a55..f02ff7a 100644 ---- a/testsuite/systemtap.examples/general/tapset/python_local.stpm -+++ b/testsuite/systemtap.examples/general/tapset/python_local.stpm -@@ -7,5 +7,40 @@ - # Set this to the location of the python 3 .so - @define PYTHON3_LIBRARY - %( -- "/usr/lib64/libpython3.4m.so.1.0" -+ "/usr/lib64/libpython3.7m.so.1.0" -+%) -+ -+@define Py3DictKeysObject(object) %( -+ @cast(@object, "PyDictKeysObject", @PYTHON3_LIBRARY) -+ %) -+@define Py3DictKeyEntry(object) %( -+ @cast(@object, "PyDictKeyEntry", @PYTHON3_LIBRARY) -+ %) -+ -+@define DK_SIZE(dk) %( -+ @Py3DictKeysObject(@dk)->dk_size -+%) -+@define DK_IXSIZE(dk) %( -+ %( CONFIG_64BIT == "y" %? -+ %( CONFIG_COMPAT == "y" %? -+ (@__compat_task -+ ? (@DK_SIZE(@dk) <= 0xff ? 1 : (@DK_SIZE(@dk) <= 0xffff ? 2 -+: 4)) -+ : (@DK_SIZE(@dk) <= 0xff ? -+ 1 : (@DK_SIZE(@dk) <= 0xffff ? -+ 2 : (@DK_SIZE(@dk) <= 0xffffffff ? 4 : 8)))) -+ %: -+ (@DK_SIZE(@dk) <= 0xff ? -+ 1 : (@DK_SIZE(@dk) <= 0xffff ? -+ 2 : (@DK_SIZE(@dk) <= 0xffffffff ? 4 : 8))) -+ %) -+ %: -+ (@DK_SIZE(@dk) <= 0xff ? 1 : (@DK_SIZE(@dk) <= 0xffff ? 2 : 4)) -+ %) -+%) -+ -+@define DK_ENTRIES(dk) %( -+ (@choose_defined(@Py3DictKeysObject(@dk)->dk_entries, -+(&@Py3DictKeyEntry(&@Py3DictKeysObject(@dk)->dk_indices[@DK_SIZE(@dk) * -+@DK_IXSIZE(@dk)])))) - %) --- -2.33.0 - diff --git a/huawei-fix-py3example-script-run-fail2.patch b/huawei-fix-py3example-script-run-fail2.patch deleted file mode 100644 index 8b8dfa3..0000000 --- a/huawei-fix-py3example-script-run-fail2.patch +++ /dev/null @@ -1,44 +0,0 @@ -From ee556777a8f7d46ccfe0d53dd1088ab1724c9e42 Mon Sep 17 00:00:00 2001 -From: langfei -Date: Wed, 5 Jul 2023 10:40:41 +0800 -Subject: [PATCH] fix py3example script run fail2 - -Signed-off-by: langfei ---- - .../systemtap.examples/general/tapset/python3_local.stp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/testsuite/systemtap.examples/general/tapset/python3_local.stp b/testsuite/systemtap.examples/general/tapset/python3_local.stp -index 4e26946..197be47 100644 ---- a/testsuite/systemtap.examples/general/tapset/python3_local.stp -+++ b/testsuite/systemtap.examples/general/tapset/python3_local.stp -@@ -182,7 +182,7 @@ function p3_get_dict_hash (dict, i) { - n = @cast (dict, "PyDictObject", @PYTHON3_LIBRARY)->ma_used; - if (i > n || entries == 0) - return 0 -- return @cast (entries, "PyDictKeysObject", @PYTHON3_LIBRARY)->dk_entries[i]->me_hash -+ return @cast (@DK_ENTRIES(entries), "PyDictKeyEntry", @PYTHON3_LIBRARY)[i]->me_hash - } - - # FUNCTION P3_GET_DICT_KEY -@@ -195,7 +195,7 @@ function p3_get_dict_key (dict, i) { - n = @cast (dict, "PyDictObject", @PYTHON3_LIBRARY)->ma_used; - if (i > n || entries == 0) - return 0 -- return @cast (entries, "PyDictKeysObject", @PYTHON3_LIBRARY)->dk_entries[i]->me_key -+ return @cast (@DK_ENTRIES(entries), "PyDictKeyEntry", @PYTHON3_LIBRARY)[i]->me_key - } - - # FUNCTION P3_GET_DICT_VALUE -@@ -214,7 +214,7 @@ function p3_get_dict_value (dict, i) { - n = @cast (dict, "PyDictObject", @PYTHON3_LIBRARY)->ma_used; - if (i > n || entries == 0) - return 0 -- return @cast (entries, "PyDictKeysObject", @PYTHON3_LIBRARY)->dk_entries[i]->me_value -+ return @cast (@DK_ENTRIES(entries), "PyDictKeyEntry", @PYTHON3_LIBRARY)[i]->me_value - } - } - --- -2.33.0 - diff --git a/systemtap-4.5.tar.gz b/systemtap-4.5.tar.gz deleted file mode 100644 index cfe30e0..0000000 Binary files a/systemtap-4.5.tar.gz and /dev/null differ diff --git a/systemtap-4.9.tar.gz b/systemtap-4.9.tar.gz new file mode 100644 index 0000000..8f22669 Binary files /dev/null and b/systemtap-4.9.tar.gz differ diff --git a/systemtap.spec b/systemtap.spec index 892b67c..ee59303 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -21,23 +21,19 @@ %undefine __brp_mangle_shebangs Name: systemtap -Version: 4.5 -Release: 7 +Version: 4.9 +Release: 1 Summary: Linux trace and probe tool License: GPLv2+ and Public Domain URL: http://sourceware.org/systemtap Source: https://sourceware.org/systemtap/ftp/releases/%{name}-%{version}.tar.gz -Patch1: 0001-Add-init-type-cast-to-resolve-gcc-issue.patch -Patch2: 0001-PR29094-Include-rpm-rpmcrypto.h-when-required.patch -Patch3: 0001-gcc12-c-compatibility-tweak-use-lambdas-instead-of-p.patch -Patch4: 0001-gcc12-c-compatibility-re-tweak-for-rhel6-use-functio.patch -Patch5: 0001-python-3.11-removed-direct-access-to-PyFrameObject-m.patch +Patch1: 0001-PR30405-stapkp_init-we-should-not-disable-preemption.patch +Patch2: 0001-Support-newer-kernels-with-struct-module_memory.patch +Patch3: 0001-PR30415-conflicting-types-for-kallsyms_on_each_symbo.patch -Patch9000: huawei-fix-py3example-script-run-fail.patch -Patch9001: huawei-fix-py3example-script-run-fail2.patch -Patch9002: huawei-fix-network-tcp-test-error.patch -Patch9003: huawei-local-is-only-valid-in-functions-for-shellche-sc2168.patch +Patch9000: huawei-fix-network-tcp-test-error.patch +Patch9001: huawei-local-is-only-valid-in-functions-for-shellche-sc2168.patch BuildRequires: gcc-c++ emacs systemd python3-setuptools BuildRequires: gettext-devel rpm-devel readline-devel @@ -170,6 +166,17 @@ This package includes files for a systemd service that manages systemtap sessions and relays prometheus metrics from the sessions to remote requesters on demand. +%package jupyter +Summary: ISystemtap jupyter kernel and examples +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap = %{version}-%{release} + +%description jupyter +This package includes files needed to build and run +the interactive systemtap Jupyter kernel, either locally +or within a container. + %package help Summary: systemtap manual License: GPLv2+ @@ -395,6 +402,7 @@ exit 0 %files devel -f systemtap.lang %{_bindir}/stap %{_bindir}/stap-prep +%{_bindir}/stap-profile-annotate %{_bindir}/stap-report %dir %{_datadir}/systemtap %{_datadir}/systemtap/runtime @@ -461,10 +469,23 @@ exit 0 /usr/sbin/stap-exporter /etc/sysconfig/stap-exporter +%files jupyter +%{_bindir}/stap-jupyter-container +%{_bindir}/stap-jupyter-install +%{_mandir}/man1/stap-jupyter.1* +%dir %{_datadir}/systemtap +%{_datadir}/systemtap/interactive-notebook + %files help %{_mandir}/man[1378]/* %changelog +* Wed Sep 6 2023 langfei - 4.9-1 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:Upgrade to 4.9 + * Tue Aug 8 2023 langfei - 4.5-7 - Type:bugfix - CVE:NA