Mark Wielaard [Thu, 27 Jun 2013 09:48:15 +0000 (05:48 -0400)]
When configuring --with-elfutils use elfutils configure --enable-dwz.
Just add the configure option unconditionally. It will be ignored
with older elfutils releases with an harmless warning.
configure: WARNING: unrecognized options: --enable-dwz
David Smith [Tue, 25 Jun 2013 18:43:58 +0000 (13:43 -0500)]
Add a new test for probing 'kprobe.module("foo").function("bar") (PR15675).
* testsuite/systemtap.base/kprobe_module.stp: Add new test for
'kprobe.module("foo").function("bar")'.
* testsuite/systemtap.base/kmodule.exp: Run new kprobe_module.stp test.
David Smith [Tue, 25 Jun 2013 17:38:40 +0000 (12:38 -0500)]
Fixed PR10395 by making the kmodule.exp testcase use a custom module.
* testsuite/systemtap.base/kmodule.exp: Instead of depending on the 'ext3'
module (which is no longer a module on newer kernels), build and install
our own test module, run the test, then remove the module.
* testsuite/systemtap.base/kprobe_module.stp: Changed to probe the new
test module.
* testsuite/systemtap.base/stap_kmodule.Makefile: New file.
* testsuite/systemtap.base/stap_kmodule.c: Ditto.
Josh Stone [Mon, 24 Jun 2013 23:20:03 +0000 (16:20 -0700)]
PR15673: Enable deref.exp for stapdyn, and fix writes
* runtime/dyninst/copy.c (__copy_to_user): Fix the to/from pwrite args.
* runtime/loc2c-runtime.h (CATCH_DEREF_FAULT): Move here for all to use.
* testsuite/systemtap.base/deref.exp: Enable test for all runtimes.
* testsuite/systemtap.base/deref.stp: Use a known function pointer
value, not the kernel-centric "current".
Stats that were supposed to be collected per FUTEX_WAIT call site were
being collected per mutex init stack. So, in the "aggregate stats" section
of the report, you'd see a bunch of stacks with pthread_mutex_init at the
top, which was very confusing because a futex isn't contended when it's
created.
Josh Stone [Mon, 24 Jun 2013 18:02:57 +0000 (11:02 -0700)]
Ensure there's a session for setup_dwfl_kernel
It was tripping on the assert added in commit 044a265a, when running in
any mode that didn't previously set current_session_for_find_debuginfo.
e.g. stap -e 'probe begin { exit() }' -p3 -d /usr/bin/ls
David Smith [Mon, 24 Jun 2013 16:07:56 +0000 (11:07 -0500)]
Fixed PR13977 by updating the rlimit.exp testcase.
* testsuite/systemtap.base/rlimit.exp: Added 2 fixes. Add
'--disable-cache' to the 'CPU small' subtest. Remove the 'STACK small'
subtest since some kernels ignore the small stack limit.
Josh Stone [Thu, 20 Jun 2013 01:23:24 +0000 (18:23 -0700)]
PR15656: Check allow_execmod for stapdyn attach
We already check for deny_ptrace and allow_execstack before stapdyn can
proceed, but it turns out that allow_execmod is also important for
Dyninst to attach to processes (e.g. stapdyn -x PID).
* stapdyn/dynutil.cxx (check_dyninst_sebools): If we're going to be
attaching to a process, check allow_execmod too.
* stapdyn/stapdyn.cxx (main): Indicate whether we're attaching.
Torsten Polle [Wed, 19 Jun 2013 21:05:48 +0000 (16:05 -0500)]
Avoid uprobes crash on error.
* runtime/linux/uprobes/uprobes.c (uprobe_free_process): Make sure the
uprobe_proceess' hlist field is initialized before trying to deleted it,
to avoid a NULL pointer dereference.
* runtime/linux/uprobes2/uprobes.c (uprobe_free_process): Ditto.
Jonathan Lebon [Wed, 19 Jun 2013 20:09:23 +0000 (16:09 -0400)]
uprobes_filtering.exp: add dependency on inode-uprobes
Added a check for the presence of inode-based uprobes, otherwise this
test is irrelevant. Also changed behaviour to conform to other tests
by declaring as untested when installtest_p() is false, rather than
only returning.
Also removed an outdated comment about ignorestderr.
Jonathan Lebon [Wed, 19 Jun 2013 14:12:48 +0000 (10:12 -0400)]
testsuite/systemtap.base: add new testcase uprobes_filtering.exp
This new testcase uses the newly implemented define UPROBES_HITCOUNT
(see previous commit) to verify that uprobes filtering work as it
should.
If prefiltering is supported by the kernel (from 3.9), then it verifies
that UPROBE_HANDLER_REMOVE is obeyed and that the prehandler() is not
called over and over for unwanted processes, allowing the stap script
to run at full speed.
In both cases (whether or not prefiltering is supported), it also
verifies that the probe handlers are called only for the processes of
interest and no other (i.e. it makes sure that the filtering in
stapiu_probe_prehandler() works).
Jonathan Lebon [Fri, 14 Jun 2013 19:06:46 +0000 (15:06 -0400)]
uprobes-inode.c: add UPROBES_HITCOUNT
Added a new directive 'UPROBES_HITCOUNT' which causes stapiu to keep
track of the number of times stapiu_probe_prehandler() and
stapiu_probe_handler() are called. Upon exiting, stapiu_exit() prints
these numbers.
These are important statistics which allow us to verify that uprobe
filtering is working as it should.
David Smith [Tue, 18 Jun 2013 19:18:47 +0000 (14:18 -0500)]
Fix tcl and logic errors in rlimit.exp.
* testsuite/systemtap.base/rlimit.exp: To make sure "sudo stap" works
correctly, use the full path.
* testsuite/lib/systemtap.exp (as_non_root): If we're running as root, use
user "nobody" to run commands.
Lukas Berk [Tue, 18 Jun 2013 16:20:34 +0000 (12:20 -0400)]
Revert use of -javaagent
There are two methods of invoking and running byteman operations on
java processes, modifying the java arguments to make use of -javaagent,
or utilizing byteman to use the VMAttach runtime libraries. While
use of -javaagent may work in simple use cases, for our needs using
byteman operations should always be the preferred option. This commit
also removes duplicate argument specifications (-Dorg.jboss-listener-port)
*java/stapbm.in - remove use of -javaagent and revert to byteman operations
Lukas Berk [Fri, 14 Jun 2013 19:46:06 +0000 (15:46 -0400)]
Place HelperSDT in its own package, use -javaagent for byteman invocation
In order to use stapbm with jboss-as, we need to package our HelperSDT class
along with this we need to use -javaagent to invoke the byteman commands (simply
a syntax change, actual functionality from our persepctive remains the same)
Due to the package name (org.systemtap.byteman.helper) we need to change the
directory HelperSDT.java is located in and autoreconf the makefile changes
*java/HelperSDT.c: change class name to include full package name
*java/HelperSDT.h: likewise
*java/Makefile.am: change location of HelperSDT.java to match package name
*java/Makefile.in: likewise
*java/HelperSDT.java: move to org/systemtap/byteman/helper to match package name
*java/stapbm.in: alter helper name to include package and invoke byteman operations
using the -javaagent syntax
*Makefile.in: Regnerate with autoconf 2.69
*aclocal.m4: likewise
*config.in: likewise
*configure: likewise
*doc/Makefile.in: likewise
*doc/SystemTap_Tapset_Reference/Makefile.in: likewise
*doc/beginners/Makefile.in: likewise
*man/Makefile.in: likewise
*re2c-migrate/Makefile.in: likewise
*stapdyn/Makefile.in: likewise
*staprun/Makefile.in: likewise
*testsuite/Makefile.in: likewise
*testsuite/aclocal.m4: likewise
*testsuite/configure: likewise
Josh Stone [Thu, 13 Jun 2013 22:21:42 +0000 (15:21 -0700)]
PR15619: Check prior stapdyn signals while waiting to exit
* stapdyn/mutator.cxx (mutator::run): When running without mutatees
(which is really only done by the testsuite), use a proper signal mask
and check for signals that may have already arrived.
Josh Stone [Thu, 13 Jun 2013 22:14:05 +0000 (15:14 -0700)]
PR15624: Use 64-bit offsets in stapdyn modules
This is important for our memory deref functions, which could very well
try to pread/pwrite an "offset" which is greater than INT32_MAX. Such
signed overflow results in EINVAL from the kernel.
* runtime/dyninst/runtime_defines.h: #define _FILE_OFFSET_BITS 64.
* runtime/dyninst/copy.c (__copy_from_user, __copy_to_user): Cast
void* to off_t through uintptr_t for size and sign correctness.
* testsuite/systemtap.printf/pretty-bits.exp: Don't use kernel<header>
for userspace, although this requires a trick to deal with tcl exec.
* testsuite/systemtap.printf/pretty-char.exp: Ditto.
Jonathan Lebon [Thu, 13 Jun 2013 15:02:29 +0000 (11:02 -0400)]
(nd_)syscall.exp: adapt tests and fix umask test failure
The recent changes in the *syscall tapsets were causing failures in a
few of the C files tested as part of nd_syscall.exp and syscall.exp.
These files had their expected output changed to match what is now
output.
Also, umask.c had been failing from before only because a '0' is
printed, not '00' as expected.
Jonathan Lebon [Thu, 13 Jun 2013 14:20:45 +0000 (10:20 -0400)]
fix clamp_t arguments in user_string_n_quoted()
The 'len' parameter passed to _stp_text_str() was incorrectly set to
1 higher than need be. The function _stp_text_str() does not count the
trailing NULL. In contrast, the function _stp_strncpy_from_user() does,
which is also used in this tapset, in which case 'len' should indeed be
incremented (see e.g. user_string_n()). This may have been the source
of the confusion.
Jonathan Lebon [Thu, 13 Jun 2013 13:07:54 +0000 (09:07 -0400)]
Use user_string_n_quoted() instead of text_strn() to truncate
Using text_strn() outside of user_string_quoted() resulted in having
two sets of surrounding quotes added. This did not occur before commit 2f65948, in which all user_string() calls were changed to
user_string_quoted(). So instead of using text_strn(), we can directly
use user_string_n_quoted(), which takes care of both quoting and
truncating in one place.
Jonathan Lebon [Tue, 11 Jun 2013 18:47:34 +0000 (14:47 -0400)]
PR15044: update testsuite to conform to uconversions.stp
Due to user_string_quoted() now returning strings surrounded by quotes,
the test scripts utrace_syscall_args.stp and memory1.stp were updated.
Also, the try/catch block around user_string_n() in conversions.stp
were removed so that it counts instead as one more ERROR. Changed the
number of expected errors/warnings from 20 to 22 to account for the
error we now get from user_string_n() as well as from user_string(),
which now throws an error (see previous commit).
Updated all the other conversions_*.stp scripts so that they include
the two new functions. Also, they all had a duplicate probe for
user_string_n(), which messed up the count.
Jonathan Lebon [Tue, 11 Jun 2013 16:07:35 +0000 (12:07 -0400)]
uconversions.stp: make use of similar funcs to promote code re-use
Multiple functions were changes so that they now just call a more
generic function. The functions changed are: user_string(),
user_string2(), user_string2_warn(), and user_string_quoted().
Jonathan Lebon [Mon, 10 Jun 2013 20:05:03 +0000 (16:05 -0400)]
PR15044: make probe aliases use user_string_quoted()
Many probe aliases previously used user_string(). Now, they all use
user_string_quoted(), which never raises an error. Thus, the function
user_string() has been modified to throw an error if an address can't
be read.
By contrast, user_string_quoted() (and also user_string_n_quoted()) now
return the pointer itself as a string in case of failure, whereas
successfully retrieved strings are surrounded by double-quotes.
Josh Stone [Wed, 12 Jun 2013 00:26:07 +0000 (17:26 -0700)]
PR14573: Add stapdyn register support for powerpc
* runtime/dyninst/regs.c (_stp_print_regs): Add a ppc version.
* runtime/dyninst/uprobes.c (stapdu_dummy_uregs): Just use {} to
initialize, because {0} doesn't work for ->gpr[].
* runtime/dyninst/uprobes-regs.c (enter_dyninst_uprobe_regs): Ditto on
initializing pt_regs, and add a loop to fill ppc dwarf registers.
* stapdyn/mutatee.cxx (get_dwarf_registers): Add ppc registers, but note
that only 6 can be passed thanks to a Dyninst argument limitation.
Josh Stone [Tue, 11 Jun 2013 22:03:43 +0000 (15:03 -0700)]
PR15029: Reflect script errors in stapdyn's exit status
This adds a new stapdyn.h function to query the script/module's exit
status. One wishes session_exit had returned this in the first place...
Tests beginenderror.exp and trycatch.exp were failing on dyninst, and
are now working with this fix.
* runtime/dyninst/stapdyn.h: Declare stp_dyninst_exit_status();
* runtime/dyninst/runtime.h: Implement it from a static global.
* runtime/dyninst/transport.c: Set that global on "ERROR:" messages,
like stapio does with its error_detected flag.
* stapdyn/mutator.cxx (mutator::exit_status): New, looks for the new
function in the module to get status.
* stapdyn/stapdyn.cxx (main): Call mutator::exit_status().
Josh Stone [Tue, 11 Jun 2013 01:50:06 +0000 (18:50 -0700)]
stapdyn: Let the module request to exit
This adds a transport message STP_DYN_REQUEST_EXIT, on which the module
within stapdyn will signal stapdyn that we want to exit. This also lets
stapdyn without any -c cmd work better, as it can wait around for the
exit signal.
Josh Stone [Wed, 5 Jun 2013 19:52:39 +0000 (12:52 -0700)]
PR14665: improve stapdyn's signal handling
This changes stapdyn's signal handling to be a bit more like staprun's.
The signals considered now are SIGHUP, SIGINT, SIGTERM, and SIGQUIT,
with the latter being a more immediate exit. The others will wait
around for any created process to finish, but this is debatable.
The heuristic of counting signals is gone, as it just didn't work very
well. Instead this just tracks a mask of signals we've seen. We also
don't try to kill the target process anymore, since staprun doesn't do
that either. If a user hits CTRL-C on the command line, that will go
to the whole process group which includes the target.
Josh Stone [Mon, 10 Jun 2013 22:59:52 +0000 (15:59 -0700)]
PR15587: fix inline statement line numbers
* tapsets.cxx (query_srcfile_line): As with full function statements,
use the destination lineno for inline statment probes, rather than the
q->line from the user (which is 0 for wildcards).
* list.exp: Test probe listing for statements in an inline function.
Josh Stone [Mon, 10 Jun 2013 21:13:23 +0000 (14:13 -0700)]
PR15278: Make use of UPROBE_HANDLER_REMOVE
When a uprobe handler is called in a process we didn't want (thanks to
shared inodes), we already skip it if it's not in our process list. Now
we also return UPROBE_HANDLER_REMOVE to let uprobes know the probe can
be removed from this particular process, so only participating processes
will incur breakpoint overhead. We do have to be careful that task
finder's process coverage is complete though, so we don't remove probes
from a process that just wasn't tracked yet.
* runtime/linux/task_finder2.c (stap_task_finder_complete): New test to
see if task_finder has hooked all processes yet; set after post_init.
* runtime/linux/uprobes-inode.c (stapiu_probe_prehandler): In processes
which we're about to skip, use UPROBE_HANDLER_REMOVE if task finder
says it has complete coverage.
Jonathan Lebon [Mon, 10 Jun 2013 13:40:12 +0000 (09:40 -0400)]
PR15044: modified and added tests in conversions.stp test script
Added a test for user_string2_warn() and user_string2_n_warn().
Modified Expect script to allow for 2 more errors and warnings, which
correspond to the two functions added. Also modified user_string_n()
test to use try/catch blocks.
Jonathan Lebon [Mon, 10 Jun 2013 15:49:29 +0000 (11:49 -0400)]
PR15044: keep cute return val and conditional check for last_error only
In order to avoid the kernel panic which occurred due to a null pointer
(see previous commit), all patches in PR15044 were rechecked so that
the return value is always valid (by keeping its cute message) and the
conditional version check is done solely for assigning to last_error.
Jonathan Lebon [Fri, 7 Jun 2013 20:19:23 +0000 (16:19 -0400)]
PR15044: ucontext.stp: fix name == NULL bug on error
The 'name' variable was not assigned a value if _stp_umod_lookup()
failed. This means the call to strlcpy() happened even though 'name'
was NULL. Now, name is always assigned a value, even if
_stp_umod_lookup() fails.
Jonathan Lebon [Thu, 6 Jun 2013 18:35:28 +0000 (14:35 -0400)]
PR15044: added error-checking in string.stp
Since commit 14138e5 changed the return value of _stp_text_str() from
void to int, other functions that use it, such as text_str() and
text_strn(), can make use of the return value to set their own return
strings to an empty string.
Jonathan Lebon [Thu, 6 Jun 2013 16:03:54 +0000 (12:03 -0400)]
PR15044: reversed patches in functions too popular in probe aliases
The following functions had their cutesy errors restored:
- tapset/linux/ip.stp: format_ipaddr()
- tapset/errno.stp: returnstr()
- tapset/uconversions.stp: user_string()
These functions are used by many probe aliases, especially in the
*syscall* tapsets and for format_ipaddr(), in the network-related
tapsets, such as rpc.stp, tcp.stp, and netfilter.stp. Thus, it is not
ideal to throw an error in case of failure. See the discussion in the
associated bug report for more information.
David Smith [Mon, 10 Jun 2013 16:15:13 +0000 (11:15 -0500)]
Fix 'nd_syscall.io_getevents' probe.
* tapset/linux/nd_syscalls.stp: Split 'nd_syscall.io_getevents' into
'nd_syscall.io_getevents' and 'nd_syscall.compat_io_getevents', since
the kernel function 'compat_sys_io_getevents' gets a 'struct
compat_timespec', not a 'struct timespec'.
* testsuite/buildok/nd_syscalls-details.stp: Add
'nd_syscall.compat_io_getevents' and
'nd_syscall.compat_io_getevents.return' tests.
David Smith [Mon, 10 Jun 2013 16:06:27 +0000 (11:06 -0500)]
Fix 'syscall.io_getevents' probe.
* tapset/linux/syscalls.stp: Split 'syscall.io_getevents' into
'syscall.io_getevents' and 'compat_syscall.io_getevents', since the
kernel function 'compat_sys_io_getevents' gets a 'struct
compat_timespec', not a 'struct timespec'.
* testsuite/buildok/syscalls-details.stp: Add
'compat_syscall.io_getevents' and 'compat_syscall.io_getevents.return'
tests.
William Cohen [Thu, 6 Jun 2013 16:10:22 +0000 (12:10 -0400)]
Fix uconversion.stp function summaries to be a single line
The tool that extracts the information from the comments for the
tapset documentation needs the summary to be on a single line. If the
summary continues to another line, the tool thinks the second line is
part of the description and will fail generating output because there
are multiple description for the same function.
Jonathan Lebon [Fri, 31 May 2013 18:38:02 +0000 (14:38 -0400)]
PR15044: change _stp_text_str() from void to int and clean up tapset
The tapset functions user_string_quoted() and user_string_n_quoted()
now no longer return "NULL" and _stp_text_str() in stp_string.c no
longer returns "<unknown>". Instead, _stp_text_str() was changed to
return an int which the tapset checks for to detect an error.
Jonathan Lebon [Thu, 30 May 2013 19:59:02 +0000 (15:59 -0400)]
PR15044: cleaned up functions in uconversions.stp
Made multiple changes to the way functions report errors. Also added
two new functions to help the cause: user_string2_warn() and
user_string2_n_warn().
Jonathan Lebon [Thu, 30 May 2013 19:11:44 +0000 (15:11 -0400)]
PR15044: clean up funcs in errno.stp and string.stp
In errno.stp, made returnstr() report an error if there are no
registers available rather than returning 0. In string.stp, changed
stringat() to report an error if pos is out of bounds.
The previous version of the code used a stats- (per-cpu-) array with a
5-tuple of index keys, three of them strings. Multiplying all that
out could could yield several hundred MB of requested kernel RAM at
startup. Not that anything's wrong with that, but let's not be so
gluttinous.
The new code uses one formatted string as the key column.
Serguei Makarov [Mon, 3 Jun 2013 18:45:31 +0000 (14:45 -0400)]
stapregex PR15064: groundwork for named chr class support
Current support is missing most of the standard chr classes,
need to find a good and proper reference for them.
* stapregex.cxx (regex_parser::parse_char_range): respect [: :] brackets
when slurping character classes.
* re2c-regex.h (Range::Range): fix lack of deep-copy in copy constructor
for ranges.
* re2c-regex.cxx (namedCharacterClasses): new global table of char ranges.
(Scanner::namedChrClass): new function.
(Scanner::ranToRA): new function.
(Scanner::ranToRE): change to use ranToRA.
(Scanner::getRange): check for '[:' digraph and replace named chr class.
David Smith [Tue, 4 Jun 2013 19:26:30 +0000 (14:26 -0500)]
(Re)Fix BZ15198 by updating syscall.sigaltstack probe.
* tapset/linux/syscalls2.stp: Use generic 'sigaltstack' probe alias when
CONFIG_GENERIC_SIGALTSTACK is set or we're running on a 3.9 (or higher)
kernel (where CONFIG_GENERIC_SIGALTSTACK is the default).
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/i386/nd_syscalls.stp: Only use arch-specific 'sigaltstack'
probe alias if CONFIG_GENERIC_SIGALTSTACK isn't set or we're running on
a earlier kernel than 3.8.
* tapset/linux/i386/syscalls.stp: Ditto.
* tapset/linux/ia64/nd_syscalls.stp: Ditto.
* tapset/linux/ia64/syscalls.stp: Ditto.
* tapset/linux/powerpc/nd_syscalls.stp: Ditto.
* tapset/linux/powerpc/syscalls.stp: Ditto.
* tapset/linux/s390/nd_syscalls.stp: Ditto.
* tapset/linux/s390/syscalls.stp: Ditto.
* tapset/linux/x86_64/nd_syscalls.stp: Ditto.
* tapset/linux/x86_64/syscalls.stp: Ditto.
William Cohen [Tue, 4 Jun 2013 16:05:12 +0000 (12:05 -0400)]
Eliminate the possibility of ioblktime.stp global array overflow
In some cases the global array tracking IO operations in flight could
overflow when the machine is doing many IO operations (RHBZ743591).
The possiblity of overflow is addressed by increasing the amount of
space allocated for the global array and using the '%' specifier for
the global array.
David Smith [Tue, 4 Jun 2013 16:06:33 +0000 (11:06 -0500)]
Fixed PR15572 by updating the ipmip.stp tapset.
* tapset/linux/ipmib.stp: Updated the 'ipmib.InNoRoutes' and
'ipmib.InAddrErrors' probe aliases for the 3.10 kernel. Those probe
aliases now probe the return of the ip_route_input_noref() kernel
function.
David Smith [Tue, 4 Jun 2013 13:31:48 +0000 (08:31 -0500)]
Fixed PR15523 by updating the socket.stp tapset.
* tapset/linux/socket.stp: Reimplemented functions as macros. The old
functions were deprecated. Used those new macros throughout the tapset,
to avoid trying to use NULL pointers.
* NEWS: Mentioned function deprecations.
* testsuite/buildok/socket-embedded.stp: No longer test deprecated
functions.
David Smith [Mon, 3 Jun 2013 16:23:53 +0000 (11:23 -0500)]
Actually deprecate items marked as deprecated in nfs_proc.stp.
* tapset/linux/nfs_proc.stp: The 'stap_NFS_CLIENT' and '__getfh_inode'
functions had a comment stating they were deprecated. Actually make it
happen.
* NEWS: Mentioned function deprecations.