From 73a3548958d41e7da4959df593f4c2bf8e913970 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Mon, 30 Sep 2024 15:10:49 +0000 Subject: [PATCH] import CS systemtap-5.1-4.el9 --- .gitignore | 2 +- .systemtap.metadata | 2 +- SOURCES/PR31495.patch | 29 ++++++++ SOURCES/RHEL-16549.patch | 59 --------------- SOURCES/RHEL-18334.patch | 147 -------------------------------------- SOURCES/RHEL-36199a.patch | 116 ++++++++++++++++++++++++++++++ SOURCES/RHEL-36199b.patch | 22 ++++++ SOURCES/RHEL-50107.patch | 79 ++++++++++++++++++++ SPECS/systemtap.spec | 51 ++++++++++--- 9 files changed, 288 insertions(+), 219 deletions(-) create mode 100644 SOURCES/PR31495.patch delete mode 100644 SOURCES/RHEL-16549.patch delete mode 100644 SOURCES/RHEL-18334.patch create mode 100644 SOURCES/RHEL-36199a.patch create mode 100644 SOURCES/RHEL-36199b.patch create mode 100644 SOURCES/RHEL-50107.patch diff --git a/.gitignore b/.gitignore index d99c51e..a4aa422 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/systemtap-5.0.tar.gz +SOURCES/systemtap-5.1.tar.gz diff --git a/.systemtap.metadata b/.systemtap.metadata index 78736e1..765d7d6 100644 --- a/.systemtap.metadata +++ b/.systemtap.metadata @@ -1 +1 @@ -f44f1853ddd462ac97b2c7c4b3a9434440d9d9c2 SOURCES/systemtap-5.0.tar.gz +5a2a16c61e815ead31e655665e6ee9cf7772f1de SOURCES/systemtap-5.1.tar.gz diff --git a/SOURCES/PR31495.patch b/SOURCES/PR31495.patch new file mode 100644 index 0000000..d8d8192 --- /dev/null +++ b/SOURCES/PR31495.patch @@ -0,0 +1,29 @@ +commit b87891f5aff91b8ebbda8d9218009495848f7747 +Author: Martin Cermak +Date: Thu May 16 16:51:08 2024 +0200 + + PR31495: teach stap-prep to work with other RT kernels + +diff --git a/stap-prep b/stap-prep +index 8b429f880..2bbb6bc2f 100755 +--- a/stap-prep ++++ b/stap-prep +@@ -103,13 +103,16 @@ done + # 5.14.0-200.rt14.201.el9 -> + # "kernel-rt-debug-5.14.0-200.rt14.201.el9" + # OR?! "kernel-rt-5.14.0-200.rt14.201.el9" +-if expr "$UNAME" : ".*\.rt.*" >/dev/null; ++# OR??!"kernel-rt-5.14.0-447.el9.x86_64+rt" ++if expr "$UNAME" : ".*\.rt.*" || expr "$UNAME" : ".*\+rt.*" >/dev/null; + then + KERNEL=`echo $KERNEL | sed -e s,kernel,kernel-rt,` + fi + + KERN_ARCH=`uname -m` +-KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname ++# strip arch from uname, for kernels like 5.14.0-447.el9.x86_64+rt or ++# 6.9.0-0.rc2.1.el10.x86_64+rt strip the +rt suffix too ++KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH// | sed s/\+rt$//` + if [ -x /usr/bin/dnf4 ]; then + DI="dnf4 debuginfo-install" + DI_DEPS="" diff --git a/SOURCES/RHEL-16549.patch b/SOURCES/RHEL-16549.patch deleted file mode 100644 index 4469759..0000000 --- a/SOURCES/RHEL-16549.patch +++ /dev/null @@ -1,59 +0,0 @@ -commit 0fef0bd60ff4b359a32da52262855dfe82fe51ae -gpg: Signature made Tue 14 Nov 2023 03:20:12 PM EST -gpg: using RSA key 4B35DCD2EA45C4E0783135BC8094BE9C9F4696A1 -gpg: Can't check signature: No public key -Author: Yichun Zhang (agentzh) -Date: Fri Nov 10 21:51:56 2023 -0800 - - PR31051: memory and uprobe leaks in early uprobe registraton code when errors happen - -diff --git a/runtime/linux/uprobes-inode.c b/runtime/linux/uprobes-inode.c -index 997f4528d..289cce00b 100644 ---- a/runtime/linux/uprobes-inode.c -+++ b/runtime/linux/uprobes-inode.c -@@ -529,6 +529,16 @@ stapiu_init(struct stapiu_consumer *consumers, size_t nconsumers) - } - - if (unlikely(ret != 0)) { -+ for ( ;; ) { -+ struct stapiu_consumer *c = &consumers[i]; -+ // protect against conceivable stapiu_refresh() at same time -+ mutex_lock(& c->consumer_lock); -+ stapiu_consumer_unreg(c); -+ mutex_unlock(& c->consumer_lock); -+ if (i == 0) -+ break; -+ i--; -+ } - return ret; - } - -@@ -545,7 +555,27 @@ stapiu_init(struct stapiu_consumer *consumers, size_t nconsumers) - break; - } - } -- return ret; -+ -+ if (unlikely(ret != 0)) { -+ int j; -+ for (j = 0; j < nconsumers; ++j) { -+ struct stapiu_consumer *c = &consumers[j]; -+ // protect against conceivable stapiu_refresh() at same time -+ mutex_lock(& c->consumer_lock); -+ stapiu_consumer_unreg(c); -+ mutex_unlock(& c->consumer_lock); -+ } -+ for ( ;; ) { -+ struct stapiu_consumer *c = &consumers[i]; -+ stap_cleanup_task_finder_target(&c->finder); -+ if (i == 0) -+ break; -+ i--; -+ } -+ return ret; -+ } -+ -+ return 0; - } - - diff --git a/SOURCES/RHEL-18334.patch b/SOURCES/RHEL-18334.patch deleted file mode 100644 index 4b1c536..0000000 --- a/SOURCES/RHEL-18334.patch +++ /dev/null @@ -1,147 +0,0 @@ -commit b84a5e8c2c5a857c0790a71df7824259a95131cf -Author: William Cohen -Date: Mon Dec 4 11:28:10 2023 -0500 - - PR31074: Ensure that the set_kernel_string* functions limit their writes - - Both the set_kernel_string and set_kernel_string_n function use the - underlying _stp_store_deref_string_ function to write strings. There - were two issues with the this function: - - 1) wrote MAXSTRINGLEN bytes even if string was shorter - 2) null write at end could spill past end of buffer - - The first issue was addressed by stopping to write once a null - character is encountered. The second issue is a side effect of C - implicit promotion of character constants to ints and was addressed by - explicitlying casting the character constants as a char. - - The pr31074.exp test was added to verify that the write length are - limited to string length and the null write does not go beyond the end - of the buffer. - -diff --git a/runtime/linux/loc2c-runtime.h b/runtime/linux/loc2c-runtime.h -index 68fbe2ab6..663360293 100644 ---- a/runtime/linux/loc2c-runtime.h -+++ b/runtime/linux/loc2c-runtime.h -@@ -1007,11 +1007,14 @@ static inline int _stp_store_deref_string_(char *src, void *addr, size_t len, - { - for (i = 0; i < len - 1; ++i) - { -+ if (*src == '\0') -+ break; - err = __stp_put_either(*src++, (u8 *)addr + i, seg); - if (err) - goto out; - } -- err = __stp_put_either('\0', (u8 *)addr + i, seg); -+ /* PR31074: cast (char) '\0' to make sure right size */ -+ err = __stp_put_either((char) '\0', (u8 *)addr + i, seg); - } - - out: -diff --git a/testsuite/systemtap.base/pr31074.exp b/testsuite/systemtap.base/pr31074.exp -new file mode 100644 -index 000000000..5b382b789 ---- /dev/null -+++ b/testsuite/systemtap.base/pr31074.exp -@@ -0,0 +1,5 @@ -+# Check that the set_kernel_* functions work correctly. -+ -+set test "pr31074" -+ -+stap_run $test no_load $all_pass_string -g $srcdir/$subdir/$test.stp -diff --git a/testsuite/systemtap.base/pr31074.stp b/testsuite/systemtap.base/pr31074.stp -new file mode 100644 -index 000000000..930c276b5 ---- /dev/null -+++ b/testsuite/systemtap.base/pr31074.stp -@@ -0,0 +1,88 @@ -+/* -+ * pr31074.stp -+ * -+ * Check that the set_kernel_string function work correctly. -+ */ -+ -+probe begin { println("systemtap starting probe") } -+probe end { println("systemtap ending probe") } -+ -+global errors = 0 -+ -+function assert_string(test, expected, value) -+{ -+ if (value == expected) -+ return 1 -+ printf("systemtap test failure - %s: expected \"%s\", got \"%s\"\n", -+ test, expected, value) -+ errors++ -+ return 0 -+} -+ -+function assert_not_reached(test) -+{ -+ printf("systemtap test failure - %s: missing exception\n", test) -+ errors++ -+} -+ -+function assert_buffer_untouched(test, addr) -+{ -+ if (!buffer_42(addr)) { -+ printf("systemtap test failure - %s: buffer overwritten\n", test) -+ errors++ -+ } -+} -+ -+ -+probe end(1) -+{ -+ test = "set_kernel_string" -+ addr3 = get_buffer3() -+ addr2 = get_buffer2() -+ if (assert_string(test, "", kernel_string(addr2))) { -+ set_kernel_string(addr2, "bar") -+ assert_string(test, "bar", kernel_string(addr2)) -+ } -+ addr1 = get_buffer1() -+ if (assert_string(test, "", kernel_string(addr1))) { -+ set_kernel_string(addr1, "foo") -+ assert_string(test, "foo", kernel_string(addr1)) -+ } -+ /* now check to make sure that "bar" has not been overwritten */ -+ assert_string("no null overrun", "bar", kernel_string(addr2)) -+ assert_buffer_untouched("no overrun", addr3) -+ if (!errors) -+ println("systemtap test success") -+} -+ -+%{ -+ static char buffer_x[4+4+MAXSTRINGLEN]; -+%} -+ -+function get_buffer1:long () %{ -+ static char *buffer1 = &(buffer_x[0]); -+ memset(buffer1, 0, 4); -+ STAP_RETVALUE = (long)buffer1; -+%} -+ -+function get_buffer2:long () %{ -+ static char *buffer2 = &(buffer_x[4]); -+ memset(buffer2, 0, 4); -+ STAP_RETVALUE = (long)buffer2; -+%} -+ -+function get_buffer3:long () %{ -+ static char *buffer3 = &(buffer_x[8]); -+ memset(buffer3, 42, MAXSTRINGLEN); -+ STAP_RETVALUE = (long)buffer3; -+%} -+ -+function buffer_42:long (addr:long) %{ -+ int i; -+ char *buffer3 = (char *)STAP_ARG_addr; -+ STAP_RETVALUE = 1; -+ for(i=0; i< MAXSTRINGLEN; ++i){ -+ if (buffer3[i] != 42) -+ STAP_RETVALUE = 0; -+ } -+%} diff --git a/SOURCES/RHEL-36199a.patch b/SOURCES/RHEL-36199a.patch new file mode 100644 index 0000000..26994cf --- /dev/null +++ b/SOURCES/RHEL-36199a.patch @@ -0,0 +1,116 @@ +commit b8d4274d1e7697801c12c512b6724dd3f59f2c72 +Author: William Cohen +Date: Mon May 6 11:36:42 2024 -0400 + + Support kernels that backported kallsym functions from newer linux kernels + + Some Linux distributions may have backported + module_kallsyms_on_each_symbol and kallsyms_on_each_symbol functions + from newer linux kernels. In these situations checking the kernel + version would not detect the proper arguments for these functions. + Systemtap now has a couple of autoconf tests to determine what + arguments should be used for these functions. + +diff --git a/buildrun.cxx b/buildrun.cxx +index bb7bdcc9d..8ee8c391f 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -506,6 +506,8 @@ compile_pass (systemtap_session& s) + + output_autoconf(s, o, cs, "autoconf-pagefault_disable.c", "STAPCONF_PAGEFAULT_DISABLE", NULL); + output_exportconf(s, o2, "kallsyms_lookup_name", "STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED"); ++ output_autoconf(s, o, cs, "autoconf-kallsyms_6_3.c", "STAPCONF_KALLSYMS_6_3", NULL); ++ output_autoconf(s, o, cs, "autoconf-kallsyms_6_4.c", "STAPCONF_KALLSYMS_6_4", NULL); + output_autoconf(s, o, cs, "autoconf-uidgid.c", "STAPCONF_LINUX_UIDGID_H", NULL); + output_exportconf(s, o2, "sigset_from_compat", "STAPCONF_SIGSET_FROM_COMPAT_EXPORTED"); + output_exportconf(s, o2, "vzalloc", "STAPCONF_VZALLOC"); +diff --git a/runtime/linux/autoconf-kallsyms_6_3.c b/runtime/linux/autoconf-kallsyms_6_3.c +new file mode 100644 +index 000000000..0af1a5c35 +--- /dev/null ++++ b/runtime/linux/autoconf-kallsyms_6_3.c +@@ -0,0 +1,6 @@ ++#include ++ ++int module_kallsyms_on_each_symbol(const char *modname, ++ int (*fn)(void *, const char *, struct module*, ++ unsigned long), ++ void *data); +diff --git a/runtime/linux/autoconf-kallsyms_6_4.c b/runtime/linux/autoconf-kallsyms_6_4.c +new file mode 100644 +index 000000000..3b3680c53 +--- /dev/null ++++ b/runtime/linux/autoconf-kallsyms_6_4.c +@@ -0,0 +1,3 @@ ++#include ++int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long), ++ void *data); +diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c +index 6b30f2c52..2fba61cbb 100644 +--- a/runtime/linux/kprobes.c ++++ b/runtime/linux/kprobes.c +@@ -737,7 +737,7 @@ __stapkp_symbol_callback(void *data, const char *name, + } + + static int +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0) ++#if defined(STAPCONF_KALLSYMS_6_4) + stapkp_symbol_callback(void *data, const char *name, + unsigned long addr) + { +@@ -780,7 +780,7 @@ 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) ++#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4) + 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); +@@ -855,7 +855,7 @@ 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) ++#if defined(STAPCONF_KALLSYMS_6_3) + 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); +diff --git a/runtime/sym.c b/runtime/sym.c +index 3947d42f7..23dd3be30 100644 +--- a/runtime/sym.c ++++ b/runtime/sym.c +@@ -1187,7 +1187,7 @@ 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) ++#if defined(STAPCONF_KALLSYMS_6_4) + int kallsyms_on_each_symbol(int (*fn)(void *, const char *, + unsigned long), + void *data) +@@ -1214,13 +1214,13 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *, + 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) ++#if defined(STAPCONF_KALLSYMS_6_4) + int module_kallsyms_on_each_symbol(const char *modname, + int (*fn)(void *, const char *, + unsigned long), + void *data) + #else +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0) ++#if defined(STAPCONF_KALLSYMS_6_3) + int module_kallsyms_on_each_symbol(const char *modname, + int (*fn)(void *, const char *, struct module *, + unsigned long), +@@ -1235,7 +1235,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module + /* 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,3,0) ++#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4) + return ibt_wrapper(int, + (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(modname, fn, data)); + #else diff --git a/SOURCES/RHEL-36199b.patch b/SOURCES/RHEL-36199b.patch new file mode 100644 index 0000000..2e840f4 --- /dev/null +++ b/SOURCES/RHEL-36199b.patch @@ -0,0 +1,22 @@ +commit ed5649f64a3f8c2e8269f9c4435e9174c4e8c775 +Author: William Cohen +Date: Thu May 9 12:23:54 2024 -0400 + + Support kernels that backported kallsym functions (part 2) + + Git commit b8d4274d1e769780 omitted a test for the Linux 6.4 version + of kallsyms function in runtime/linux/kprobes.c. + +diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c +index 2fba61cbb..9ae5565e3 100644 +--- a/runtime/linux/kprobes.c ++++ b/runtime/linux/kprobes.c +@@ -855,7 +855,7 @@ stapkp_refresh(const char *modname, + mutex_lock(&module_mutex); + #endif + kallsyms_on_each_symbol(stapkp_symbol_callback, &sd); +-#if defined(STAPCONF_KALLSYMS_6_3) ++#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4) + 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); diff --git a/SOURCES/RHEL-50107.patch b/SOURCES/RHEL-50107.patch new file mode 100644 index 0000000..df2fd07 --- /dev/null +++ b/SOURCES/RHEL-50107.patch @@ -0,0 +1,79 @@ +diff --git a/buildrun.cxx b/buildrun.cxx +index a7fcd6297..e3f2f83d1 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -400,6 +400,7 @@ compile_pass (systemtap_session& s) + output_exportconf(s, o2, "__module_text_address", "STAPCONF_MODULE_TEXT_ADDRESS"); + output_exportconf(s, o2, "add_timer_on", "STAPCONF_ADD_TIMER_ON"); + output_autoconf(s, o, cs, "autoconf-514-panic.c", "STAPCONF_514_PANIC", NULL); ++ output_autoconf(s, o, cs, "autoconf-task_work_cancel_func.c", "STAPCONF_TASK_WORK_CANCEL_FUNC", NULL); + + output_dual_exportconf(s, o2, "probe_kernel_read", "probe_kernel_write", "STAPCONF_PROBE_KERNEL"); + output_autoconf(s, o, cs, "autoconf-hw_breakpoint_context.c", +diff --git a/runtime/linux/autoconf-task_work_cancel_func.c b/runtime/linux/autoconf-task_work_cancel_func.c +new file mode 100644 +index 000000000..0d460de6c +--- /dev/null ++++ b/runtime/linux/autoconf-task_work_cancel_func.c +@@ -0,0 +1,3 @@ ++#include ++ ++void* c = & task_work_cancel_func; +diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h +index 0e9fe3fea..bd9307385 100644 +--- a/runtime/linux/runtime.h ++++ b/runtime/linux/runtime.h +@@ -265,7 +265,7 @@ static void *kallsyms_uprobe_get_swbp_addr; + static void *kallsyms_task_work_add; + #endif + #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) +-static void *kallsyms_task_work_cancel; ++static void *kallsyms_task_work_cancel_fn; + #endif + + #if !defined(STAPCONF_TRY_TO_WAKE_UP_EXPORTED) && !defined(STAPCONF_WAKE_UP_STATE_EXPORTED) +diff --git a/runtime/stp_task_work.c b/runtime/stp_task_work.c +index 0dd3095b6..4818fecbf 100644 +--- a/runtime/stp_task_work.c ++++ b/runtime/stp_task_work.c +@@ -3,14 +3,25 @@ + + #include "linux/task_work_compatibility.h" + ++// Handle kernel commit 68cbd415dd4b9c5b9df69f0f091879e56bf5907a ++// task_work: s/task_work_cancel()/task_work_cancel_func()/ ++#if defined(STAPCONF_TASK_WORK_CANCEL_FUNC) ++#define TASK_WORK_CANCEL_FN task_work_cancel_func ++#else ++#define TASK_WORK_CANCEL_FN task_work_cancel ++#endif ++ ++#define STRINGIFY(x) #x ++#define TOSTRING(x) STRINGIFY(x) ++ + #if !defined(STAPCONF_TASK_WORK_ADD_EXPORTED) + // First typedef from the original decls, then #define as typecasted calls. + typedef typeof(&task_work_add) task_work_add_fn; + #define task_work_add(a,b,c) ibt_wrapper(int, (* (task_work_add_fn)kallsyms_task_work_add)((a), (b), (c))) + #endif + #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) +-typedef typeof(&task_work_cancel) task_work_cancel_fn; +-#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel)((a), (b))) ++typedef typeof(&TASK_WORK_CANCEL_FN) task_work_cancel_fn; ++#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel_fn)((a), (b))) + #endif + + /* To avoid a crash when a task_work callback gets called after the +@@ -35,9 +46,9 @@ stp_task_work_init(void) + } + #endif + #if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED) +- kallsyms_task_work_cancel = (void *)kallsyms_lookup_name("task_work_cancel"); +- if (kallsyms_task_work_cancel == NULL) { +- _stp_error("Can't resolve task_work_cancel!"); ++ kallsyms_task_work_cancel_fn = (void *)kallsyms_lookup_name(TOSTRING(TASK_WORK_CANCEL_FN)); ++ if (kallsyms_task_work_cancel_fn == NULL) { ++ _stp_error("Can't resolve %s!", TOSTRING(TASK_WORK_CANCEL_FN)); + return -ENOENT; + } + #endif diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec index 0d5b080..eec3686 100644 --- a/SPECS/systemtap.spec +++ b/SPECS/systemtap.spec @@ -1,3 +1,5 @@ +# work around flakey gcc warnings +%{!?with_Werror: %global with_Werror 0} %{!?with_sqlite: %global with_sqlite 0%{?fedora} >= 17 || 0%{?rhel} >= 7} # prefer prebuilt docs %{!?with_docs: %global with_docs 0} @@ -90,7 +92,10 @@ \ g stapusr 156\ g stapsys 157\ -g stapdev 158 +g stapdev 158\ +g stapunpriv 159\ +u stapunpriv 159 "systemtap unprivileged user" /var/lib/stapunpriv /sbin/nologin\ +m stapunpriv stapunpriv %define _systemtap_server_preinstall \ # See systemd-sysusers(8) sysusers.d(5)\ @@ -115,7 +120,7 @@ m stapdev stapdev Name: systemtap # PRERELEASE -Version: 5.0 +Version: 5.1 Release: 4%{?release_override}%{?dist} # for version, see also configure.ac @@ -152,9 +157,10 @@ Summary: Programmable system-wide instrumentation system License: GPL-2.0-or-later URL: http://sourceware.org/systemtap/ Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz - -Patch1: RHEL-16549.patch -Patch2: RHEL-18334.patch +Patch1: RHEL-36199a.patch +Patch2: RHEL-36199b.patch +Patch3: PR31495.patch +Patch4: RHEL-50107.patch # Build* BuildRequires: make @@ -397,7 +403,7 @@ with the optional dtrace-compatibility preprocessor to process related %package testsuite Summary: Instrumentation System Testsuite -License: GPL-2.0-or-later AND GPL-2.0-only AND GPL-3.0-or-later AND MIT +License: GPL-2.0-or-later AND GPL AND GPL-2.0-only AND GPL-3.0-or-later AND MIT URL: http://sourceware.org/systemtap/ Requires: systemtap = %{version}-%{release} Requires: systemtap-sdt-devel = %{version}-%{release} @@ -566,7 +572,6 @@ This package installs the services necessary on a virtual machine for a systemtap-runtime-virthost machine to execute systemtap scripts. %endif -%if %{with_python3} && %{with_monitor} %package jupyter Summary: ISystemtap jupyter kernel and examples License: GPL-2.0-or-later @@ -577,13 +582,15 @@ Requires: systemtap = %{version}-%{release} This package includes files needed to build and run the interactive systemtap Jupyter kernel, either locally or within a container. -%endif + # ------------------------------------------------------------------------ %prep %setup -q %patch -P1 -p1 %patch -P2 -p1 +%patch -P3 -p1 +%patch -P4 -p1 %build @@ -594,6 +601,13 @@ or within a container. %global dyninst_config --without-dyninst %endif +# Enable/disable the dyninst pure-userspace backend +%if %{with_Werror} +%global Werror_config --enable-Werror +%else +%global Werror_config --disable-Werror +%endif + # Enable/disable the sqlite coverage testing support %if %{with_sqlite} %global sqlite_config --enable-sqlite @@ -681,7 +695,7 @@ or within a container. # We don't ship compileworthy python code, just oddball samples %global py_auto_byte_compile 0 -%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" +%configure %{Werror_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" make %{?_smp_mflags} V=1 @@ -839,6 +853,9 @@ echo '%_systemtap_runtime_preinstall' | systemd-sysusers --replace=%{_sysusersdi getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr getent group stapsys >/dev/null || groupadd -f -g 157 -r stapsys getent group stapdev >/dev/null || groupadd -f -g 158 -r stapdev +getent passwd stapunpriv >/dev/null || \ + useradd -c "Systemtap Unprivileged User" -u 159 -g stapunpriv -d %{_localstatedir}/lib/stapunpriv -r -s /sbin/nologin stapunpriv 2>/dev/null || \ + useradd -c "Systemtap Unprivileged User" -g stapunpriv -d %{_localstatedir}/lib/stapunpriv -r -s /sbin/nologin stapunpriv %endif exit 0 @@ -1285,14 +1302,12 @@ exit 0 %{_sbindir}/stap-exporter %endif -%if %{with_python3} && %{with_monitor} %files jupyter %{_bindir}/stap-jupyter-container %{_bindir}/stap-jupyter-install %{_mandir}/man1/stap-jupyter.1* %dir %{_datadir}/systemtap %{_datadir}/systemtap/interactive-notebook -%endif # ------------------------------------------------------------------------ @@ -1303,6 +1318,20 @@ exit 0 # PRERELEASE %changelog +* Mon Sep 9 2024 Martin Cermak - 5.1-4 +- RHEL-50107.patch: Make systemtap compatible with kernel + commit 68cbd415dd4b . Related: RHEL-56962 . + +* Thu May 16 2024 Martin Cermak - 5.1-3 +- RHEL-7318 + +* Tue May 14 2024 William Cohen - 5.1-2 +- RHEL-36199 + +* Fri Apr 26 2024 Frank Ch. Eigler - 5.1-1 +- Upstream release, see wiki page below for detailed notes. + https://sourceware.org/systemtap/wiki/SystemTapReleases + * Wed Dec 6 2023 William Cohen - 5.0-4 - RHEL-18334