diff --git a/.gitignore b/.gitignore index 24e112d..0afdc3e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/systemtap-3.1.tar.gz +SOURCES/systemtap-3.2.tar.gz diff --git a/.systemtap.metadata b/.systemtap.metadata index be8f989..c68e40b 100644 --- a/.systemtap.metadata +++ b/.systemtap.metadata @@ -1 +1 @@ -2927ee7e780b45e47d770798f80dfd5be62e095d SOURCES/systemtap-3.1.tar.gz +cd4482870015b9429f9945588ea8846d4ace20d1 SOURCES/systemtap-3.2.tar.gz diff --git a/SOURCES/bz1425568.1.patch b/SOURCES/bz1425568.1.patch deleted file mode 100644 index d90332b..0000000 --- a/SOURCES/bz1425568.1.patch +++ /dev/null @@ -1,50 +0,0 @@ -commit d09defa86b31bd665a3a148ed15713aced8ae227 -Author: David Smith -Date: Thu Mar 9 11:11:49 2017 -0600 - - Add PR19021 test case to task_dentry_path.exp. - -diff --git a/testsuite/systemtap.base/task_dentry_path.exp b/testsuite/systemtap.base/task_dentry_path.exp -index 9bb7b9d..00b9e02 100644 ---- a/testsuite/systemtap.base/task_dentry_path.exp -+++ b/testsuite/systemtap.base/task_dentry_path.exp -@@ -3,7 +3,8 @@ - # unmounted synthentic filesystem, it would go into an infinite loop - # (until killed by MAXACTION). - --set test "task_dentry_path" -+set test_base "task_dentry_path" -+set test "${test_base}" - - # Only run on make installcheck - if {! [installtest_p]} { untested "$test"; return } -@@ -18,3 +19,17 @@ expect { - } - catch {close}; catch {wait} - if {$ok == 1} { fail "$test ($ok)" } { pass "$test ($ok)" } -+ -+# Test the fix for PR19021 - the tapset function task_dentry_path() -+# should handle more than just files. -+set test "${test_base}2" -+spawn stap $srcdir/$subdir/$test.stp -c "echo hi | cat > /dev/null" -+set ok 0 -+expect { -+ -timeout 150 -+ -re {^pipe:\[[0-9]+\]\r\n} { incr ok; exp_continue } -+ timeout { fail "$test (timeout)" } -+ eof { } -+} -+catch {close}; catch {wait} -+if {$ok == 1} { pass "$test" } { fail "$test ($ok)" } -diff --git a/testsuite/systemtap.base/task_dentry_path2.stp b/testsuite/systemtap.base/task_dentry_path2.stp -new file mode 100644 -index 0000000..3fc9db4 ---- /dev/null -+++ b/testsuite/systemtap.base/task_dentry_path2.stp -@@ -0,0 +1,6 @@ -+probe kernel.function("pipe_read") { -+ t = task_current() -+ println(task_dentry_path(t, $iocb->ki_filp->f_path->dentry, -+ $iocb->ki_filp->f_path->mnt)) -+ exit() -+} diff --git a/SOURCES/bz1425568.2.patch b/SOURCES/bz1425568.2.patch deleted file mode 100644 index c9893b8..0000000 --- a/SOURCES/bz1425568.2.patch +++ /dev/null @@ -1,175 +0,0 @@ -commit 6b4d1fcbfa2e9706749cd549ea30df2b67716a0f -Author: David Smith -Date: Fri Mar 10 10:15:48 2017 -0600 - - Fix BZ1425568 by updating task_dentry_path() to handle chroot(). - - * tapset/linux/dentry.stp (task_dentry_path): Fix task_dentry_path when - called on a target executable that has run chroot(). - * testsuite/systemtap.base/task_dentry_path.exp: Add test for chroot'ed - executable. - * testsuite/systemtap.base/task_dentry_path3.stp: New test. - -diff --git a/tapset/linux/dentry.stp b/tapset/linux/dentry.stp -index 589260e..0bc4753 100644 ---- a/tapset/linux/dentry.stp -+++ b/tapset/linux/dentry.stp -@@ -190,6 +190,10 @@ function real_mount:long(vfsmnt:long) - * @dentry: direntry pointer. - * @vfsmnt: vfsmnt pointer. - */ -+/* -+ * Note that this function is based on __d_path() in RHEL6-era kernels -+ * and prepend_path() in RHEL7+ kernels. -+ */ - function task_dentry_path:string(task:long,dentry:long,vfsmnt:long) - { - /* -@@ -207,6 +211,7 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long) - */ - dentry = & @cast(dentry, "dentry") - vfsmnt = & @cast(vfsmnt, "vfsmount") -+ - if (@type_member_defined("dentry", d_op->d_dname) - && dentry->d_op && dentry->d_op->d_dname - && (!__dentry_IS_ROOT(dentry) || dentry != vfsmnt->mnt_root)) { -@@ -242,26 +247,34 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long) - root_vfsmnt = @cast(task, "task_struct")->fs->root->mnt - } - -- while (1) { -- # If we've found the right dentry/vfsmnt, we're done. -- if (dentry == root_dentry && vfsmnt == root_vfsmnt) -- break; -+ if (@type_member_defined("mount", mnt_parent)) { -+ mnt = &@cast(real_mount(vfsmnt), "mount") -+ if (mnt == 0) -+ return "" -+ } - -+ # If we've found the right dentry/vfsmnt, we're done. -+ while (dentry != root_dentry || vfsmnt == root_vfsmnt) { - if (dentry == vfsmnt->mnt_root || __dentry_IS_ROOT(dentry)) { -- if (! @type_member_defined("vfsmount", mnt_parent)) { -- mnt = & @cast(real_mount(vfsmnt), "mount") -- if (mnt == 0) -- return "" -+ /* Escaped? */ -+ if (dentry != vfsmnt->mnt_root) { -+ return "" -+ } - -+ /* RHEL7+ kernels */ -+ if (! @type_member_defined("vfsmount", mnt_parent)) { - /* Global root? */ -- if (mnt->mnt_parent == vfsmnt) -- return sprintf("%s%s", -- d_name(mnt->mnt_mountpoint), -- name) -- -- dentry = mnt->mnt_mountpoint -- vfsmnt = & mnt->mnt_parent->mnt -+ if (mnt != mnt->mnt_parent) { -+ dentry = mnt->mnt_mountpoint -+ vfsmnt = & mnt->mnt_parent->mnt -+ mnt = mnt->mnt_parent -+ if (mnt == 0) -+ return "" -+ continue -+ } -+ break - } -+ /* RHEL6-era kernels */ - else { - /* Global root? */ - if (vfsmnt->mnt_parent == vfsmnt) -@@ -271,11 +284,11 @@ function task_dentry_path:string(task:long,dentry:long,vfsmnt:long) - - dentry = vfsmnt->mnt_mountpoint - vfsmnt = vfsmnt->mnt_parent -+ continue - } -- continue; - } -- name = __dentry_prepend(dentry, name); -- dentry = dentry->d_parent; -+ name = __dentry_prepend(dentry, name) -+ dentry = dentry->d_parent - } - - return sprintf("/%s", name); -diff --git a/testsuite/systemtap.base/task_dentry_path.exp b/testsuite/systemtap.base/task_dentry_path.exp -index 00b9e02..3630401 100644 ---- a/testsuite/systemtap.base/task_dentry_path.exp -+++ b/testsuite/systemtap.base/task_dentry_path.exp -@@ -5,6 +5,8 @@ - - set test_base "task_dentry_path" - set test "${test_base}" -+set test_name "$test_base (infinite loop)" -+set am_root [expr 0 == [exec id -u]] - - # Only run on make installcheck - if {! [installtest_p]} { untested "$test"; return } -@@ -14,22 +16,45 @@ set ok 0 - expect { - -timeout 150 - -re {ERROR.*MAXACTION} { incr ok; exp_continue } -- timeout { fail "$test (timeout)" } -+ timeout { fail "$test_name (timeout)" } - eof { } - } - catch {close}; catch {wait} --if {$ok == 1} { fail "$test ($ok)" } { pass "$test ($ok)" } -+if {$ok == 1} { fail "$test_name ($ok)" } { pass "$test_name" } - - # Test the fix for PR19021 - the tapset function task_dentry_path() - # should handle more than just files. - set test "${test_base}2" -+set test_name "$test_base (synthetic files)" - spawn stap $srcdir/$subdir/$test.stp -c "echo hi | cat > /dev/null" - set ok 0 - expect { - -timeout 150 - -re {^pipe:\[[0-9]+\]\r\n} { incr ok; exp_continue } -- timeout { fail "$test (timeout)" } -+ timeout { fail "$test_name (timeout)" } - eof { } - } - catch {close}; catch {wait} --if {$ok == 1} { pass "$test" } { fail "$test ($ok)" } -+if {$ok == 1} { pass "$test_name" } { fail "$test_name ($ok)" } -+ -+# Test the fix for BZ1425568 - systemtap task_dentry_path crashes -+# under chroot. -+set test "${test_base}3" -+set test_name "$test_base (chroot)" -+ -+# We've got to be root to successfully do a 'chroot'. -+if {!$am_root} { -+ untested "$test_name" -+} else { -+ set curdir [pwd] -+ spawn stap $srcdir/$subdir/$test.stp -c "perl -e 'chroot(qw(/tmp))'" -+ set ok 0 -+ expect { -+ -timeout 150 -+ -re "^${curdir}\r\n" { incr ok; exp_continue } -+ timeout { fail "$test_name (timeout)" } -+ eof { } -+ } -+ catch {close}; catch {wait} -+ if {$ok == 1} { pass "$test_name" } { fail "$test_name ($ok)" } -+} -diff --git a/testsuite/systemtap.base/task_dentry_path3.stp b/testsuite/systemtap.base/task_dentry_path3.stp -new file mode 100644 -index 0000000..b04eb6b ---- /dev/null -+++ b/testsuite/systemtap.base/task_dentry_path3.stp -@@ -0,0 +1,6 @@ -+probe kprocess.exit -+{ -+ t = task_current() -+ println(task_dentry_path(t, @cast(t, "task_struct")->fs->pwd->dentry, -+ @cast(t,"task_struct")->fs->pwd->mnt)) -+} diff --git a/SOURCES/bz1428120.patch b/SOURCES/bz1428120.patch deleted file mode 100644 index 080e3a0..0000000 --- a/SOURCES/bz1428120.patch +++ /dev/null @@ -1,26 +0,0 @@ -commit 237f3f9f43ecf4e8233836f16b0288ec6988414f -Author: David Smith -Date: Thu Mar 2 11:14:47 2017 -0600 - - Update lookup_bad_addr() for platforms where user_addr_max() doesn't exist. - - * runtime/linux/addr-map.c (lookup_bad_addr): Handle platforms (like - s390x) where in_task() exists, but user_addr_max() doesn't. - -diff --git a/runtime/linux/addr-map.c b/runtime/linux/addr-map.c -index b1b9bb0..c868604 100644 ---- a/runtime/linux/addr-map.c -+++ b/runtime/linux/addr-map.c -@@ -53,7 +53,11 @@ lookup_bad_addr(const int type, const unsigned long addr, const size_t size) - #else - if (size == 0 || ULONG_MAX - addr < size - 1 - || (in_task() && !access_ok(type, (void *)addr, size)) -- || (!in_task() && ((user_addr_max() - size) < addr))) -+ || (!in_task() -+#if defined(user_addr_max) -+ && ((user_addr_max() - size) < addr) -+#endif -+ )) - return 1; - #endif - diff --git a/SOURCES/bz1430828.patch b/SOURCES/bz1430828.patch deleted file mode 100644 index b809be5..0000000 --- a/SOURCES/bz1430828.patch +++ /dev/null @@ -1,268 +0,0 @@ -commit 4ed3fbc366d168806f94a615f3339b4d2fbd5a75 -Author: David Smith -Date: Wed Mar 22 15:51:56 2017 -0500 - - Fixed BZ1430828 by replacing task_exe_file() with current_exe_file(). - - * tapset/linux/task.stp (current_exe_file): New function. - (task_exe_file): Deprecate and rewrite in terms of - current_exe_file(). This keeps us from potentially accessing task->mm in - an unsafe manner. - * testsuite/buildok/task-embedded.stp: Updated. - * testsuite/systemtap.base/task_paths.exp: Ditto. - * testsuite/systemtap.base/task_paths.stp: Ditto. - * doc/SystemTap_Tapset_Reference/man3/function::task_exe_file.3stap: - Ditto. - * doc/SystemTap_Tapset_Reference/man3/function::current_exe_file.3stap: - New file. - -diff --git a/doc/SystemTap_Tapset_Reference/man3/function::current_exe_file.3stap b/doc/SystemTap_Tapset_Reference/man3/function::current_exe_file.3stap -new file mode 100644 -index 0000000..60ab1fa ---- /dev/null -+++ b/doc/SystemTap_Tapset_Reference/man3/function::current_exe_file.3stap -@@ -0,0 +1,46 @@ -+'\" t -+.\" Title: function::current_exe_file -+.\" Author: -+.\" Generator: DocBook XSL Stylesheets v1.78.1 -+.\" Date: March 2017 -+.\" Manual: Context Functions -+.\" Source: SystemTap Tapset Reference -+.\" Language: English -+.\" -+.TH "FUNCTION::CURRENT_EX" "3stap" "March 2017" "SystemTap Tapset Reference" "Context Functions" -+.\" ----------------------------------------------------------------- -+.\" * Define some portability stuff -+.\" ----------------------------------------------------------------- -+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+.\" http://bugs.debian.org/507673 -+.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+.ie \n(.g .ds Aq \(aq -+.el .ds Aq ' -+.\" ----------------------------------------------------------------- -+.\" * set default formatting -+.\" ----------------------------------------------------------------- -+.\" disable hyphenation -+.nh -+.\" disable justification (adjust text to left margin only) -+.ad l -+.\" ----------------------------------------------------------------- -+.\" * MAIN CONTENT STARTS HERE * -+.\" ----------------------------------------------------------------- -+.SH "NAME" -+function::current_exe_file \- get the file struct pointer for the current task\*(Aqs executable file -+.SH "SYNOPSIS" -+.sp -+.nf -+ current_exe_file:long() -+.fi -+.SH "ARGUMENTS" -+.PP -+None -+.SH "DESCRIPTION" -+.PP -+This function returns the file struct pointer for the -+current task\*(Aqs executable file\&. Note that the file struct pointer -+isn\*(Aqt locked on return\&. The return value of this function can be passed to -+.IR function::fullpath_struct_file (3stap) -+to get the path from the file struct\&. -diff --git a/doc/SystemTap_Tapset_Reference/man3/function::task_exe_file.3stap b/doc/SystemTap_Tapset_Reference/man3/function::task_exe_file.3stap -index bcc648b..55fe5d7 100644 ---- a/doc/SystemTap_Tapset_Reference/man3/function::task_exe_file.3stap -+++ b/doc/SystemTap_Tapset_Reference/man3/function::task_exe_file.3stap -@@ -40,3 +40,8 @@ function::task_exe_file \- get the file struct pointer for a task\*(Aqs executab - .RS 4 - task_struct pointer\&. - .RE -+.SH "DESCRIPTION" -+.PP -+This function returns the file struct pointer for a task\*(Aqs executable file\&. Deprecated in SystemTap 3\&.2 and removed in SystemTap 3\&.3\&. -+.SH SEE ALSO\n -+.IR function::current_exe_file (3stap) -diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp -index 12e2868..5467e05 100644 ---- a/tapset/linux/task.stp -+++ b/tapset/linux/task.stp -@@ -781,39 +781,46 @@ function task_cwd_path:long(task:long) - %} - - /** -- * sfunction task_cwd_path - get the file struct pointer for a task's executable file -+ * sfunction current_exe_file - get the file struct pointer for the current task's executable file - * -- * @task: task_struct pointer. -+ * Description: This function returns the file struct pointer for the -+ * current task's executable file. Note that the file struct pointer -+ * isn't locked on return. The return value of this function can be -+ * passed to fullpath_struct_file() to get the path from the file -+ * struct. - */ --function task_exe_file:long(task:long) -+function current_exe_file:long() - %{ /* pure */ -- struct task_struct *task -- = (struct task_struct *)(unsigned long)STAP_ARG_task; -- struct mm_struct *mm = NULL; - struct file *exe_file = NULL; - -- // Before using the task_struct pointer, make sure it is valid -- // to read. -- (void)kderef_buffer(NULL, task, sizeof(struct task_struct)); -- -- // OK, we now know it is valid to read. But, is it really a -- // task struct? -- if (!_stp_task_struct_valid(task)) { -- STAP_ERROR ("invalid task struct pointer"); -+ if (current == NULL) { -+ STAP_ERROR ("No current task"); - } - -- // We'd like to call get_task_mm()/mmput() here, but they can -- // sleep. So, let's hope incrementing the task's usage (by -- // calling get_task_struct) is enough to keep the mm around. -- get_task_struct(task); -- mm = task->mm; -- if (mm) -- exe_file = stap_find_exe_file(mm); -- put_task_struct(task); -- -- if (exe_file) { -- STAP_RETURN((unsigned long)exe_file); -- fput(exe_file); -+ // Since we're stopped inside current, it isn't going away. So -+ // don't bother incrementing the task's usage count by calling -+ // get_task_struct()/put_task_struct(). We also don't need to -+ // bother to try to lock current->mm. -+ if (current->mm) { -+ exe_file = stap_find_exe_file(current->mm); -+ if (exe_file) { -+ STAP_RETVALUE = (unsigned long)exe_file; -+ fput(exe_file); -+ } - } -- CATCH_DEREF_FAULT(); - %} -+ -+%(systemtap_v <= "3.2" %? -+/** -+ * sfunction task_exe_file - get the file struct pointer for a task's executable file -+ * -+ * @task: task_struct pointer. -+ */ -+function task_exe_file:long(task:long) -+{ -+ if (task == task_current()) { -+ return current_exe_file() -+ } -+ error("Only the exe file for the current task can be returned") -+} -+%) -diff --git a/testsuite/buildok/task-embedded.stp b/testsuite/buildok/task-embedded.stp -index 6b7983f..c3264b5 100755 ---- a/testsuite/buildok/task-embedded.stp -+++ b/testsuite/buildok/task-embedded.stp -@@ -25,7 +25,10 @@ probe begin { - pid2task(0) + - task_fd_lookup(0, 0) + - task_cwd_path(0) + -- task_exe_file(0)) -+%(systemtap_v <= "3.2" %? -+ task_exe_file(0) + -+%) -+ current_exe_file()) - print (task_execname (0)) - print (pid2execname (0)) - } -diff --git a/testsuite/systemtap.base/task_paths.exp b/testsuite/systemtap.base/task_paths.exp -index 0d885ee..a803680 100644 ---- a/testsuite/systemtap.base/task_paths.exp -+++ b/testsuite/systemtap.base/task_paths.exp -@@ -36,7 +36,7 @@ if {$found_cwd == 0 && ![min_kernel_vers_p 2.6.25]} { - setup_kfail NO_CWD *-*-* - } - --if {$found_cwd == 3 && $found_stapio == 2 && $found_error == 4 -+if {$found_cwd == 2 && $found_stapio == 1 && $found_error == 2 - && $found_whoami == 1} { - pass "$test" - } else { -diff --git a/testsuite/systemtap.base/task_paths.stp b/testsuite/systemtap.base/task_paths.stp -index be088a8..dfefa55 100644 ---- a/testsuite/systemtap.base/task_paths.stp -+++ b/testsuite/systemtap.base/task_paths.stp -@@ -12,29 +12,8 @@ probe begin - } - try - { -- file = task_exe_file(task) -- printf("current exe: %s\n", fullpath_struct_file(task, file)) -- } -- catch (msg) { -- printf("ERROR: %s\n", msg) -- } -- -- # Now print the value of cwd/exe for our target pid. Note that at -- # this point, the target exe path will still be stapio - the exec -- # hasn't happened yet. -- try -- { -- task = pid2task(target()) -- path = task_cwd_path(task) -- printf("target cwd: %s\n", fullpath_struct_path(path)) -- } -- catch (msg) { -- printf("ERROR: %s\n", msg) -- } -- try -- { -- file = task_exe_file(task) -- printf("target exe: %s\n", fullpath_struct_file(task, file)) -+ file = current_exe_file() -+ printf("current exe: %s\n", fullpath_struct_file(task_current(), file)) - } - catch (msg) { - printf("ERROR: %s\n", msg) -@@ -51,15 +30,6 @@ probe begin - catch (msg) { - printf("ERROR: %s\n", msg) - } -- try -- { -- file = task_exe_file(task) -- printf("file: %p\n", file) -- printf("%s\n", fullpath_struct_file(task, file)) -- } -- catch (msg) { -- printf("ERROR: %s\n", msg) -- } - - # Now let's try using a task pointer of -1, which should also - # fail. -@@ -72,14 +42,6 @@ probe begin - catch (msg) { - printf("ERROR: %s\n", msg) - } -- try -- { -- file = task_exe_file(task) -- printf("%s\n", fullpath_struct_file(task, file)) -- } -- catch (msg) { -- printf("ERROR: %s\n", msg) -- } - } - - probe syscall.geteuid, syscall.getuid -@@ -99,8 +61,8 @@ probe syscall.geteuid, syscall.getuid - } - try - { -- file = task_exe_file(task) -- printf("current exe: %s\n", fullpath_struct_file(task, file)) -+ file = current_exe_file() -+ printf("current exe: %s\n", fullpath_struct_file(task_current(), file)) - } - catch (msg) { - printf("ERROR: %s\n", msg) diff --git a/SOURCES/bz1431263.1.patch b/SOURCES/bz1431263.1.patch deleted file mode 100644 index 8fc9e60..0000000 --- a/SOURCES/bz1431263.1.patch +++ /dev/null @@ -1,72 +0,0 @@ -commit d0b322eddb2f0f248ced58df8e8448c6e557c81e -Author: David Smith -Date: Tue Mar 21 15:49:11 2017 -0500 - - BZ1431263: Fix hardware breakpoint probe handler return types. - - * tapsets.cxx (hwbkpt_derived_probe_group::emit_module_decls): Fix - hardware breakpoint probe handler return type - changed from 'int' to - 'void' to match the kernel. - (hwbkpt_derived_probe_group::emit_module_init): Ditto. - -diff --git a/tapsets.cxx b/tapsets.cxx -index 54793db..32dfde3 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -10191,12 +10191,12 @@ hwbkpt_derived_probe_group::emit_module_decls (systemtap_session& s) - - // Forward declare the master entry functions - s.op->newline() << "#ifdef STAPCONF_PERF_HANDLER_NMI"; -- s.op->newline() << "static int enter_hwbkpt_probe (struct perf_event *bp,"; -+ s.op->newline() << "static void enter_hwbkpt_probe (struct perf_event *bp,"; - s.op->line() << " int nmi,"; - s.op->line() << " struct perf_sample_data *data,"; - s.op->line() << " struct pt_regs *regs);"; - s.op->newline() << "#else"; -- s.op->newline() << "static int enter_hwbkpt_probe (struct perf_event *bp,"; -+ s.op->newline() << "static void enter_hwbkpt_probe (struct perf_event *bp,"; - s.op->line() << " struct perf_sample_data *data,"; - s.op->line() << " struct pt_regs *regs);"; - s.op->newline() << "#endif"; -@@ -10253,17 +10253,17 @@ hwbkpt_derived_probe_group::emit_module_decls (systemtap_session& s) - // Emit the hwbkpt callback function - s.op->newline() ; - s.op->newline() << "#ifdef STAPCONF_PERF_HANDLER_NMI"; -- s.op->newline() << "static int enter_hwbkpt_probe (struct perf_event *bp,"; -+ s.op->newline() << "static void enter_hwbkpt_probe (struct perf_event *bp,"; - s.op->line() << " int nmi,"; - s.op->line() << " struct perf_sample_data *data,"; - s.op->line() << " struct pt_regs *regs) {"; - s.op->newline() << "#else"; -- s.op->newline() << "static int enter_hwbkpt_probe (struct perf_event *bp,"; -+ s.op->newline() << "static void enter_hwbkpt_probe (struct perf_event *bp,"; - s.op->line() << " struct perf_sample_data *data,"; - s.op->line() << " struct pt_regs *regs) {"; - s.op->newline() << "#endif"; - s.op->newline(1) << "unsigned int i;"; -- s.op->newline() << "if (bp->attr.type != PERF_TYPE_BREAKPOINT) return -1;"; -+ s.op->newline() << "if (bp->attr.type != PERF_TYPE_BREAKPOINT) return;"; - s.op->newline() << "for (i=0; i<" << hwbkpt_probes.size() << "; i++) {"; - s.op->newline(1) << "struct perf_event_attr *hp = & stap_hwbkpt_probe_array[i];"; - // XXX: why not match stap_hwbkpt_ret_array[i] against bp instead? -@@ -10281,7 +10281,7 @@ hwbkpt_derived_probe_group::emit_module_decls (systemtap_session& s) - common_probe_entryfn_epilogue (s, true, otf_safe_context(s)); - s.op->newline(-1) << "}"; - s.op->newline(-1) << "}"; -- s.op->newline() << "return 0;"; -+ s.op->newline() << "return;"; - s.op->newline(-1) << "}"; - } - -@@ -10333,9 +10333,9 @@ hwbkpt_derived_probe_group::emit_module_init (systemtap_session& s) - - s.op->newline() << "probe_point = skp->probe->pp;"; // for error messages - s.op->newline() << "#ifdef STAPCONF_HW_BREAKPOINT_CONTEXT"; -- s.op->newline() << "stap_hwbkpt_ret_array[i] = register_wide_hw_breakpoint(hp, (void *)&enter_hwbkpt_probe, NULL);"; -+ s.op->newline() << "stap_hwbkpt_ret_array[i] = register_wide_hw_breakpoint(hp, &enter_hwbkpt_probe, NULL);"; - s.op->newline() << "#else"; -- s.op->newline() << "stap_hwbkpt_ret_array[i] = register_wide_hw_breakpoint(hp, (void *)&enter_hwbkpt_probe);"; -+ s.op->newline() << "stap_hwbkpt_ret_array[i] = register_wide_hw_breakpoint(hp, &enter_hwbkpt_probe);"; - s.op->newline() << "#endif"; - s.op->newline() << "rc = 0;"; - s.op->newline() << "if (IS_ERR(stap_hwbkpt_ret_array[i])) {"; diff --git a/SOURCES/bz1431263.2.patch b/SOURCES/bz1431263.2.patch deleted file mode 100644 index df18980..0000000 --- a/SOURCES/bz1431263.2.patch +++ /dev/null @@ -1,26 +0,0 @@ -commit 26f262a7b2712a98d12261b12a5729d9d5e7cb0b -Author: David Smith -Date: Thu Mar 23 16:21:37 2017 -0500 - - BZ1431263: Disable kernel.data probes on arm64. - - * tapsets.cxx (hwbkpt_builder::build): On arm64, hardware breakpoint - probes continually get triggered. So, disable them. - -diff --git a/tapsets.cxx b/tapsets.cxx -index 32dfde3..9be2d04 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -10392,6 +10392,12 @@ hwbkpt_builder::build(systemtap_session & sess, - throw SEMANTIC_ERROR (_("CONFIG_HAVE_HW_BREAKPOINT not available on this kernel"), - location->components[0]->tok); - -+ // See BZ1431263 (on aarch64, running the hw_watch_addr.stp -+ // systemtap examples cause a stuck CPU). -+ if (sess.architecture == string("arm64")) -+ throw SEMANTIC_ERROR (_("kernel.data probes are not supported on arm64 kernels"), -+ location->components[0]->tok); -+ - has_addr = get_param (parameters, TOK_HWBKPT, hwbkpt_address); - has_symbol_str = get_param (parameters, TOK_HWBKPT, symbol_str_val); - has_len = get_param (parameters, TOK_LENGTH, len); diff --git a/SOURCES/bz1431263.3.patch b/SOURCES/bz1431263.3.patch deleted file mode 100644 index 90625bf..0000000 --- a/SOURCES/bz1431263.3.patch +++ /dev/null @@ -1,65 +0,0 @@ -commit 5a540e9f35dd91d26ea342d5b53a1f2d52109f72 -Author: David Smith -Date: Mon Mar 27 10:32:50 2017 -0500 - - BZ1431263: Always use HW_BREAKPOINT_LEN_* macros. - - * tapsets.cxx (hwbkpt_derived_probe_group::emit_module_init): Always use - HW_BREAKPOINT_LEN_* macros, not just on x86_64. - -diff --git a/tapsets.cxx b/tapsets.cxx -index 9be2d04..ccd7cbb 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -10305,31 +10305,26 @@ hwbkpt_derived_probe_group::emit_module_init (systemtap_session& s) - s.op->newline(-1) << "}"; - s.op->newline() << "hp->bp_type = skp->atype;"; - -- // On x86 & x86-64, hp->bp_len is not just a number but a macro/enum (!?!). -- if (s.architecture == "i386" || s.architecture == "x86_64" ) -- { -- s.op->newline() << "switch(skp->len) {"; -- s.op->newline() << "case 1:"; -- s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_1;"; -- s.op->newline() << "break;"; -- s.op->newline(-1) << "case 2:"; -- s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_2;"; -- s.op->newline() << "break;"; -- s.op->newline(-1) << "case 3:"; -- s.op->newline() << "case 4:"; -- s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_4;"; -- s.op->newline() << "break;"; -- s.op->newline(-1) << "case 5:"; -- s.op->newline() << "case 6:"; -- s.op->newline() << "case 7:"; -- s.op->newline() << "case 8:"; -- s.op->newline() << "default:"; // XXX: could instead reject -- s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_8;"; -- s.op->newline() << "break;"; -- s.op->newline(-1) << "}"; -- } -- else // other architectures presumed straightforward -- s.op->newline() << "hp->bp_len = skp->len;"; -+ // Convert actual len to bp len. -+ s.op->newline() << "switch(skp->len) {"; -+ s.op->newline() << "case 1:"; -+ s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_1;"; -+ s.op->newline() << "break;"; -+ s.op->newline(-1) << "case 2:"; -+ s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_2;"; -+ s.op->newline() << "break;"; -+ s.op->newline(-1) << "case 3:"; -+ s.op->newline() << "case 4:"; -+ s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_4;"; -+ s.op->newline() << "break;"; -+ s.op->newline(-1) << "case 5:"; -+ s.op->newline() << "case 6:"; -+ s.op->newline() << "case 7:"; -+ s.op->newline() << "case 8:"; -+ s.op->newline() << "default:"; // XXX: could instead reject -+ s.op->newline(1) << "hp->bp_len = HW_BREAKPOINT_LEN_8;"; -+ s.op->newline() << "break;"; -+ s.op->newline(-1) << "}"; - - s.op->newline() << "probe_point = skp->probe->pp;"; // for error messages - s.op->newline() << "#ifdef STAPCONF_HW_BREAKPOINT_CONTEXT"; diff --git a/SOURCES/bz1431263.4.patch b/SOURCES/bz1431263.4.patch deleted file mode 100644 index 504e1e7..0000000 --- a/SOURCES/bz1431263.4.patch +++ /dev/null @@ -1,31 +0,0 @@ -commit 77c4dcf7aa81f59532859783e4775143ebf17a23 -Author: David Smith -Date: Mon Mar 27 11:16:53 2017 -0500 - - BZ1431263: Remove "too many hardware breakpoint probes" warning. - - * tapsets.cxx (hwbkpt_derived_probe_group::enroll): Remove warning about - too many hardware breakpoint probes, since we can't really know how many - this system supports until we try to register them. - -diff --git a/tapsets.cxx b/tapsets.cxx -index ccd7cbb..c80e831 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -10166,16 +10166,6 @@ void hwbkpt_derived_probe::join_group (systemtap_session& s) - void hwbkpt_derived_probe_group::enroll (hwbkpt_derived_probe* p, systemtap_session& s) - { - hwbkpt_probes.push_back (p); -- -- unsigned max_hwbkpt_probes_by_arch = 0; -- if (s.architecture == "i386" || s.architecture == "x86_64") -- max_hwbkpt_probes_by_arch = 4; -- else if (s.architecture == "s390") -- max_hwbkpt_probes_by_arch = 1; -- -- if (hwbkpt_probes.size() >= max_hwbkpt_probes_by_arch) -- s.print_warning (_F("Too many hardware breakpoint probes requested for %s (%zu vs. %u)", -- s.architecture.c_str(), hwbkpt_probes.size(), max_hwbkpt_probes_by_arch)); - } - - void diff --git a/SOURCES/bz1431263.5.patch b/SOURCES/bz1431263.5.patch deleted file mode 100644 index bf02b0f..0000000 --- a/SOURCES/bz1431263.5.patch +++ /dev/null @@ -1,21 +0,0 @@ -commit 5177a6c84d9378d705755844dc5f2b212de49a8c -Author: David Smith -Date: Mon Mar 27 11:36:42 2017 -0500 - - Fix BZ1431263 commit by removing unused arg. - - * tapsets.cxx (enroll): Remove unused systemtap_session argument. - -diff --git a/tapsets.cxx b/tapsets.cxx -index c80e831..2274ae6 100644 ---- a/tapsets.cxx -+++ b/tapsets.cxx -@@ -10163,7 +10163,7 @@ void hwbkpt_derived_probe::join_group (systemtap_session& s) - this->group = s.hwbkpt_derived_probes; - } - --void hwbkpt_derived_probe_group::enroll (hwbkpt_derived_probe* p, systemtap_session& s) -+void hwbkpt_derived_probe_group::enroll (hwbkpt_derived_probe* p, systemtap_session&) - { - hwbkpt_probes.push_back (p); - } diff --git a/SOURCES/bz1433391.patch b/SOURCES/bz1433391.patch deleted file mode 100644 index 0a93018..0000000 --- a/SOURCES/bz1433391.patch +++ /dev/null @@ -1,58 +0,0 @@ -commit 9989c537437c3cfffae61e33bbe4fe60ac1c7eed -Author: David Smith -Date: Tue Mar 28 16:36:30 2017 -0500 - - Workaround parser issue in nfs_proc.stp. - - * tapset/linux/nfs_proc.stp (nfs.proc3.read_done): To avoid parser issues, - split up @choose_defined() code into two separate if statements. Note - that this is a workaround until we can fix the parser issue. - (nfs.proc4.read_done): Ditto. - -diff --git a/tapset/linux/nfs_proc.stp b/tapset/linux/nfs_proc.stp -index 2c0bd8d..140e643 100644 ---- a/tapset/linux/nfs_proc.stp -+++ b/tapset/linux/nfs_proc.stp -@@ -889,10 +889,15 @@ probe nfs.proc3.read_done = kernel.function("nfs3_read_done") !, - module("nfs").function("nfs3_read_done") ?, - module("nfsv3").function("nfs3_read_done") ? - { -- if (@defined($hdr) || @defined($data)) { # kernels >= 2.6.10 -- server_ip = @_nfs_data_server_ip(@choose_defined($hdr, $data)) -- prot = @_nfs_data_prot(@choose_defined($hdr, $data)) -- count = @_nfs_data_res_count(@choose_defined($hdr, $data)) -+ if (@defined($hdr)) { # kernels >= 3.17 -+ server_ip = @_nfs_data_server_ip($hdr) -+ prot = @_nfs_data_prot($hdr) -+ count = @_nfs_data_res_count($hdr) -+ } -+ else if (@defined($data)) { # kernels >= 2.6.10 -+ server_ip = @_nfs_data_server_ip($data) -+ prot = @_nfs_data_prot($data) -+ count = @_nfs_data_res_count($data) - } - else { - server_ip = @_nfs_data_server_ip($task->tk_calldata) -@@ -923,11 +928,17 @@ probe nfs.proc4.read_done = kernel.function("nfs4_read_done") !, - module("nfs").function("nfs4_read_done") ?, - module("nfsv4").function("nfs4_read_done") ? - { -- if (@defined($hdr) || @defined($data)) { # kernels >= 2.6.10 -- server_ip = @_nfs_data_server_ip(@choose_defined($hdr, $data)) -- prot = @_nfs_data_prot(@choose_defined($hdr, $data)) -- count = @_nfs_data_res_count(@choose_defined($hdr, $data)) -- timestamp = @_nfs_data_timestamp(@choose_defined($hdr, $data)) -+ if (@defined($hdr)) { # kernels >= 3.17 -+ server_ip = @_nfs_data_server_ip($hdr) -+ prot = @_nfs_data_prot($hdr) -+ count = @_nfs_data_res_count($hdr) -+ timestamp = @_nfs_data_timestamp($hdr) -+ } -+ else if (@defined($data)) { # kernels >= 2.6.10 -+ server_ip = @_nfs_data_server_ip($data) -+ prot = @_nfs_data_prot($data) -+ count = @_nfs_data_res_count($data) -+ timestamp = @_nfs_data_timestamp($data) - } - else { - server_ip = @_nfs_data_server_ip($task->tk_calldata) diff --git a/SOURCES/bz1436845.patch b/SOURCES/bz1436845.patch deleted file mode 100644 index 2c2f5f2..0000000 --- a/SOURCES/bz1436845.patch +++ /dev/null @@ -1,95 +0,0 @@ -commit 438b5a402b6a93dd426f8c18de6fe3708c265328 -Author: Stan Cox -Date: Tue Mar 28 14:39:14 2017 -0400 - - Adapt stapdyn to the dyninst 9.3.1 library search model. - - stapdyn/dynutil.cxx (check_dyninst_rt): Use DYNINST_REWRITER_PATHS - and appendenv - - util.c, util.h: New: appendenv. - -diff --git a/stapdyn/dynutil.cxx b/stapdyn/dynutil.cxx -index cd2ae11..47a1e91 100644 ---- a/stapdyn/dynutil.cxx -+++ b/stapdyn/dynutil.cxx -@@ -61,17 +61,28 @@ guess_dyninst_rt(void) - return libdyninstAPI_RT; - } - -+ - // Check that environment DYNINSTAPI_RT_LIB exists and is a valid file. - // If not, try to guess a good value and set it. - bool - check_dyninst_rt(void) - { - static const char rt_env_name[] = "DYNINSTAPI_RT_LIB"; -- const char* rt_env = getenv(rt_env_name); -+ static const char dyn_rw_env_name[] = "DYNINST_REWRITER_PATHS"; -+ -+ char* rt_env = getenv(rt_env_name); - if (rt_env) - { - if (file_exists(rt_env)) -- return true; -+ { -+ if (appendenv(dyn_rw_env_name, rt_env) != 0) -+ { -+ int olderrno = errno; -+ staperror() << "Can't set " << dyn_rw_env_name << ": " << strerror(olderrno); -+ return false; -+ } -+ return true; -+ } - staperror() << "Invalid " << rt_env_name << ": \"" << rt_env << "\"" << endl; - } - -@@ -82,7 +93,7 @@ check_dyninst_rt(void) - return false; - } - -- if (setenv(rt_env_name, rt.c_str(), 1) != 0) -+ if (appendenv(dyn_rw_env_name, rt) != 0) - { - int olderrno = errno; - staperror() << "Can't set " << rt_env_name << ": " << strerror(olderrno); -diff --git a/util.cxx b/util.cxx -index a1c8363..9157fb9 100644 ---- a/util.cxx -+++ b/util.cxx -@@ -228,6 +228,23 @@ remove_file_or_dir (const char *name) - return 0; - } - -+ -+int -+appendenv (const char *env_name, const string source) -+{ -+ string dirname = source.substr(0, source.rfind("/")); -+ char *env = getenv(env_name); -+ string new_env; -+ -+ if (env) -+ new_env = string (env) + ":" + dirname; -+ else -+ new_env = dirname; -+ -+ return setenv(env_name, new_env.c_str(), 1); -+} -+ -+ - /* Obtain the gid of the given group. */ - gid_t get_gid (const char *group_name) - { -diff --git a/util.h b/util.h -index d7e0cfb..482f719 100644 ---- a/util.h -+++ b/util.h -@@ -77,6 +77,7 @@ bool copy_file(const std::string& src, const std::string& dest, - int create_dir(const char *dir, int mode = 0777); - int remove_file_or_dir(const char *dir); - extern "C" gid_t get_gid (const char *group_name); -+int appendenv (const char *env_name, const std::string source); - bool in_group_id (gid_t target_gid); - std::string getmemusage (); - void tokenize(const std::string& str, std::vector& tokens, diff --git a/SOURCES/bz1503979.patch b/SOURCES/bz1503979.patch deleted file mode 100644 index 8d52b9a..0000000 --- a/SOURCES/bz1503979.patch +++ /dev/null @@ -1,44 +0,0 @@ -commit c8c24917452665d3ea42019f8700c9164bf3091a -Author: Martin Cermak -Date: Mon Aug 28 13:01:40 2017 +0200 - - PR22005: Fix @min() and @max() extractor functions. - - Commit 26382d613f4d26 introduced a regression in @min() - and @max() extractor functions. Example: - - $ stap -e 'global n probe oneshot {n<<<12 n<<<34 println(@max(n))}' - 12 - $ - - This commit fixes the regression and adds a testcase. - -diff --git a/runtime/stat-common.c b/runtime/stat-common.c -index 764d84c..835fe62 100644 ---- a/runtime/stat-common.c -+++ b/runtime/stat-common.c -@@ -307,9 +307,9 @@ static inline void __stp_stat_add(Hist st, stat_data *sd, int64_t val, - sd->count++; - if(stat_op_sum) - sd->sum += val; -- if (stat_op_min && (val > sd->max)) -+ if (stat_op_max && (val > sd->max)) - sd->max = val; -- if (stat_op_max && (val < sd->min)) -+ if (stat_op_min && (val < sd->min)) - sd->min = val; - /* - * Below, we use Welford's online algorithm for computing variance. -diff --git a/testsuite/systemtap.base/pr22005.exp b/testsuite/systemtap.base/pr22005.exp -new file mode 100644 -index 0000000..c760fdc ---- /dev/null -+++ b/testsuite/systemtap.base/pr22005.exp -@@ -0,0 +1,7 @@ -+set test_name "pr22005" -+ -+set ::result_string "34" -+stap_run2 -e "global l probe oneshot \{l<<<12 l<<<34 println(@max(l))\}" -+ -+set ::result_string "21" -+stap_run2 -e "global l probe oneshot \{l<<<43 l<<<21 println(@min(l))\}" diff --git a/SOURCES/bz1506230.patch b/SOURCES/bz1506230.patch deleted file mode 100644 index 824242a..0000000 --- a/SOURCES/bz1506230.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit 94b3978aa1d01f09b29dbc2d61e1a2bddec313df -Author: Lukas Herbolt -Date: Wed Oct 25 15:47:18 2017 -0500 - - Fix BZ1506230 by fixing netdev.receive probe to work on kernels after v3.14. - -diff --git a/tapset/linux/networking.stp b/tapset/linux/networking.stp -index 76174c7..17cba9c 100644 ---- a/tapset/linux/networking.stp -+++ b/tapset/linux/networking.stp -@@ -59,7 +59,8 @@ function get_netdev_name:string (addr:long) { - /// - // Main device receive routine, be called when packet arrives on network device - probe netdev.receive -- = kernel.function("netif_receive_skb") -+ = kernel.function("netif_receive_skb_internal") !, -+ kernel.function("netif_receive_skb") - { - dev_name = kernel_string($skb->dev->name) - length = $skb->len diff --git a/SOURCES/rhbz1490862.patch b/SOURCES/rhbz1490862.patch new file mode 100644 index 0000000..fe9390a --- /dev/null +++ b/SOURCES/rhbz1490862.patch @@ -0,0 +1,20 @@ +commit b9ede742ef4021380f50f93f33c4013a0fe8d80c +Author: David Smith +Date: Tue Nov 28 15:35:06 2017 -0500 + + rhbz1490862: more kernel f2fs tracepoint header file workarounds + +diff --git a/tapsets.cxx b/tapsets.cxx +index f571b88..e1318ec 100644 +--- a/tapsets.cxx ++++ b/tapsets.cxx +@@ -11270,6 +11270,9 @@ static vector tracepoint_extra_decls (systemtap_session& s, + they_live.push_back ("struct f2fs_sb_info;"); + they_live.push_back ("struct extent_info;"); + they_live.push_back ("struct extent_node;"); ++ they_live.push_back ("struct super_block;"); ++ they_live.push_back ("struct buffer_head;"); ++ they_live.push_back ("struct bio;"); + } + + if (header.find("radeon") != string::npos) diff --git a/SOURCES/rhbz1504009.patch b/SOURCES/rhbz1504009.patch new file mode 100644 index 0000000..7643891 --- /dev/null +++ b/SOURCES/rhbz1504009.patch @@ -0,0 +1,49 @@ +commit 9f81f10b0caf6dfc49c4b7ceb7902f45d37b532a (HEAD -> master, origin/master, origin/HEAD) +Author: Frank Ch. Eigler +Date: Fri Oct 20 10:01:58 2017 -0400 + + rhbz1504009: let dtrace -G -o /dev/null run, as in autoconf + + commit c245153ca193c471a8c broke the ability of dtrace to be tested in + autoconf "-G -o /dev/null" usage, because its output file name was too + simple a function of the input name, and normal users can't write to + /dev/null.dtrace-temp.c . Now we back down to mkstemp, like before, + upon a failure of the simple concatenated name. + +diff --git a/dtrace.in b/dtrace.in +index 2e2e002a5c56..25efc253b708 100644 +--- a/dtrace.in ++++ b/dtrace.in +@@ -410,8 +410,12 @@ from tempfile import mkstemp + else: + print("header: " + fname) + +- fname = filename + ".dtrace-temp.c" +- fdesc = open(fname, mode='w') ++ try: # for reproducible-builds purposes, prefer a fixed path name pattern ++ fname = filename + ".dtrace-temp.c" ++ fdesc = open(fname, mode='w') ++ except: # but that doesn't work for -o /dev/null - see rhbz1504009 ++ (ignore,fname) = mkstemp(suffix=".c") ++ fdesc = open(fname, mode='w') + providers.semaphore_write(fdesc) + fdesc.close() + cc1 = os.environ.get("CC", "gcc") +diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp +index fa6b3ec3f6d3..7c60f09d70b8 100644 +--- a/testsuite/systemtap.base/dtrace.exp ++++ b/testsuite/systemtap.base/dtrace.exp +@@ -83,6 +83,13 @@ if {[file exists /tmp/XXX.o]} then { + } + exec rm -f /tmp/XXX.o + ++verbose -log "$dtrace -G -s $dpath -o /dev/null" ++if [as_non_root "$python $dtrace -G -s $dpath -o /dev/null"] { ++ fail "$test -G -o /dev/null" ++} else { ++ pass "$test -G -o /dev/null" ++} ++ + verbose -log "$dtrace -G -s $dpath -o /tmp/XXX" + catch {exec $python $dtrace -G -s $dpath -o /tmp/XXX} res + if {[file exists /tmp/XXX]} then { diff --git a/SOURCES/rhbz1506230.patch b/SOURCES/rhbz1506230.patch new file mode 100644 index 0000000..824242a --- /dev/null +++ b/SOURCES/rhbz1506230.patch @@ -0,0 +1,20 @@ +commit 94b3978aa1d01f09b29dbc2d61e1a2bddec313df +Author: Lukas Herbolt +Date: Wed Oct 25 15:47:18 2017 -0500 + + Fix BZ1506230 by fixing netdev.receive probe to work on kernels after v3.14. + +diff --git a/tapset/linux/networking.stp b/tapset/linux/networking.stp +index 76174c7..17cba9c 100644 +--- a/tapset/linux/networking.stp ++++ b/tapset/linux/networking.stp +@@ -59,7 +59,8 @@ function get_netdev_name:string (addr:long) { + /// + // Main device receive routine, be called when packet arrives on network device + probe netdev.receive +- = kernel.function("netif_receive_skb") ++ = kernel.function("netif_receive_skb_internal") !, ++ kernel.function("netif_receive_skb") + { + dev_name = kernel_string($skb->dev->name) + length = $skb->len diff --git a/SOURCES/rhbz1527809.patch b/SOURCES/rhbz1527809.patch new file mode 100644 index 0000000..56d5a63 --- /dev/null +++ b/SOURCES/rhbz1527809.patch @@ -0,0 +1,325 @@ +commit b8d11c5e07aa1dcc8e7ec4ffff645d0589579dea +Author: David Smith +Date: Fri Jan 26 09:24:51 2018 -0600 + + BZ1527809 - Fix detaching from modules using SIGQUIT. + + * staprun/mainloop.c: Put a "/* NOTREACHED */" comment after all calls to + cleanup_and_exit() to remind the reader that cleanup_and_exit() doesn't + return. + (stp_main_loop): If we've got a pending interrupt, + but 'load_only' is set, just detach instead of sending STP_EXIT to + the module. Otherwise using SIGQUIT to detach fails and unloads the + module. + * staprun/monitor.c: Put a "/* NOTREACHED */" comment after all calls to + cleanup_and_exit() to remind the reader that cleanup_and_exit() doesn't + return. + * testsuite/systemtap.base/attach_detach.exp: New test. + +diff --git a/staprun/mainloop.c b/staprun/mainloop.c +index a60372e..63b72cc 100644 +--- a/staprun/mainloop.c ++++ b/staprun/mainloop.c +@@ -648,6 +648,7 @@ int stp_main_loop(void) + if (rc != 0) { + perror ("Unable to send STP_READY"); + cleanup_and_exit(0, rc); ++ /* NOTREACHED */ + } + + flags = fcntl(control_channel, F_GETFL); +@@ -695,12 +696,28 @@ int stp_main_loop(void) + + if (pending_interrupts) { + int btype = STP_EXIT; +- int rc = write(control_channel, &btype, sizeof(btype)); ++ int rc; ++ ++ /* If 'load_only' is set, we don't want to send STP_EXIT, ++ * which would cause any 'probe end' processing to be ++ * done. Instead, we'll just detach by calling ++ * cleanup_and_exit(). This should let the module continue to ++ * run. */ ++ if (load_only) ++ { ++ cleanup_and_exit(load_only /* = detach */, 0); ++ /* NOTREACHED */ ++ } ++ ++ rc = write(control_channel, &btype, sizeof(btype)); + dbug(2, "signal-triggered %d exit rc %d\n", pending_interrupts, rc); +- if (monitor || (pending_interrupts > 2)) /* user mashing on ^C multiple times */ +- cleanup_and_exit (load_only /* = detach */, 0); ++ if (monitor || (pending_interrupts > 2)) ++ { /* user mashing on ^C multiple times */ ++ cleanup_and_exit (load_only /* = detach */, 0); ++ /* NOTREACHED */ ++ } + else +- {} /* await STP_EXIT reply message to kill staprun */ ++ {} /* await STP_EXIT reply message to kill staprun */ + } + + /* If the runtime does not implement select() on the command +@@ -719,6 +736,7 @@ int stp_main_loop(void) + if (nb >= 0 || (errno != EINTR && errno != EAGAIN)) { + _perr(_("Unexpected EOF in read (nb=%ld)"), (long)nb); + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } + + if (!select_supported) { +@@ -736,6 +754,7 @@ int stp_main_loop(void) + { + _perr(_("Unexpected error in select")); + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } + } + continue; +@@ -750,6 +769,7 @@ int stp_main_loop(void) + if (write_realtime_data(recvbuf.payload.data, nb)) { + _perr(_("write error (nb=%ld)"), (long)nb); + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } + break; + #endif +@@ -841,8 +861,10 @@ int stp_main_loop(void) + dbug(2, "got STP_EXIT\n"); + if (monitor) + monitor_exited(); +- else ++ else { + cleanup_and_exit(0, error_detected); ++ /* NOTREACHED */ ++ } + /* monitor mode exit handled elsewhere, later. */ + break; + } +@@ -863,6 +885,7 @@ int stp_main_loop(void) + if (target_cmd) + kill(target_pid, SIGKILL); + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } else if (target_cmd) { + dbug(1, "detaching pid %d\n", target_pid); + #if WORKAROUND_BZ467568 +@@ -878,6 +901,7 @@ int stp_main_loop(void) + if (target_cmd) + kill(target_pid, SIGKILL); + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } + #endif + } +@@ -901,20 +925,24 @@ int stp_main_loop(void) + struct _stp_msg_start ts; + struct _stp_msg_ns_pid nspid; + if (use_old_transport) { +- if (init_oldrelayfs() < 0) ++ if (init_oldrelayfs() < 0) { + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ ++ } + } else { + if (init_relayfs() < 0) + cleanup_and_exit(0, 1); ++ /* NOTREACHED */ + } + + if (target_namespaces_pid > 0) { + nspid.target = target_namespaces_pid; + rc = send_request(STP_NAMESPACES_PID, &nspid, sizeof(nspid)); + if (rc != 0) { +- perror ("Unable to send STP_NAMESPACES_PID"); +- cleanup_and_exit (1, rc); +- } ++ perror ("Unable to send STP_NAMESPACES_PID"); ++ cleanup_and_exit (1, rc); ++ /* NOTREACHED */ ++ } + } + + ts.target = target_pid; +@@ -922,9 +950,12 @@ int stp_main_loop(void) + if (rc != 0) { + perror ("Unable to send STP_START"); + cleanup_and_exit(0, rc); ++ /* NOTREACHED */ + } +- if (load_only) ++ if (load_only) { + cleanup_and_exit(1, 0); ++ /* NOTREACHED */ ++ } + break; + } + default: +diff --git a/staprun/monitor.c b/staprun/monitor.c +index 6b8bb11..478634c 100644 +--- a/staprun/monitor.c ++++ b/staprun/monitor.c +@@ -598,7 +598,10 @@ void monitor_input(void) + break; + case 'q': + if (monitor_state == exited) +- cleanup_and_exit(0, 0 /* error_detected unavailable here */ ); ++ { ++ cleanup_and_exit(0, 0 /* error_detected unavailable here */ ); ++ /* NOTREACHED */ ++ } + else + write_command("quit"); + break; +diff --git a/testsuite/systemtap.base/attach_detach.exp b/testsuite/systemtap.base/attach_detach.exp +new file mode 100644 +index 0000000..ef23615 +--- /dev/null ++++ b/testsuite/systemtap.base/attach_detach.exp +@@ -0,0 +1,145 @@ ++set test "attach_detach" ++if {![installtest_p]} { untested $test; return } ++ ++set test_script { " ++ probe begin { printf(\"begin probe fired\\n\") } ++ probe timer.s(5) { printf(\"timer probe fired\\n\") } ++ probe end { printf(\"end probe fired\\n\") } ++" } ++ ++# First, compile a module. ++stap_compile $test 1 $test_script -m attach_detach ++ ++# stap_compile does pass/fail, but doesn't return a status. So, if ++# attach_detach.ko exists, it worked. ++if {! [file exists attach_detach.ko]} { ++ return ++} ++ ++# Load the module and detach. ++set subtest "initial load" ++spawn staprun -L attach_detach.ko ++set fail 0 ++set pass 0 ++expect { ++ -timeout 120 ++ -re "^begin probe fired\r\n" { incr fail; exp_continue } ++ -re "^\r\n" { exp_continue } ++ -re "^Disconnecting from systemtap module.\r\n" { ++ incr pass; exp_continue ++ } ++ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { ++ incr pass ++ } ++ eof { fail "$test ($subtest) - EOF"; incr fail } ++ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } ++} ++catch {close}; catch {wait} ++ ++if {$fail == 0 && $pass == 2} { ++ pass "$test ($subtest) - disconnect seen" ++} else { ++ fail "$test ($subtest) - begin seen ($fail $pass)" ++} ++ ++# Make sure the module is still loaded. ++if {[catch { exec lsmod | grep attach_detach >/dev/null }]} { ++ fail "$test ($subtest) - module still present" ++ return ++} ++pass "$test ($subtest) - module still present" ++ ++# Attach to the module, then use SIGQUIT to detach again. ++set subtest "attach and SIGQUIT" ++spawn staprun -A attach_detach ++set fail 0 ++set pass 0 ++set timer_probe_seen 0 ++expect { ++ -timeout 120 ++ -re "^begin probe fired\r\n" { incr pass; exp_continue } ++ -re "^end probe fired\r\n" { incr fail; exp_continue } ++ -re "^timer probe fired\r\n" { ++ if {!$timer_probe_seen} { ++ set timer_probe_seen 1 ++ incr pass ++ ++ # Send our staprun process a SIGQUIT, to make it detach. ++ kill SIGQUIT [exp_pid] ++ } ++ exp_continue ++ } ++ -re "^\r\n" { exp_continue } ++ -re "^Disconnecting from systemtap module.\r\n" { ++ incr pass; exp_continue ++ } ++ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { ++ incr pass ++ } ++ eof { fail "$test ($subtest) - EOF"; incr fail } ++ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } ++} ++catch {close}; catch {wait} ++ ++if {$fail == 0 && $pass == 4} { ++ pass "$test ($subtest) - disconnect seen" ++} else { ++ fail "$test ($subtest) - no disconnect seen ($fail $pass)" ++} ++ ++# Make sure the module is still loaded. ++if {[catch { exec lsmod | grep attach_detach >/dev/null}]} { ++ fail "$test ($subtest) - module still present" ++ return ++} ++pass "$test ($subtest) - module still present" ++ ++# Attach one last time, then use SIGTERM to unload the module and quit. ++set subtest "attach and SIGTERM" ++spawn staprun -A attach_detach ++set fail 0 ++set pass 0 ++set timer_probe_seen 0 ++expect { ++ -timeout 120 ++ -re "^begin probe fired\r\n" { incr fail; exp_continue } ++ -re "^end probe fired\r\n" { incr pass } ++ -re "^timer probe fired\r\n" { ++ if {!$timer_probe_seen} { ++ set timer_probe_seen 1 ++ incr pass ++ ++ # Send our staprun process a SIGTERM, to make it quit and ++ # unload. ++ kill SIGTERM [exp_pid] ++ } ++ exp_continue ++ } ++ -re "^\r\n" { exp_continue } ++ -re "^Disconnecting from systemtap module.\r\n" { ++ incr fail; exp_continue ++ } ++ -re "^To reconnect, type \"staprun -A attach_detach\"\r\n" { ++ incr fail; exp_continue ++ } ++ eof { fail "$test ($subtest) - EOF"; incr fail } ++ timeout { fail "$test ($subtest) - unexpected timeout"; incr fail } ++} ++catch {close}; catch {wait} ++ ++if {$fail == 0 && $pass == 2} { ++ pass "$test ($subtest) - quit seen" ++} else { ++ fail "$test ($subtest) - no quit seen ($fail $pass)" ++} ++ ++# Make sure the module isn't still loaded. ++if {[catch { exec lsmod | grep attach_detach >/dev/null}]} { ++ pass "$test ($subtest) - module is gone" ++} else { ++ fail "$test ($subtest) - module is gone" ++ ++ # If for some odd reason the module is still loaded, try to unload ++ # it. ++ catch { exec staprun -d attach_detach } ++} diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec index 0890356..e350aa2 100644 --- a/SPECS/systemtap.spec +++ b/SPECS/systemtap.spec @@ -1,4 +1,4 @@ -%{!?with_sqlite: %global with_sqlite 1} +%{!?with_sqlite: %global with_sqlite 0%{?fedora} >= 17 || 0%{?rhel} >= 7} %{!?with_docs: %global with_docs 1} %{!?with_htmldocs: %global with_htmldocs 0} %{!?with_monitor: %global with_monitor 1} @@ -18,6 +18,12 @@ %else %{!?with_dyninst: %global with_dyninst 0} %endif +%ifarch aarch64 +# aarch64 rhel7 kernel is new enough to have linux/bpf.h +%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 7} +%else +%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8} +%endif %{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7} %{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7} %{!?with_java: %global with_java 0%{?fedora} >= 19 || 0%{?rhel} >= 7} @@ -35,6 +41,7 @@ %{!?with_python3: %global with_python3 0%{?fedora} >= 23} %{!?with_python2_probes: %global with_python2_probes 1} %{!?with_python3_probes: %global with_python3_probes 0%{?fedora} >= 23} +%{!?with_httpd: %global with_httpd 0} %ifarch ppc64le aarch64 %global with_virthost 0 @@ -71,10 +78,14 @@ %endif Name: systemtap -Version: 3.1 -Release: 5%{?dist} +Version: 3.2 +Release: 4%{?dist} # for version, see also configure.ac +Patch10: rhbz1504009.patch +Patch11: rhbz1506230.patch +Patch12: rhbz1490862.patch +Patch13: rhbz1527809.patch # Packaging abstract: # @@ -120,7 +131,7 @@ BuildRequires: dyninst-devel >= 8.0 BuildRequires: pkgconfig(libselinux) %endif %if %{with_sqlite} -BuildRequires: sqlite-devel +BuildRequires: sqlite-devel > 3.7 %endif %if %{with_monitor} BuildRequires: pkgconfig(json-c) @@ -186,19 +197,10 @@ BuildRequires: python3-devel BuildRequires: python3-setuptools %endif -Patch10: bz1428120.patch -Patch11: bz1425568.1.patch -Patch12: bz1425568.2.patch -Patch13: bz1431263.1.patch -Patch14: bz1431263.2.patch -Patch15: bz1431263.3.patch -Patch16: bz1431263.4.patch -Patch17: bz1431263.5.patch -Patch18: bz1430828.patch -Patch19: bz1433391.patch -Patch20: bz1436845.patch -Patch21: bz1503979.patch -Patch22: bz1506230.patch +%if %{with_httpd} +BuildRequires: libmicrohttpd-devel +BuildRequires: libuuid-devel +%endif # Install requirements Requires: systemtap-client = %{version}-%{release} @@ -490,15 +492,6 @@ cd .. %patch11 -p1 %patch12 -p1 %patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 -%patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 -%patch21 -p1 -%patch22 -p1 %build @@ -597,10 +590,16 @@ cd .. %global dracut_config %{nil} %endif +%if %{with_httpd} +%global httpd_config --enable-httpd +%else +%global httpd_config --disable-httpd +%endif + # We don't ship compileworthy python code, just oddball samples %global py_auto_byte_compile 0 -%configure %{?elfutils_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" +%configure %{?elfutils_config} %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" make %{?_smp_mflags} %if %{with_emacsvim} @@ -1035,6 +1034,9 @@ done %if %{with_dyninst} %{_bindir}/stapdyn %endif +%if %{with_bpf} +%{_bindir}/stapbpf +%endif %dir %{_libexecdir}/systemtap %{_libexecdir}/systemtap/stapio %{_libexecdir}/systemtap/stap-authorize-cert @@ -1051,6 +1053,9 @@ done %if %{with_dyninst} %{_mandir}/man8/stapdyn.8* %endif +%if %{with_bpf} +%{_mandir}/man8/stapbpf.8* +%endif %doc README README.security AUTHORS NEWS %{!?_licensedir:%global license %%doc} %license COPYING @@ -1167,11 +1172,18 @@ done # PRERELEASE %changelog -* Sun Dec 03 2017 Frank Ch. Eigler - 3.1-5 -- rhbz1519860 netdev probe +* Mon Jan 29 2018 Frank Ch. Eigler - 3.2-4 +- rhbz1527809 (staprun detach with SIGQUIT) + +* Tue Nov 28 2017 Frank Ch. Eigler - 3.2-3 +- rhbz1506230 (netif_receive_skb_internal probing) +- rhbz1490862 (f2fs tracepoint header workarounds) -* Thu Oct 19 2017 Frank Ch. Eigler - 3.1-4 -- rhbz1503979 @min/@max miscalculation +* Fri Oct 20 2017 Frank Ch. Eigler - 3.2-2 +- rhbz1504009 (dtrace -G -o /dev/null) + +* Wed Oct 18 2017 Frank Ch. Eigler - 3.2-1 +- Upstream release. * Thu Mar 30 2017 David Smith - 3.1-3 - Added patches for: