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/bz1448099.1.patch b/SOURCES/bz1448099.1.patch deleted file mode 100644 index 79c6f13..0000000 --- a/SOURCES/bz1448099.1.patch +++ /dev/null @@ -1,55 +0,0 @@ -commit 62640f2ed0deef9355970d216136ad4c49afa3d0 -Author: David Smith -Date: Fri Mar 17 09:36:42 2017 -0500 - - PR21255: Fix missing get_task_mm() declaration. - - * buildrun.cxx (compile_pass): Add autoconf test. This - was caused by the following kernel commit: - - commit 6e84f31522f931027bf695752087ece278c10d3f - Author: Ingo Molnar - Date: Wed Feb 8 18:51:29 2017 +0100 - - sched/headers: Prepare for new header dependencies before moving - code to - * runtime/linux/access_process_vm.h: Include and, if it - exists, . - * runtime/linux/autoconf-sched-mm.c: New file. - -diff --git a/buildrun.cxx b/buildrun.cxx -index aaea64c..644eea9 100644 ---- a/buildrun.cxx -+++ b/buildrun.cxx -@@ -402,6 +402,7 @@ compile_pass (systemtap_session& s) - output_autoconf(s, o, "autoconf-netfilter-4_4.c", "STAPCONF_NETFILTER_V44", NULL); - output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); - output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); -+ output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); - - // used by tapset/timestamp_monotonic.stp - output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); -diff --git a/runtime/linux/access_process_vm.h b/runtime/linux/access_process_vm.h -index 22a1220..a46b86f 100644 ---- a/runtime/linux/access_process_vm.h -+++ b/runtime/linux/access_process_vm.h -@@ -3,6 +3,10 @@ - * some distros export it on some architectures. To workaround this inconsistency, - * we copied and pasted it here. Fortunately, everything it calls is exported. - */ -+#include -+#ifdef STAPCONF_SCHED_MM_H -+#include -+#endif - #include - #include - -diff --git a/runtime/linux/autoconf-sched-mm.c b/runtime/linux/autoconf-sched-mm.c -new file mode 100644 -index 0000000..6d3f1c2 ---- /dev/null -+++ b/runtime/linux/autoconf-sched-mm.c -@@ -0,0 +1,3 @@ -+#include -+#include -+ diff --git a/SOURCES/bz1448099.2.patch b/SOURCES/bz1448099.2.patch deleted file mode 100644 index 03f203f..0000000 --- a/SOURCES/bz1448099.2.patch +++ /dev/null @@ -1,37 +0,0 @@ -commit a477a43122609691ce6ef24f71114cfaa9790392 -Author: David Smith -Date: Fri Mar 17 10:44:12 2017 -0500 - - PR21255: Fix missing __set_task_state() definition. - - * runtime/stp_utrace.c: Fix missing __set_task_state() definition. If we - can't find a __set_task_state() definition, define our own. - -diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c -index bb2d663..5924016 100644 ---- a/runtime/stp_utrace.c -+++ b/runtime/stp_utrace.c -@@ -29,6 +29,14 @@ - - #include "stp_helper_lock.h" - -+#if defined(__set_task_state) -+#define __stp_set_task_state(tsk, state_value) \ -+ __set_task_state((tsk), (state_value)) -+#else -+#define __stp_set_task_state(tsk, state_value) \ -+ do { (tsk)->state = (state_value); } while (0) -+#endif -+ - /* - * Per-thread structure private to utrace implementation. - * If task_struct.utrace_flags is nonzero, task_struct.utrace -@@ -1105,7 +1113,7 @@ static bool utrace_do_stop(struct task_struct *target, struct utrace *utrace) - */ - spin_lock_irq(&target->sighand->siglock); - if (likely(task_is_stopped(target))) -- __set_task_state(target, TASK_TRACED); -+ __stp_set_task_state(target, TASK_TRACED); - spin_unlock_irq(&target->sighand->siglock); - } else if (utrace->resume > UTRACE_REPORT) { - utrace->resume = UTRACE_REPORT; diff --git a/SOURCES/bz1448099.3.patch b/SOURCES/bz1448099.3.patch deleted file mode 100644 index acf2f3d..0000000 --- a/SOURCES/bz1448099.3.patch +++ /dev/null @@ -1,42 +0,0 @@ -commit 030e9465eadf7d3b3a278951264dac83b2f4b4f7 -Author: David Smith -Date: Wed Feb 22 10:04:00 2017 -0600 - - Update the vfs.stp tapset for newer kernels. - - * tapset/linux/vfs.stp: Since the __block_write_begin() function can be - inlined on newer kernels, we'll also probe - __block_write_begin_int(). Also, check to see if '$file' is defined - before using it in _vfs.block_write_begin.return. - -diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp -index 4572bd7..32db300 100644 ---- a/tapset/linux/vfs.stp -+++ b/tapset/linux/vfs.stp -@@ -1104,7 +1104,8 @@ probe _vfs.generic_commit_write = kernel.function("generic_commit_write") ? - argstr = sprintf("%p, %p, %d, %d", $file, $page, $from, $to) - } - --probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, -+probe _vfs.block_prepare_write = kernel.function("__block_write_begin_int") !, -+ kernel.function("__block_write_begin") !, - kernel.function("__block_prepare_write") - { - page = $page -@@ -1134,6 +1135,7 @@ probe _vfs.block_prepare_write = kernel.function("__block_write_begin") !, - } - - probe _vfs.block_prepare_write.return = -+ kernel.function("__block_write_begin_int").return !, - kernel.function("__block_write_begin").return !, - kernel.function("__block_prepare_write").return - { -@@ -1188,7 +1190,7 @@ probe _vfs.block_write_begin.return = - name = "_vfs.block_write_begin" - retstr = sprintf("%d", $return) - -- file = @entry($file) -+ file = @choose_defined(@entry($file), "") - pathname = @defined(@entry($file)) ? fullpath_struct_file(task_current(), @entry($file)) : "" - pos = @entry($pos) - len = @entry($len) diff --git a/SOURCES/bz1448099.4.patch b/SOURCES/bz1448099.4.patch deleted file mode 100644 index 158f309..0000000 --- a/SOURCES/bz1448099.4.patch +++ /dev/null @@ -1,43 +0,0 @@ -commit 5ab0c875df5011725f9cd2f0804c00bf9e63d492 -Author: David Smith -Date: Thu Mar 2 15:23:28 2017 -0600 - - Fix s390x compile error in runtime/stack-s390.c. - - * runtime/stack-s390.c (__stp_stack_print): Update code to let it compile - on the 4.10 kernel. Kernel commit d5c352c moved 'thread_info' into - task_struct. - -diff --git a/runtime/stack-s390.c b/runtime/stack-s390.c -index 38eb73f..56043fc 100644 ---- a/runtime/stack-s390.c -+++ b/runtime/stack-s390.c -@@ -11,7 +11,6 @@ static unsigned long - __stp_show_stack (unsigned long sp, unsigned long low, - unsigned long high, int verbose) - { -- - struct stack_frame *sf; - struct pt_regs *regs; - unsigned long ip; -@@ -62,9 +61,18 @@ static void __stp_stack_print (struct pt_regs *regs, - - sp = __stp_show_stack(sp, - S390_lowcore.async_stack - ASYNC_SIZE, -- S390_lowcore.async_stack,verbose); -+ S390_lowcore.async_stack, verbose); - -+#ifdef CONFIG_THREAD_INFO_IN_TASK -+ /* FIXME: Note that this CONFIG_THREAD_INFO_IN_TASK -+ * code is untested, since the s390 uses the dwarf -+ * unwinder so this code doesn't get called. */ -+ __stp_show_stack(sp, ((unsigned long)current->stack), -+ (((unsigned long)current->stack) -+ + THREAD_SIZE), verbose); -+#else - __stp_show_stack(sp, - S390_lowcore.thread_info, -- S390_lowcore.thread_info + THREAD_SIZE,verbose); -+ S390_lowcore.thread_info + THREAD_SIZE, verbose); -+#endif - } diff --git a/SOURCES/bz1448099.5.patch b/SOURCES/bz1448099.5.patch deleted file mode 100644 index 72a57ed..0000000 --- a/SOURCES/bz1448099.5.patch +++ /dev/null @@ -1,72 +0,0 @@ -commit 386b8596d721e93ad618e682ecddb323d2bee446 -Author: David Smith -Date: Thu Mar 2 15:25:17 2017 -0600 - - Fix s390x-specific syscall tests. - - * testsuite/buildok/syscalls-arch-detailed.stp: Made s390x probe tests - optional, since the underlying probes don't exist on the 4.10 kernel. - * testsuite/buildok/nd_syscalls-arch-detailed.stp: Ditto. - -diff --git a/testsuite/buildok/nd_syscalls-arch-detailed.stp b/testsuite/buildok/nd_syscalls-arch-detailed.stp -index 364b13e..b927d15 100755 ---- a/testsuite/buildok/nd_syscalls-arch-detailed.stp -+++ b/testsuite/buildok/nd_syscalls-arch-detailed.stp -@@ -429,22 +429,22 @@ probe nd_syscall.ppc64_newuname.return ? - # - - %( arch == "s390" %? --probe nd_syscall.getresgid16 -+probe nd_syscall.getresgid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) - } --probe nd_syscall.getresgid16.return -+probe nd_syscall.getresgid16.return ? - { - printf("%s, %s\n", name, retstr) - } - --probe nd_syscall.getresuid16 -+probe nd_syscall.getresuid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) - } --probe nd_syscall.getresuid16.return -+probe nd_syscall.getresuid16.return ? - { - printf("%s, %s\n", name, retstr) - } -diff --git a/testsuite/buildok/syscalls-arch-detailed.stp b/testsuite/buildok/syscalls-arch-detailed.stp -index 8d7d21e..914da9e 100755 ---- a/testsuite/buildok/syscalls-arch-detailed.stp -+++ b/testsuite/buildok/syscalls-arch-detailed.stp -@@ -429,22 +429,22 @@ probe syscall.ppc64_newuname.return ? - # - - %( arch == "s390" %? --probe syscall.getresgid16 -+probe syscall.getresgid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", rgid_uaddr, egid_uaddr, sgid_uaddr) - } --probe syscall.getresgid16.return -+probe syscall.getresgid16.return ? - { - printf("%s, %s\n", name, retstr) - } - --probe syscall.getresuid16 -+probe syscall.getresuid16 ? - { - printf("%s, %s\n", name, argstr) - printf("%p, %p, %p\n", ruid_uaddr, euid_uaddr, suid_uaddr) - } --probe syscall.getresuid16.return -+probe syscall.getresuid16.return ? - { - printf("%s, %s\n", name, retstr) - } diff --git a/SOURCES/bz1448099.6.patch b/SOURCES/bz1448099.6.patch deleted file mode 100644 index a781eba..0000000 --- a/SOURCES/bz1448099.6.patch +++ /dev/null @@ -1,48 +0,0 @@ -commit 9f1c7a872e7a13d1ee29b692d0f1f4dd18a07baa -Author: David Smith -Date: Tue May 9 16:20:41 2017 -0500 - - Avoid missing "task_stack()" definition on 4.11 kernels. - - * runtime/compatdefs.h: If exists, include - it. This avoids a missing task_stack() definition. - * buildrun.cxx (compile_pass): Add autoconf test for - . - * runtime/linux/autoconf-sched-task_stack.c: New file. - -diff --git a/buildrun.cxx b/buildrun.cxx -index 21ed3c5..6da308a 100644 ---- a/buildrun.cxx -+++ b/buildrun.cxx -@@ -403,6 +403,7 @@ compile_pass (systemtap_session& s) - output_autoconf(s, o, "autoconf-smpcall-5args.c", "STAPCONF_SMPCALL_5ARGS", NULL); - output_autoconf(s, o, "autoconf-smpcall-4args.c", "STAPCONF_SMPCALL_4ARGS", NULL); - output_autoconf(s, o, "autoconf-sched-mm.c", "STAPCONF_SCHED_MM_H", NULL); -+ output_autoconf(s, o, "autoconf-sched-task_stack.c", "STAPCONF_SCHED_TASK_STACK_H", NULL); - - // used by tapset/timestamp_monotonic.stp - output_exportconf(s, o, "cpu_clock", "STAPCONF_CPU_CLOCK"); -diff --git a/runtime/compatdefs.h b/runtime/compatdefs.h -index ba429b5..f261bfd 100644 ---- a/runtime/compatdefs.h -+++ b/runtime/compatdefs.h -@@ -57,6 +57,10 @@ static inline int _stp_is_compat_task(void) - */ - #include - #include -+#include -+#ifdef STAPCONF_SCHED_TASK_STACK_H -+#include -+#endif - - #if !defined(task_pt_regs) - #if defined(__powerpc__) -diff --git a/runtime/linux/autoconf-sched-task_stack.c b/runtime/linux/autoconf-sched-task_stack.c -new file mode 100644 -index 0000000..cdfcc60 ---- /dev/null -+++ b/runtime/linux/autoconf-sched-task_stack.c -@@ -0,0 +1,3 @@ -+#include -+#include -+ diff --git a/SOURCES/bz1448099.7.1.patch b/SOURCES/bz1448099.7.1.patch deleted file mode 100644 index 96d1db5..0000000 --- a/SOURCES/bz1448099.7.1.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp -index 4b20686..890be69 100644 ---- a/tapset/linux/proc_mem.stp -+++ b/tapset/linux/proc_mem.stp -@@ -155,7 +155,7 @@ function proc_mem_size_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -322,8 +322,8 @@ function proc_mem_txt_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust (s, e) - } - } -@@ -381,8 +381,9 @@ function proc_mem_data_pid:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 diff --git a/SOURCES/bz1448099.7.patch b/SOURCES/bz1448099.7.patch deleted file mode 100644 index c2757a8..0000000 --- a/SOURCES/bz1448099.7.patch +++ /dev/null @@ -1,142 +0,0 @@ -commit c7029a89f5f1ff6d6a7008e8bccb797046f8af50 -Author: David Smith -Date: Tue May 9 16:32:25 2017 -0500 - - Add missing @cast() calls for 4.11 kernels. - - * tapset/linux/task.stp: Add a "signal_struct" cast to - _task_rlimit_cur(). - * tapset/linux/task.stpm: Fix @mm() macro for kernels >= 2.6.34, where the - mm_struct definition has moved to - * tapset/linux/proc_mem.stp (proc_mem_size): Use the @mm() macro to cast - values to a mm_struct. - (proc_mem_txt): Ditto. - (proc_mem_data): Ditto. - * tapset/linux/context.stp (cmdline_args): Ditto. - * tapset/linux/context-envvar.stp (env_var): Ditto. - -diff --git a/tapset/linux/context-envvar.stp b/tapset/linux/context-envvar.stp -index 4d4c648..2ceb6c8 100644 ---- a/tapset/linux/context-envvar.stp -+++ b/tapset/linux/context-envvar.stp -@@ -28,8 +28,8 @@ function env_var:string(name:string) - mm = task_current()->mm; - if (mm) - { -- env_start = mm->env_start; -- env_end = mm->env_end; -+ env_start = @mm(mm)->env_start; -+ env_end = @mm(mm)->env_end; - if (env_start != 0 && env_end != 0) - { - len = env_end - env_start; -diff --git a/tapset/linux/context.stp b/tapset/linux/context.stp -index e563983..8ab81b4 100644 ---- a/tapset/linux/context.stp -+++ b/tapset/linux/context.stp -@@ -559,8 +559,8 @@ function cmdline_args:string(n:long, m:long, delim:string) - if (__mm == 0) - return ""; - -- __arg_start = __mm->arg_start; -- __arg_end = __mm->arg_end; -+ __arg_start = @mm(__mm)->arg_start; -+ __arg_end = @mm(__mm)->arg_end; - if (__arg_start == 0 || __arg_end == 0) - return ""; - -diff --git a/tapset/linux/proc_mem.stp b/tapset/linux/proc_mem.stp -index de6f423..161033d 100644 ---- a/tapset/linux/proc_mem.stp -+++ b/tapset/linux/proc_mem.stp -@@ -124,7 +124,7 @@ function proc_mem_size:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -144,7 +144,7 @@ function proc_mem_size:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) -- return mm->total_vm -+ return @mm(mm)->total_vm - } - return 0 - } -@@ -260,8 +260,8 @@ function proc_mem_txt:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust(s, e) - } - } -@@ -283,8 +283,8 @@ function proc_mem_txt:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- s = mm->start_code -- e = mm->end_code -+ s = @mm(mm)->start_code -+ e = @mm(mm)->end_code - return _stp_mem_txt_adjust (s, e) - } - } -@@ -308,8 +308,9 @@ function proc_mem_data:long () - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 -@@ -330,8 +331,9 @@ function proc_mem_data:long (pid:long) - if (_stp_valid_task(task)) { - mm = task->mm - if (mm != 0) { -- return (@defined(&@mm(0)->data_vm) ? (mm->data_vm + mm->stack_vm) -- : (mm->total_vm - mm->shared_vm)) -+ return (@defined(&@mm(0)->data_vm) -+ ? (@mm(mm)->data_vm + @mm(mm)->stack_vm) -+ : (@mm(mm)->total_vm - @mm(mm)->shared_vm)) - } - } - return 0 -diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp -index 5467e05..f7c852e 100644 ---- a/tapset/linux/task.stp -+++ b/tapset/linux/task.stp -@@ -40,7 +40,7 @@ function task_current:long () { - return -1; - } - sig = @task(task)->signal; -- return sig->rlim[nd_limit]->rlim_cur; -+ return @cast(sig, "signal_struct")->rlim[nd_limit]->rlim_cur; - } - - /* sfunction task_rlimit - The current resource limit of the task -diff --git a/tapset/linux/task.stpm b/tapset/linux/task.stpm -index 7df04e3..f1bfb8e 100644 ---- a/tapset/linux/task.stpm -+++ b/tapset/linux/task.stpm -@@ -3,5 +3,9 @@ - %) - - @define mm(ptr) %( -+ %( kernel_v >= "2.6.34" %? -+ @cast(@ptr, "mm_struct", "kernel") -+ %: - @cast(@ptr, "mm_struct", "kernel") -+ %) - %) diff --git a/SOURCES/bz1448099.8.patch b/SOURCES/bz1448099.8.patch deleted file mode 100644 index 45c8a72..0000000 --- a/SOURCES/bz1448099.8.patch +++ /dev/null @@ -1,65 +0,0 @@ -commit 35ea394c93d3c296c0c809d21bc397b531b7e965 -Author: David Smith -Date: Tue May 9 16:39:11 2017 -0500 - - Add small testsuite fixes for 4.11 kernels. - - * testsuite/buildok/twentyseven.stp: Avoid missing inlined function - arguments by probing 'kernel.function("do_execve").call'. - * testsuite/buildok/thirtyone.stp: On 4.11 kernels, handle the vfs_stat() - function being renamed to vfs_statx(). - * testsuite/systemtap.pass1-4/buildok.exp: Add kfails for - buildok/fortyfour.stp and buildok/map_probe_cond.stp if we don't have - uprobes. - * testsuite/systemtap.pass1-4/buildok-interactive.exp: Ditto. - -diff --git a/testsuite/buildok/thirtyone.stp b/testsuite/buildok/thirtyone.stp -index ccba660..e7e102d 100755 ---- a/testsuite/buildok/thirtyone.stp -+++ b/testsuite/buildok/thirtyone.stp -@@ -1,5 +1,5 @@ - #! stap -wp4 - --probe kprobe.function("vfs_stat") {} -+probe kprobe.function("vfs_stat")!, kprobe.function("vfs_statx") ? {} - probe kprobe.function("do_sys_open") {} - probe kernel.function("filp_close") {} -diff --git a/testsuite/buildok/twentyseven.stp b/testsuite/buildok/twentyseven.stp -index 62900f3..a3cbfde 100755 ---- a/testsuite/buildok/twentyseven.stp -+++ b/testsuite/buildok/twentyseven.stp -@@ -1,6 +1,6 @@ - #! stap -p4 - --probe kernel.function("do_execve") -+probe kernel.function("do_execve").call - { - print(@defined($__argv) ? $__argv[0] : $argv[0]) - } -diff --git a/testsuite/systemtap.pass1-4/buildok-interactive.exp b/testsuite/systemtap.pass1-4/buildok-interactive.exp -index fc4a019..d15640f 100644 ---- a/testsuite/systemtap.pass1-4/buildok-interactive.exp -+++ b/testsuite/systemtap.pass1-4/buildok-interactive.exp -@@ -188,6 +188,9 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { - # without utrace. - if {$rc == 1 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } - -+ buildok/fortyfour.stp - -+ buildok/map_probe_cond.stp - -+ buildok/pretty-uprobes.stp - - buildok/pretty-uprobes.stp - - buildok/ucontext-symbols-embedded.stp - - buildok/ucontext-unwind-embedded.stp { -diff --git a/testsuite/systemtap.pass1-4/buildok.exp b/testsuite/systemtap.pass1-4/buildok.exp -index 3926b7f..79f2217 100644 ---- a/testsuite/systemtap.pass1-4/buildok.exp -+++ b/testsuite/systemtap.pass1-4/buildok.exp -@@ -40,6 +40,8 @@ foreach file [lsort [glob -nocomplain $srcdir/$self/*.stp]] { - # without utrace. - if {$rc != 0 && ![utrace_p]} { setup_kfail UTRACE *-*-*} } - -+ buildok/fortyfour.stp - -+ buildok/map_probe_cond.stp - - buildok/pretty-uprobes.stp - - buildok/ucontext-symbols-embedded.stp - - buildok/ucontext-unwind-embedded.stp { 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 21b4696..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,26 +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: bz1448099.1.patch -Patch22: bz1448099.2.patch -Patch23: bz1448099.3.patch -Patch24: bz1448099.4.patch -Patch25: bz1448099.5.patch -Patch26: bz1448099.6.patch -Patch27: bz1448099.7.patch -Patch28: bz1448099.7.1.patch -Patch29: bz1448099.8.patch +%if %{with_httpd} +BuildRequires: libmicrohttpd-devel +BuildRequires: libuuid-devel +%endif # Install requirements Requires: systemtap-client = %{version}-%{release} @@ -497,22 +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 -%patch23 -p1 -%patch24 -p1 -%patch25 -p1 -%patch26 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 %build @@ -611,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} @@ -1049,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 @@ -1065,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 @@ -1181,12 +1172,18 @@ done # PRERELEASE %changelog -* Thu May 11 2017 David Smith - 3.1-5 -- Fixed bz1448099.7.1.patch +* Mon Jan 29 2018 Frank Ch. Eigler - 3.2-4 +- rhbz1527809 (staprun detach with SIGQUIT) -* Thu May 11 2017 David Smith - 3.1-4 -- Added patches for: -- rhbz1448099 4.11.0-1.el7 fixes +* Tue Nov 28 2017 Frank Ch. Eigler - 3.2-3 +- rhbz1506230 (netif_receive_skb_internal probing) +- rhbz1490862 (f2fs tracepoint header workarounds) + +* 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: