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.
Lukas Berk [Fri, 31 May 2013 15:33:03 +0000 (11:33 -0400)]
Adjust stapbm.in and docs to avoid recurssion
*NEWS: added news blurb
*java/stapbm.in: due to change in tapset-method.cxx and only probing
probe begin, we're able to remove java recursion gaurds
and simply
*main/stapprobes.3stap: update docs reflecting requirement of jvm pid's
to be prexisting and if a string is passed for
process name, it needs to be listed in a jps -l
invocation
*tapset-method.cxx: switch process("java").begin probe to probe begin
in order to avoid recurssion due to byteman operations
David Smith [Fri, 31 May 2013 14:05:23 +0000 (09:05 -0500)]
Fixed BZ920444 by using macros to handle nfs parameter changes.
* tapset/linux/nfs_proc.stpm: New file.
* tapset/linux/nfs_proc.stp: Remove __i2n_ip_proto(),
__nfs_read_data_info(), and __nfs_write_data_info() functions. Callers
of those functions now use new macros in nfs_proc.stpm. The advantage
the macros have, besides clarity, is that they preserve type
information. Kernel commit 0b7c01533aa9f4a228d07d2768d084acb3a387bc
changed the commit functions to take a nfs_commit_data structure instead
of a nfs_write_data_structure. Because functions lose type information,
systemtap didn't notice this change.
Josh Stone [Wed, 29 May 2013 20:52:58 +0000 (13:52 -0700)]
Double-check DW_AT_comp_dir before we try to use it
In building tracepoints, we try a late search for the kernel source tree
using DW_AT_comp_dir, and add extra includes based on that path. That
comp_dir is not always reliable though; for instance, Ubuntu leaves it
something like "/build/buildd/linux...", which is not an installed path.
(See also http://brainstorm.ubuntu.com/idea/11327)
* tapsets.cxx (tracepoint_builder::init_dw): Verify that the given
DW_AT_comp_dir actually exists before we use it.
Josh Stone [Wed, 29 May 2013 19:53:59 +0000 (12:53 -0700)]
Remove redundant assert_is_myproc from utf functions
* tapset/uconversions.stp (user_string_utf16, user_string_utf32): These
are marked "/* myproc-unprivileged */", so the translator will insert
the necessary assert_is_myproc() already. Having a redundant check
doesn't actually hurt, except it adds confusion by implying that other
similar functions are in error for not having this too.
David Smith [Tue, 28 May 2013 21:42:03 +0000 (16:42 -0500)]
Fix PR15543 by fixing the 'servername' convenience variables in the rpc tapset.
* tapset/linux/rpc.stp: Handle kernel change that moves the 'cl_server'
field of the 'rpc_clnt' structure into the 'rpc_xprt' structure.
* tapset/linux/rcu.stp: New file.
Raphaël Beamonte [Tue, 28 May 2013 01:45:55 +0000 (21:45 -0400)]
Remove a direct include of rwlock.h which fail on a kernel with the RT patches
The file linux/rwlock.h should not be included directly as stated by
an #error message at the 5th line of the file. With a RT patched
kernel, linux/rwlock_rt.h should be included instead of linux/rwlock.h.
The file linux/spinlock.h already do the proper check. We then should
let the include be done by this file.
Jonathan Lebon [Mon, 27 May 2013 20:43:20 +0000 (16:43 -0400)]
PR14440: made usage of pfiles.stp and plimit.stp more consistent
Added support for plimit.stp to accept a target PID through both -x and
$1, just like in pfiles.stp. Also removed the //bin/true hack from
pfiles.stp and '#!/usr/bin/env stap' from plimit.stp so that both of
them must be run using stap -g.
Lukas Berk [Mon, 27 May 2013 18:35:10 +0000 (14:35 -0400)]
Add xvfb-run workaround for docs generation
*configure.ac: add AC_PROG_CHECK for xvfb-run
*doc/beginners/Makefile.am: exec xvfb-run -a publican ...
*systemtap.spec: add buildrequires line for building stap
Jonathan Lebon [Mon, 27 May 2013 15:00:01 +0000 (11:00 -0400)]
PR15525: removed duplicate O_CLOEXEC flag check
The O_CLOEXEC flag was being checked twice, which caused it to be
printed out twice in the flag string when present. The duplication
was removed and the flags were put back in alphabetical order (same
order as in `man 2 open`) to ensure this does not happen again.
Lukas Berk [Mon, 27 May 2013 14:09:04 +0000 (10:09 -0400)]
Change use of jps to ps and stop bmsubmit recursion issue
*java/stapbm.in: we can make use of ps instead of jps as the java
name we're looking for is also passed as an argument
to java and this avoids starting another java proc
also add a lockfile to bmsubmit via rulename to stop
further recursion
Jonathan Lebon [Fri, 24 May 2013 14:33:06 +0000 (10:33 -0400)]
traceio.stp example: check for negative $return
The I/O reads and writes should only be counted when $return is
nonnegative. A negative $result occurs if an error was met (e.g.
EAGAIN = -11).
We could have instead here used the bytes_read/written variables
provided by the tapset, but this example demonstrates the use of
local vars and is also consistent with the disktop.stp example.
Josh Stone [Wed, 22 May 2013 23:17:30 +0000 (16:17 -0700)]
stapdyn: Restrict visibility in generated modules
We only want to expose a few specific functions, per stapdyn.h, and we
also want our internal use of those to be bound internally. This is
accomplished by "-fvisibility=hidden", and then setting visibility to
"protected" by #pragma just for stapdyn.h.
Josh Stone [Wed, 22 May 2013 23:14:18 +0000 (16:14 -0700)]
stapdyn: separate enter_dyninst_uprobe_regs
That function calls enter_dyninst_uprobe, which is only defined when
uprobes are active, so we have a weak binding in place. By instead
splitting this into a new file, which is only included when uprobes are
known to be active, it doesn't need the weak reference.
Josh Stone [Wed, 22 May 2013 21:16:42 +0000 (14:16 -0700)]
stapdyn: isolate the tls context pointer more
* runtime/dyninst/runtime_context.h: Rename contexts to tls_context to
better indicate the purpose of this pointer; update everywhere.
(_stp_runtime_entryfn_put_context): Take a pointer argument for the
context you're releasing, to slightly help prevent coding accidents.
* runtime/dyninst/transport.c: Stop the insider-trading of contexts, not
renaming to tls_context either. Use _stp_runtime_get_context().
* tapsets.cxx, translate.cxx: Pass the argument to put_context.