David Smith [Thu, 16 Dec 2010 20:55:25 +0000 (14:55 -0600)]
Fix PR11388 by handling syscall.mmap changes for 2.6.33+ kernels.
* tapset/syscalls.stp: Use arch-generic sys_mmap_pgoff() for syscall.mmap2
if kernel version is 2.6.33 or higher.
* tapset/i386/syscalls.stp: Only use arch-specific syscall.mmap* probes if
kernel version is less than 2.6.33.
* tapset/ia64/syscalls.stp: Ditto.
* tapset/powerpc/syscalls.stp: Ditto.
* tapset/s390/syscalls.stp: Ditto.
* tapset/x86_64/syscalls.stp: Ditto. Also move sys_mmap_pgoff() probe to
syscall.mmap2 alias (instead of syscall.mmap alias).
* testsuite/buildok/syscalls-detailed.stp: Add generic syscall.mmap2 test
if kernel version is 2.6.33 or higher.
* testsuite/buildok/syscalls-arch-detailed.stp: Only test arch-specific
syscall.mmap* probes if kernel version is less than 2.6.33.
David Smith [Thu, 16 Dec 2010 20:01:31 +0000 (14:01 -0600)]
Fixed PR12330 by changing tapset/tty.stp to avoid ppc64 compile problem.
* tapset/tty.stp (_struct_winsize_u): Removed embedded-C function.
(tty.resize): Removed calls to _struct_winsize_u() and just uses
user_ushort() to get values in user memory.
* tapset/uconversions.stp (user_ushort): New function.
(user_ushort_warn): Ditto.
* testsuite/buildok/conversions-embedded.stp: Added user_ushort() and
user_ushort_warn() tests.
* testsuite/buildok/tty-embedded.stp: Removed (since all embedded-C
functions have been removed from tty.stp).
Frank Ch. Eigler [Mon, 13 Dec 2010 18:50:02 +0000 (13:50 -0500)]
PR12309 part 1, use atomic_t for delayed_work state signaling
There was a possible race condition between multiple processes opening
the transport .ctl file concurrently.
* runtime/transport/transport.h (_stp_ctl_attached): Become atomic_t.
* runtime/transport/transport.c (_stp_attach, _stp_detach):
Stop messing with it.
* runtime/transport/control.c (_stp_ctl_open|close_cmd): Use atomic_t
and reorder logic to defeat race condition.
Dave Brolley [Wed, 15 Dec 2010 17:04:57 +0000 (12:04 -0500)]
PR 11922: Allow ip address as host name to match ip address in server certificate.
The default certificate function (SSL_AuthCertificate) fails to match DNS names
which resemble ip addresses. It then calls our badCertHandler callback. There
we get the chance to manually match the ip address.
Josh Stone [Tue, 14 Dec 2010 22:47:56 +0000 (14:47 -0800)]
Split user_int64 in two on i386
* tapset/uconversions.stp (user_int64): Since __stp_get_user can't do
64-bit reads on i386, we must read the value in two parts.
(user_uint64): Make this just a wrapper for user_int64.
William Cohen [Thu, 9 Dec 2010 01:40:24 +0000 (20:40 -0500)]
Edit tapset documentation comments
Made the following changes to the documentation comments:
- Remove the "General Syntax:" lines.
- Remove trailing '.' for the summaries.
- Make parameter information phrases rather than sentences
William Cohen [Wed, 8 Dec 2010 22:12:14 +0000 (17:12 -0500)]
Edit the tapset documentation for context-symbols.stp
Made the following changes to the documentation comments:
- Remove the "General Syntax:" lines.
- Remove trailing '.' for the summaries and argumentation information.
- Fix a few typos.
William Cohen [Wed, 8 Dec 2010 22:06:21 +0000 (17:06 -0500)]
Edit the tapset documentation for context.stp
Made the following changes to the documentation comments:
- Remove the "General Syntax:" lines.
- Remove trailing '.' for the summaries.
- Add title and description for cpuid function
William Cohen [Wed, 8 Dec 2010 19:00:46 +0000 (14:00 -0500)]
Add the *mib.stp tapsets to the SystemTap Tapset reference manual
Went through the comments in ipmib.stp, linuxmib.stp, and tcpmib.stp to
make them format properly. Then added a chapter in the SystemTap Tapset
reference manual for them.
David Smith [Tue, 7 Dec 2010 16:38:46 +0000 (10:38 -0600)]
Fixed 11794 by replacing returnstr() calls with return_str() when possible.
* tapset/errno.stp (returnstr): Updated documentation comment to note that
this function should only be used in dwarfless probes. Renamed
'returnp' argument to 'format'.
(return_str): Added documentation comment.
* tapset/aux_syscalls.stp: Replaced returnstr() function calls with
return_str() function calls.
* tapset/i386/syscalls.stp: Ditto.
* tapset/ia64/syscalls.stp: Ditto.
* tapset/powerpc/syscalls.stp: Ditto.
* tapset/rpc.stp: Ditto.
* tapset/s390/syscalls.stp: Ditto.
* tapset/signal.stp: Ditto.
* tapset/syscalls.stp: Ditto.
* tapset/syscalls2.stp: Ditto.
* tapset/x86_64/syscalls.stp: Ditto.
Stan Cox [Fri, 3 Dec 2010 20:53:56 +0000 (15:53 -0500)]
Support x86 1 byte and 2 byte registers.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor): Add all register variants.
(get_register_width): New.
(visit_target_symbol): Use it for register case to extract register part.
David Smith [Thu, 2 Dec 2010 20:05:39 +0000 (14:05 -0600)]
Fixed possible string buffer overruns in several embedded-C functions.
* tapset/socket.stp (sock_flags_num2str): Use strlcat() instead of
strcat() to guard against buffer overruns. Instead of creating the
string in a temporary variable and then copying it to THIS->__retvalue,
just create the string in THIS->__retvalue.
(msg_flags_num2str): Ditto.
* tapset/inet_sock.stp (daddr_to_string): Use snprintf() instead of
sprintf() to guard against buffer overruns.
* tapset/signal.stp (sigset_mask_str): Ditto.
* tapset/s390/nd_syscalls.stp (get_32mmap_args): Use strlcat()/snprintf()
instead of strcat()/sprintf() to guard against buffer overruns.
* tapset/s390/syscalls.stp: Removed unused function get_32mmap_args().
* tapset/aux_syscalls.stp: Minor string-related fixes.
* tapset/string.stp: Ditto.
David Smith [Tue, 30 Nov 2010 20:18:22 +0000 (14:18 -0600)]
Fixed BZ624657 by fixing timing issues in the initscript.
* initscript/systemtap.in (start_script): Make sure we wait until the pid
file has been written before trying to use it.
(stop_script): Check to see if the module has been really unloaded
before declaring success.
Josh Stone [Tue, 30 Nov 2010 00:16:22 +0000 (16:16 -0800)]
Add configure --disable-sdt-probes
This new option turns off SDT markers in our own binaries. This doesn't
change the ability to probe SDT in other applications.
* configure.ac: Add --disable-sdt-probes.
* runtime/staprun/configure.ac: Ditto.
* includes/stap-probe.h: Define PROBE[N] depending on ENABLE_SDT_PROBES.
* *.cxx, runtime/staprun/*.[ch]: Use the indirect PROBE macros instead
of STAP_PROBE, so SDT can be disabled.
* (everything else): Regenerated with autoreconf.
(The change is bigger due to my newer autotools on F14 -- sorry...)
Frank Ch. Eigler [Sat, 27 Nov 2010 23:48:52 +0000 (18:48 -0500)]
PR10651 / RHBZ653286: mod_timer vs. del_timer_sync races
It appears possible for del_timer_sync (from outside) and mod_timer
(from within a timer callback) to race. Defeat this race by ensuring
that the timer callback checks an atomic_t flag before rescheduling
itself with mod_timer.
* runtime/transport/relay_v2.c (transport_state): Turn into an atomic_t.
Update users.
(__stp_relay_wakeup_timer): Observe flag.
(_stp_transport_data_fs_{start,stop}): Update flag before timer manipulations.
* runtime/transport/ring_buffer.c: Ditto for corresponding functions.
Dave Brolley [Thu, 25 Nov 2010 16:11:36 +0000 (11:11 -0500)]
Improved handling of uprobes.ko by compile-server and client.
- Server now returns uprobes.ko to client when required.
- New optional argument to staprun's -u option to specify the location
of uprobes module.
- Client uses new argument of -u to specify uprobes.ko returned by
the server.
- staprun still prefers already-loaded uprobes, built-in uprobes and
kernel-built uprobes over the one returned by the server.
- staprun verifies the signature of the uprobes module for unprivileged
users.
Josh Stone [Wed, 24 Nov 2010 00:13:55 +0000 (16:13 -0800)]
PR12138: Convert the user_int functions to kread
This uses our more-centralized mechanism for reading uncertain memory,
which also has the ability to read 8-byte values on i386 (not atomically).
* tapset/uconversions.stp: New, move the user_* functions here. The new
STP_GET_USER[_WARN] standardize all integer accesses through kread.
* tapset/conversions.stp: This is only for kernel functions now.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Include uconversions.
* testsuite/buildok/conversions.stp: Build the user_intNN too.
* testsuite/buildok/conversions-embedded.stp: Ditto.
Roland McGrath [Tue, 23 Nov 2010 02:33:35 +0000 (18:33 -0800)]
PR12139: test case for pointer to an incomplete type in probe argument
* testsuite/systemtap.base/sdt_types.c: Test a pointer to an incomplete type.
* testsuite/systemtap.base/sdt_types.stp: Use that new probe.
* testsuite/systemtap.base/sdt_misc.exp: Expect that.
Stan Cox [Mon, 22 Nov 2010 22:34:01 +0000 (17:34 -0500)]
Test sdt_types.c with c++.
sdt_misc.exp (type_language,type_language_mssgs,extra_type_mssgs) New.
Loop over for c++ testing. Improve error messages.
sdt_types.stp: Improve error messages.
Josh Stone [Fri, 19 Nov 2010 22:00:38 +0000 (14:00 -0800)]
Make lex_cast work numerically with [u]int8_t
These were getting treated by istream like char types, which would
always fail our generic template since eof isn't reached. There's not
much point to using lex_cast<char> anyway, since str[0] will do the
same, so I've specialized lex_cast with [u]int8_t to read numerically.
The only place we use this so far is in SDT V3 parsing constants. SDT
doesn't yet emit 1-byte arguments, but it may in the future.
* util.h (lex_cast<int8_t>): Read via int16_t to stay numeric.
(lex_cast<uint8_t>): Same, with uint16_t.
Josh Stone [Fri, 19 Nov 2010 04:42:33 +0000 (20:42 -0800)]
sdt_types: remove manual type-casting
For now, remove the int() and short() typecasting, as it seems to be
working without. We should try as much as possible to fix these issues
in the translator and/or sdt.h before masking it in the test.
Josh Stone [Fri, 19 Nov 2010 04:06:52 +0000 (20:06 -0800)]
Cast the proper sign and size of SDT constant args
* tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_target_symbol):
For the constant case, we still need to do some typecasting, as gcc
doesn't necessarily match the sign of the constant to the type.
Josh Stone [Fri, 19 Nov 2010 03:32:56 +0000 (19:32 -0800)]
Cast the proper sign and size of SDT register args
* tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_target_symbol):
For the REGISTER case, insert a typecast to deal with truncation and
sign-extension of the argument as needed.