Martin Cermak [Tue, 23 Jun 2015 06:36:46 +0000 (08:36 +0200)]
PR18462: Allow library macro deprecation
Parts of the tapset code can get deprecated using conditionals as
described in the HACKING file. This patch extends this to library
macros, which can now get deprecated too. Patch includes example
macro deprecation and a testcase.
Mark Wielaard [Mon, 22 Jun 2015 14:57:59 +0000 (16:57 +0200)]
runtime/unwind.c: Also sanity check DWARF regno for DW_CFA_restore[_extended].
When processCFI wanted to restore a register state to its initial value it
wasn't checking whether the register was actually interesting (or existing).
DWARF_REG_MAP might return a marker (9999) that we don't know or don't care
about this register. This was checked in all the set_*_rule functions, but
not in the case we reset the rule of the register. Add this check also for
DW_CFA_restore[_extended].
David Smith [Fri, 19 Jun 2015 18:08:23 +0000 (13:08 -0500)]
Fixed PR18562 by updating listing_mode.exp for systems without uprobes.
* testsuite/systemtap.base/listing_mode.exp: For systems without uprobes,
such as ia64 and some s390x kernels, mark probes requiring uprobes as
untested.
Frank Ch. Eigler [Fri, 19 Jun 2015 14:04:33 +0000 (10:04 -0400)]
PR17737 cont'd: switch to out-of-line xsl parameter file
The "generate.toc" parameter is a PITA to pass on the xmlto command
line with --stringparam, because it's whitespace-laden and structured.
So instead we switch to the "xmlto -m FRAGMENT.xml" mechanism.
David Smith [Thu, 18 Jun 2015 17:46:43 +0000 (12:46 -0500)]
Fixed PR17831 by making kprobes_onthefly.exp more robust.
* testsuite/systemtap.onthefly/kprobes_onthefly.exp: Switch from probing
'vfs.read' and 'vfs.read.return' to probing the underlying kernel
function to avoid inlines, which confused the output.
David Smith [Wed, 17 Jun 2015 18:13:09 +0000 (13:13 -0500)]
Fixed PR18554 by upating the list.exp test case.
* testsuite/systemtap.base/list.exp: Look for several inlined kernel
functions instead of just one (since on any particular kernel there
might not be an inlined version of that function).
David Smith [Wed, 17 Jun 2015 16:35:44 +0000 (11:35 -0500)]
Fixed PR18551 by updating the migrate.stp example script.
* testsuite/systemtap.examples/process/migrate.stp: Now prefers using the
'sched_migrate_task' tracepoint since its arguments will always be
available. Updated to use more of the functions from task.stp.
David Smith [Mon, 15 Jun 2015 16:34:08 +0000 (11:34 -0500)]
Fixed PR18538 by updating the scsi tapset.
* tapset/linux/scsi.stp: Fix problems on rawhide by removing source file
names from probe aliases. These don't appear to be needed and they cause
problems if functions get moved around.
David Smith [Fri, 12 Jun 2015 20:38:34 +0000 (15:38 -0500)]
Fixed PR18526 by updating the socket tapset.
* tapset/linux/socket.stp: Add support for socket_write_iter() and
socket_read_iter(), the replacements for socket_aio_write() and
socket_aio_read. Update socket.sendmsg for newer kernels. Update
_get_sock_addr() for newer kernels.
* testsuite/buildok/socket-detailed.stp: Updated and add tests for new
probes.
David Smith [Fri, 12 Jun 2015 14:07:05 +0000 (09:07 -0500)]
Fixed PR18518 by updating the vfs and nfs tapsets.
* tapset/linux/vfs.stp: Fix the vfs.do_sync_read and vfs.do_sync_write
probe aliases on rawhide kernels where the underlying probe points no
longer exist.
* tapset/linux/nfs.stp: Update probes that use vfs.do_sync_read and
vfs.do_sync_write.
Abegail Jakop [Mon, 8 Jun 2015 19:30:12 +0000 (15:30 -0400)]
runtime/linux/namespaces.h: hold rcu_read_lock longer
require the rcu_read_lock in get_*_namespaces(). then the rcu_read_lock
is acquired in from_target_*_ns() before calling get_*_namespace()
and is returned after it's done with the pid namepace. also moved
duplicated code to a helper function, get_task_struct_from pid()
Abegail Jakop [Fri, 29 May 2015 20:08:07 +0000 (16:08 -0400)]
add -N TARGET_NS_PID option to staprun
buildrun.cxx: add -N if there is a target namespaces pid when making
the staprun command
staprun/common.c: parse new -N option that takes a pid. also check
to make sure the given pid is not obviously invalid
staprun/mainloop.c: dbug msg if there is a target namespace pid
session.cxx: check the target ns pid is not an obviously invalid pid
Abegail Jakop [Mon, 1 Jun 2015 15:46:34 +0000 (11:46 -0400)]
move the bulk of [task_]ns_* tapsets to helper fns
runtime/linux/namespaces.h: define helper fns to get specific pid or user
information based on the target namespaces. rely on the new runtime
variable _stp_namespace_pid rather than the _STP_NAMESPACE_PID macro
runtime/transport/transport.c: define runtime var _stp_namespace_pid
that will contain the target namespaces pid. default to _stp_pid
if there was no target ns pid specified
tapset/linux/*.stp: replace body of [task_]ns_* tapset functions with a
call to the helper functions in namespaces.h
translate.cxx: remove _STP_NAMESPACE_PID macro definition
Abegail Jakop [Fri, 29 May 2015 15:20:17 +0000 (11:20 -0400)]
add /* guru */ pragma to task_ns_* tapsets
the task_ns_* functions aren't protected from read faults when trying to
access the task struct at the provided address, so we'll add the /* guru */
pragma to hint at how unsafe those functions are.
Abegail Jakop [Tue, 26 May 2015 18:40:35 +0000 (14:40 -0400)]
moved repetitive pid-to-ns chunks into a function
runtime/linux/namespaces.h: get_pid_namespace() and get_user_namespace()
that take in a (int) pid returning a pointer to the namespace.
translate.cxx: include the namespaces.h file, if --runtime=kernel
tapset/linux/*.stp: replace repetitive pid-to-namespace code with new
get_*_namespace()
Abegail Jakop [Mon, 25 May 2015 18:45:08 +0000 (14:45 -0400)]
context_ns.exp: test for pid ns-aware tapset functions
new test case to check that the ns-aware tapset functions are returning
values that match what is expected. currently only implemented for pid
ns tapset functions.
Abegail Jakop [Fri, 22 May 2015 18:10:03 +0000 (14:10 -0400)]
remove ns comparison in [task_]ns_* tapsets
turns out that the functions used to get the ns-specific values in the
new tapsets will return a sufficient error value (0 or uid/guid overflow
value) if the target task/current is not in the target pid/user namespace
Abegail Jakop [Fri, 22 May 2015 18:02:17 +0000 (14:02 -0400)]
use find_pid_ns instead of find_get_pid in [task_]ns_*
in the new namespace-aware tapset functions, we cant use find_get_pid() to
get the pid struct from a target ns pid because it looks for that pid in the
current task's pid ns, when we want it to look in the root pidns. switched
to find_pid_ns() which allows us to specify a pid ns to look in.
Abegail Jakop [Tue, 19 May 2015 18:30:50 +0000 (14:30 -0400)]
buildok test cases for ns-aware tapsets
testsuite/buildok/context-embedded-ns.stp: check that the pid and user
related ns_* tapsets can build.
testsuite/buildok/task_ns.stp: check that the pid and user related
task_ns_* tapsets can build.
testsuite/systemtap.pass1-4/buildok-dyninst.exp: add test cases to
dyinst run's KFAIL list
Abegail Jakop [Fri, 15 May 2015 15:18:01 +0000 (11:18 -0400)]
new namespace-aware tapset functions: [task_]ns_*
context.stp: new tapset functions ns_[pid|tid|ppid|pgrp|sid] for pid
namespaces. ns_[e][g|u]id functions for user namespaces. the returned
value with be relative to either the --target-namespaces=PID or the stap
process' pid or user namespace.
task.stp: task_ns_* (and others) functions to be the namespace-aware
counterparts to the original task_* functions. the new functions will
return a value relative to the target-namespaces=PID or stap process'
namespaces.
Abegail Jakop [Tue, 19 May 2015 15:54:31 +0000 (11:54 -0400)]
new option: --target-namespaces=PID
added a new option to specify a set of target namespaces based on a pid.
this will be used with upcoming namespace-aware tapsets, which will
rely on that target namespaces in order to provide relevant information.
David Smith [Wed, 10 Jun 2015 17:38:52 +0000 (12:38 -0500)]
Fixed PR18461 by updating the netfilter code for linux 4.1.
* tapset-netfilter.cxx (emit_module_decls): Add support for new linux 4.1
netfilter changes.
* buildrun.cxx (compile_pass): Add new netfilter autoconf test.
* runtime/linux/autoconf-netfilter-4_1.c: New autoconf test.
Martin Cermak [Tue, 9 Jun 2015 07:47:01 +0000 (09:47 +0200)]
PR18492: Add tapset support and test coverage for sched_{get,set}attr
* tapset/linux/aux_syscalls.stp: New function _struct_sched_attr_u()
* tapset/linux/nd_syscalls2.stp: New probes nd_syscall.sched_{g,s}etattr
* tapset/linux/syscalls2.stp: New probes syscall.sched_{g,s}etattr
* testsuite/buildok/aux_syscalls-embedded.stp: New subtest
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto
* testsuite/buildok/syscalls2-detailed.stp: Ditto
* testsuite/systemtap.syscall/sched_attr.c: New testcase
Martin Cermak [Tue, 9 Jun 2015 06:32:41 +0000 (08:32 +0200)]
PR18501: Add tapset support and test coverage for the kcmp syscall
* tapset/linux/aux_syscalls.stp: New function _kcmp_type_str()
* tapset/linux/nd_syscalls.stp: New probe nd_syscall.kcmp
* tapset/linux/syscalls.stp: New probe syscall.kcmp
* testsuite/buildok/aux_syscalls-embedded.stp: New subtest
* testsuite/buildok/nd_syscalls-detailed.stp: Ditto
* testsuite/buildok/syscalls-detailed.stp: Ditto
* testsuite/systemtap.syscall/kcmp.c: New testcase
William Cohen [Fri, 29 May 2015 19:50:22 +0000 (15:50 -0400)]
Use a value for bad syscall that works better on 32-bit ARM
On 32-bit ARM the use of -1 for the syscall number for the bad syscall
in the utrace_syscall_args test will result in a kernel oops on some
kernels and the use other negative numbers will result in illegal
instruction exceptions. Changing the bad syscall to use a large
positive number for the bad syscall to allow this test to work better
on 32-bit arm.
Frank Ch. Eigler [Tue, 26 May 2015 23:01:33 +0000 (19:01 -0400)]
netfilter/ip tapset: add "kernel<foo.h>" for all @cast()'s
It is preferable to generate typing debuginfo for tapsets from headers
if possible, rather than require kernel-debuginfo. This corrects the
buildok/netfilter-glob.stp test case on f21.
This is because ppc64le is not added to arch list in systemtap.exp .
cmd_parse.exp also fails with similar error for arch. Modifying the
code for ppc64le.
Jonathan Lebon [Thu, 14 May 2015 14:29:50 +0000 (10:29 -0400)]
make from_glob a per-component field rather than per-pp
The original need for from_glob in probe_point was to distinguish
"specified" probe points from those that were still generic/globby. E.g.
so that we know to make function suggestions for
process("/usr/bin/ls").function("bad_func") but not yet for
process("/usr/bin/l*").function("bad_func").
The issue however is that there is no distinction between which
component is from a globby one. E.g. if we have
process("/usr/bin/l*").library("libc").function("bad_func"), which
becomes process("/usr/bin/ls").library("libc").function("bad_func"), we
won't know while resolving the library whether from_glob is true because
the process was globby or because the library was globby.
Thus, the 'from_globbiness' is a property of the component, not the
whole probe point. In this commit, we make from_glob instead a member of
probe_point::component. We then add a from_globby_comp() function which
can be used to determine if a specific component was derived from a
globby one.
Martin Cermak [Wed, 13 May 2015 15:06:34 +0000 (17:06 +0200)]
PR18398: Tapset support for {get,set}_thread_area syscalls
* tapset/linux/i386/aux_syscalls.stp: New function _struct_user_desc_u()
* tapset/linux/i386/nd_syscalls.stp: Decode struct user_desc
* tapset/linux/i386/syscalls.stp: Ditto
* tapset/linux/x86_64/aux_syscalls.stp: New function _struct_user_desc_u()
* tapset/linux/x86_64/nd_syscalls.stp: New probes nd_syscall.{get,set}_thread_area
* tapset/linux/x86_64/syscalls.stp: New probes syscall.{get,set}_thread_area
* testsuite/buildok/nd_syscalls-arch-detailed.stp: New subtests
* testsuite/buildok/syscalls-arch-detailed.stp: New subtests
* testsuite/systemtap.syscall/thread_area.c: New testcase
Martin Cermak [Tue, 28 Apr 2015 16:23:24 +0000 (18:23 +0200)]
PR18343: New tapset handling the clock_adjtime syscall
* tapset/linux/nd_syscalls.stp: New nd_syscall.clock_adjtime
* tapset/linux/syscalls.stp: New syscall.clock_adjtime
* testsuite/buildok/nd_syscalls-detailed.stp: Test script level vars
* testsuite/buildok/syscalls-detailed.stp: Likewise
* testsuite/systemtap.syscall/clock.c: Syscall test coverage
Martin Cermak [Tue, 28 Apr 2015 04:45:02 +0000 (06:45 +0200)]
PR18337: Test coverage improvements, tapset extension.
* tapset/linux/aux_syscalls.stp: New auxiliary function _kexec_flags_str()
* tapset/linux/nd_syscalls.stp: Fix types and nesting for kexec_load
* tapset/linux/syscalls.stp: Likewise
* testsuite/buildok/nd_syscalls-detailed.stp: Test the flags_str variable
* testsuite/buildok/syscalls-detailed.stp: Likewise
* testsuite/systemtap.syscall/kexec_load.c: New testcase
* testsuite/systemtap.syscall/set_tid_address.c: New testcase
David Smith [Mon, 27 Apr 2015 18:21:50 +0000 (13:21 -0500)]
Fix PR17986 by updating the unprivileged_probes.exp test case.
* testsuite/systemtap.unprivileged/unprivileged_probes.exp: Run the loop
executable in the background so that all 'process(number)' probes get a
valid pid.
* testsuite/systemtap.unprivileged/foo.c: Deleted unused file.
* testsuite/systemtap.unprivileged/libfoo.c: Ditto.
Mark Wielaard [Fri, 24 Apr 2015 17:59:32 +0000 (19:59 +0200)]
Filter out descriptor/SHN_UNDEF symbols in symbol_table::lookup_symbol.
With newer elfutils (>= 0.158) function descriptor symbols get resolved
to their actual function entry address. With older elfutils we mark such
symbols as descriptor through reject_section (because their address will
match the .opd). Filter these symbols out in symbol_table::lookup_symbol
and symbol_table::lookup_symbol_address. None of the callers want these
SHN_UNDEF/descriptor symbol (addresses).
This solves another instance of Multiple 'sys_ni_syscall' symbols found
warning on ppc64[be] with older elfutils.
Inspired by wcohen's speculate.stp tapset/testcase and cibegttd@irc's
needs, this script prints a statement-execution trace for a given
function, but only for those runs of the function that ended up with a
(configurable) post-return condition. It turns out to be a neat
multipurpose widget, for random-sampled function tracing as well as
failure analysis.