David Smith [Fri, 15 Apr 2011 14:24:27 +0000 (09:24 -0500)]
More testsuite fixes.
* testsuite/systemtap.base/buildid.exp: Check for uprobes, not just
utrace. If we get an error, go ahead and return, since the following
stuff won't work since we've already cleaned up.
* testsuite/systemtap.base/target_set.exp: Better cleanup.
* testsuite/systemtap.base/target_set.stp: Now compiles on s390x and
ppc64 by using @cast().
* testsuite/systemtap.context/backtrace.tcl: If we get an EOF, don't call
exp_contine (which causes a tcl error).
Josh Stone [Tue, 12 Apr 2011 22:06:06 +0000 (15:06 -0700)]
Add STAP_PROBEV for variadic probe arguments
For the moment, this is only created when SDT_USE_VARIADIC is defined,
because we want to support arbitrary compiler flags, and -pedantic tends
to object to variadic macros.
* includes/sys/sdt.h (STAP_PROBEV): New.
* testsuite/systemtap.base/sdt_va_args.c: Use STAP_PROBEV.
* testsuite/systemtap.base/sdt_va_args.exp: Test STAP_PROBEV.
Stan Cox [Tue, 12 Apr 2011 20:25:15 +0000 (16:25 -0400)]
Simplify V3 sdt argument mode handling.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_target_symbol_arg):
Treat argument extraction as a 64 bit subexpression and handle its sign if needed.
David Smith [Mon, 11 Apr 2011 21:40:31 +0000 (16:40 -0500)]
Updated tapset/vfs.stp for 2.6.39-0.rc2.
* tapset/vfs.stp: Kernel commit 7eaceac removed block_sync_page(), so
those probes were made optional. Kernel commit e64a782 renamed
__remove_from_page_cache() to __delete_from_page_cache(), so add an
alias.
* testsuite/buildok/vfs-detailed.stp: Updated.
David Smith [Mon, 11 Apr 2011 18:45:59 +0000 (13:45 -0500)]
Fixed runtime/procfs.c for 2.6.39-0.rc2.
* runtime/procfs.c (_stp_mkdir_proc_module): Calls kern_path_parent()
instead of path_lookup(). For older kernels kern_path_parent() is
defined as path_lookup().
* buildrun.cxx (compile_pass): Added autoconf-kern-path-parent.c test.
* runtime/autoconf-kern-path-parent.c: New test.
Lukas Berk [Wed, 6 Apr 2011 23:12:17 +0000 (19:12 -0400)]
PR3823: Added gettext functionality to dtrace script
Makefile* - were modified to include dtrace as a gettext file
dtrace.in - script was modified to only enable gettext functionality
if ENABLE_NLS is true
po/POTFILES.in - updated to include dtrace in gettextizing
other po* files - updated as needed
David Smith [Wed, 6 Apr 2011 19:05:33 +0000 (14:05 -0500)]
Fixed BZ692445 by updating regular expression 'all_pass_string'.
* testsuite/lib/stap_run.exp: Make expect happier by removing the '$' at
the end of 'all_pass_string'. The '\r\n' should catch the end of lines
properly.
Lukas Berk [Tue, 5 Apr 2011 15:40:01 +0000 (11:40 -0400)]
PR3823: Added gettext functionality to staprun files.
This was tested on a Fedora 14 x86_64 virtual machine with the
$LANG environment variable set to fr_FR.utf8 with a dummy stapio
usage message. Po files have been updated accordingly.
David Smith [Mon, 4 Apr 2011 16:30:26 +0000 (11:30 -0500)]
Handle logfile paths that end in '|', treat it as a command to read data from.
* pcp/src/pmdas/logger/util.c: New file.
* pcp/src/pmdas/logger/util.h: Ditto.
* pcp/src/pmdas/logger/event.c (event_init): Handle opening pipe "paths".
(event_shutdown): New function that stops piped processes and closes all
files.
* pcp/src/pmdas/logger/event.h: Added event_shutdown() prototype.
* pcp/src/pmdas/logger/logger.c (read_config): Moved lstrip/rstrip code to
util.c.
(main): Calls event_shutdown() after pmdaMain() returns to clean
everything up.
* pcp/src/pmdas/logger/GNUmakefile.in: Added util.c and util.h.
* pcp/src/pmdas/logger/Install: Support entering pipe "paths".
Josh Stone [Fri, 1 Apr 2011 20:57:39 +0000 (13:57 -0700)]
Add addr() for retrieving REG_IP
For probes which have CONTEXT->regs, return REG_IP, else return 0.
* tapset/context.stp (addr): New function.
* testsuite/buildok/context-embedded.stp: Test addr() compilation.
* NEWS: Let the town crier make a pronouncement of addr().
William Cohen [Thu, 31 Mar 2011 20:54:09 +0000 (16:54 -0400)]
Correct use of pid for filtering
The blog on http://blog.yufeng.info/archives/1239 mentions that the script
is not properly filtering based on pid. This change corrects the
filtering to use the pid.
David Smith [Thu, 31 Mar 2011 16:23:27 +0000 (11:23 -0500)]
Change the logger PMDA config file lines to be of the form "NAME PATHNAME".
* pcp/src/pmdas/logger/logger.c (valid_pmns_name): New function.
(read_config): Read NAME and PATHNAME from each config file line. Make
sure NAME is a valid PMNS name.
* pcp/src/pmdas/logger/Install: Ask for logfile names along with paths.
* pcp/src/pmdas/logger/event.h: Swap the order of the logfile name and
pathname to mirror the new config file.
* tapset/aux_syscalls.stp (_ptrace_options_str, _ptrace_argstr)
(_ptrace_return_geteventmsg_data): New functions.
* tapset/i386/aux_syscalls.stp: New file.
* tapset/ia64/aux_syscalls.stp: New file.
* tapset/nd_syscalls2.stp (nd_syscall.ptrace): Set argstr using
_ptrace_argstr.
(nd_syscall.ptrace.return): Set geteventmsg_data and arch_prctl_addr.
* tapset/powerpc/aux_syscalls.stp: New file.
* tapset/s390/aux_syscalls.stp: New file.
* tapset/syscalls2.stp (syscall.ptrace): Set argstr using
_ptrace_argstr.
(syscall.ptrace.return): Set geteventmsg_data and arch_prctl_addr.
* tapset/x86_64/aux_syscalls.stp: New file.
* testsuite/buildok/aux_syscalls-embedded.stp (begin): Call
_ptrace_argstr, _ptrace_return_geteventmsg_data and
_ptrace_return_arch_prctl_addr.
Stan Cox [Wed, 30 Mar 2011 15:14:43 +0000 (11:14 -0400)]
Add more syntax for shared library probing.
* dwflpp.cxx (iterate_over_libraries): New. Get library list via
ld-linux.so.
* dwflpp.h (iterate_over_libraries): Likewise.
* tapsets.cxx (base_query): If this is a library then save the
executable path.
(query_module): For a library, call query_library_callback via
iterate_over_libraries.
(query_library_callback): New. Calls query_library.
(query_library): Substitute the library name into the chain then
derive_probes.
William Cohen [Tue, 29 Mar 2011 17:57:08 +0000 (13:57 -0400)]
Remove unneeded initializer
The variable is already static so will be initialized to 0. Removed the
unneeded initializer and elminate a warning message from the compiling the
code.
Frank Ch. Eigler [Tue, 29 Mar 2011 13:33:53 +0000 (09:33 -0400)]
PR12612: compatibility with old staprun/stapio
commit 3abb860f changed the staprun<->runtime message format for
the STP_RELOCATE message, without regard for backward compatibility
for older/mismatching stapruns. That leads to kernel errors and
no kernel probes and such nonsense. Let's change the runtime to
interoperate both with old staprun and with the current one.
* runtime/transport/symbols.c (_stp_do_relocation): Also accept
systemtap-1.3 level relocation message, if the incoming message
size suggests.
David Smith [Mon, 28 Mar 2011 21:04:46 +0000 (16:04 -0500)]
The logger PMDA supports multiple clients and multiple logfiles.
* pcp/src/pmdas/logger/logger.c: Changed to support dynamic metrics for
logfile data, which enables multiple client/multiple logfile support.
* pcp/src/pmdas/logger/event.c: Changes to support multiple clients and
multiple logfiles. Abstracted the interface a bit.
* pcp/src/pmdas/logger/event.h: Moved 'struct LogfileData' definition here
from logger.c. Removed event_cleanup() declaration.
* pcp/src/pmdas/logger/help: Updated.
* pcp/src/pmdas/logger/pmns: Make 'perfile' the start of the dynamic
metrics.
* pcp/src/pmdas/logger/GNUmakefile.in: Make logger.o depend on domain.h.
Frank Ch. Eigler [Sun, 27 Mar 2011 03:59:24 +0000 (23:59 -0400)]
sdt_v3: avoid misleading warning on complex operands
Roland reported seeing the "Downgrading SDT_V2 probe argument to dwarf ..."
warning message on an ambitious SDT_V3 object file. The message is
not applicable, since there is no dwarf emitted at all for SDT_V3.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_target_symbol_arg):
Remove SDT_V2 language for SDT_V3 probe.
Josh Stone [Thu, 24 Mar 2011 18:18:45 +0000 (11:18 -0700)]
Find SDT semaphores even in RWX mappings
Some S390 environments don't have noexec mappings for data sections, so
the .probes section with SDT semaphores is mapped RWX rather than RW-.
Our logic which checks vm flags needs to accommodate this.
* runtime/uprobes-common.c (stap_uprobe_mmap_found): Deal with mappings
that are both executable and writable, so semaphores can be found.
Josh Stone [Tue, 22 Mar 2011 03:01:39 +0000 (20:01 -0700)]
Add a workaround for old systems without ppoll
A coarse approximation of ppoll is added using sigprocmask and poll, as
suggested in the ppoll manpage, but it doesn't carry the same atomic
guarantee. I've forced it to have a non-infinite polling timeout, so we
won't block forever.
NB: This only matters on the client connecting to a remote ssh host.
* configure.ac: Check for the function ppoll.
* configure, config.in: Regenerate.
* remote.cxx (ppoll): Fill in for missing ppoll, with a healthy comment
explaining why I think this implementation is Good Enough™.
Josh Stone [Mon, 21 Mar 2011 22:30:32 +0000 (15:30 -0700)]
remote: Try the legacy ssh code if stapsh isn't found
The ssh remote command is restructured so that if stapsh isn't found in
the remote PATH, it will exit 127 immediately. On the local side, when
we fail to read the stapsh uname response, we can check the exit status
to know stapsh wasn't found. Then we can try again with the old ssh
code with a ControlMaster. However, I'm limiting the fallback to only
when there's a single remote, as signals and cleanup aren't really
handled as well. (That's the point of stapsh...)
* remote.cxx (ssh_remote::create): New static function which tries a
self-instantiation first, then if that fails to find stapsh, it tries
again using ssh_legacy_remote instead.
(ssh_remote::connect): Renamed from remote. Now using a "type -P"
trick to silently determine if stapsh is present, by exit code alone.
(ssh_legacy_remote): Un-#ifdef'ed the old ssh_remote code, to get new
life as our legacy access.
(remote::create): Get ssh through ssh_remote::create.
Josh Stone [Mon, 21 Mar 2011 22:22:09 +0000 (15:22 -0700)]
nsscommon: Heed what fgets returns
My F14 gcc rightfully warned that a return value of fgets was unused.
It may return NULL on error or EOF, in which case we should free our
memory and return NULL to NSS as well. I also tweaked the newline stomp
to tolerate missing newline, e.g. with oversized input, although that
case it not likely going to work anyway.
* nsscommon.c (nssPasswordCallback): Check fgets' return for success.
Dave Brolley [Mon, 21 Mar 2011 20:25:31 +0000 (16:25 -0400)]
PR 12101: stap-server should use proper cert passwords.
Automatically regenerate certificate databases containing a password file.
Otherwise automatically started servers will fail because they won't know
the password.
Dave Brolley [Mon, 21 Mar 2011 18:06:06 +0000 (14:06 -0400)]
PR 12101: stap-server should use proper cert passwords
Step 1: The server's certificate database now uses no password by default
(useful for full automation).
Preliminary support for password prompting for databases created
with a password.
Josh Stone [Fri, 18 Mar 2011 23:46:42 +0000 (16:46 -0700)]
Add a testcase for stapsh remotes
We can't generally test true remotes in the testsuite without previously
setting up ssh access on a machine. But we can still check that the
stapsh mechanism works in general. This runs with --remote=stapsh, and
checks that stapsh exists in the process hierarchy and a signal to stap
only is propagated through stapsh.
Josh Stone [Fri, 18 Mar 2011 23:43:28 +0000 (16:43 -0700)]
remote: Block signals in direct_stapsh's child
We want direct_stapsh to simulate the ssh_remote signaling as much as
possible, so we must ensure that the manual stapsh child process doesn't
get signals directly.
* remote.cxx (direct_stapsh::direct_stapsh): Block signals while
spawning the stapsh process.
Josh Stone [Fri, 18 Mar 2011 22:38:29 +0000 (15:38 -0700)]
PR12592: Allow -r /path/to/kernel for stap-servers
Previously, stap-serverd would parse the release string from a kernel
path, but now it also passes that full path on for stap to use.
* stap-serverd (process_r): Keep the full -r path for stap_options.
* stap-server (process_r): Ditto.
* session.cxx (systemtap_session::setup_kernel_release): Skip repeated
kernel strings, for the case when a server -r /path/to/kernel is
followed by a client's matching -r kernel.
Lukas Berk [Fri, 18 Mar 2011 13:14:03 +0000 (09:14 -0400)]
PR3823: Adding gettext functionality to several base files
po/* files updated strings
csclient.cxx - added gettext
dwarf_wrappers.cxx - same
remote.cxx - same
setupdwfl.h - same
staptree.cxx - same
util.cxx - moved macros to util.h
util.h - added gettext
Josh Stone [Fri, 18 Mar 2011 02:51:11 +0000 (19:51 -0700)]
Cache compile_server_info attached to sessions, not static
The various vector<compile_server_info> caches in csclient have
information that's specific to the systemtap_session in question, so
they need to be saved with the session rather than kept static. This
matters for the brave new world of having multiple unique remote targets
within a single stap execution.
* session.h (systemtap_session::server_cache): New, opaque pointer for
a struct containing csclient's cached data.
* session.cxx (systemtap_session::systemtap_session): NULL it.
* csclient.cxx (struct compile_server_cache): Define a container for all
the caching vectors that will be stored in the session.
(cscache): Get the cache from the session, allocate it if needed.
(get_default_server_info): Use a cache vector instead of a static.
(get_specific_server_info): Ditto.
(get_or_keep_trusted_server_info): Ditto.
(get_or_keep_signing_server_info): Ditto.
(get_or_keep_online_server_info): Ditto.
Josh Stone [Thu, 17 Mar 2011 18:25:49 +0000 (11:25 -0700)]
PR12591: Setup the signal handler earlier
We were calling setup_signals() in passes_0_4(), but --use-server
diverts that execution path, so signaled cleanup wasn't working in that
case at all. It's also possible with multiple --remotes that
passes_0_4() will be called multiple times, though that shouldn't really
hurt signal handling. This patch moves setup_signals() to main(), so it
is called once early on.
David Smith [Wed, 16 Mar 2011 17:55:43 +0000 (12:55 -0500)]
Read the list of logfiles from a config file in the logger PMDA.
* pcp/src/pmdas/logger/logger.c (read_config): New function to read the
config file.
(main): Remove the '-m' option and accept a config file.
* pcp/src/pmdas/logger/Install: Add the capability to specify a config
file or create one.
Josh Stone [Mon, 14 Mar 2011 22:14:58 +0000 (15:14 -0700)]
stapsh: Add OK/ERROR replies to file and run commands
* runtime/staprun/stapsh.c (reply): Print a reply (and dbug it too).
(do_hello): Send uname info using reply().
(do_file, do_run): Add OK reply, or ERROR from former stderr chatter.
(qpdecode): Convert stderr chatter to dbug.
* remote.cxx (stapsh::get_reply): Read a one-line reply from the remote.
(stapsh::send_file): Look for an OK reply after sending the file.
(stapsh::start): Look for an OK reply after telling it to run.
(stapsh::set_child_fds): Use get_reply to read the uname back.
Josh Stone [Mon, 14 Mar 2011 21:15:21 +0000 (14:15 -0700)]
stapsh: Add debugging macros
* runtime/staprun/stapsh.c (dbug, vdbug, die): New debugging macros.
(usage, parse_args): New, just dealing with -v for now.
(main): Parse arguments, and start printing debugging information.
* remote.cxx (ssh_remote::init): Set stapsh verbosity according to p5.
(direct_stapsh::direct_stapsh): Ditto.
(remote::run): Make sure subsession->verbose is updated for pass-5.
Josh Stone [Fri, 11 Mar 2011 23:54:43 +0000 (15:54 -0800)]
stapsh: Remove the signal command, just call it quit
As Przemysław pointed out, signal numbers are not 100% portable across
different architectures, and we should allow for the possibility of
cross-compilation in --remote execution. Since the only point of the
signal command was to trigger an exit, let's just replace it with a
"quit" command.
* runtime/staprun/stapsh.c (do_signal -> do_quit): Forget about parsing
signal numbers -- just call cleanup (which sends SIGHUP anyway).
(cleanup): Mask signals, so if called from non-signal context, we
won't get a reentry (especially for SIGCHLD).
* remote.cxx (stapsh::handle_poll): Send a quit instead of signal.
Josh Stone [Fri, 11 Mar 2011 00:43:53 +0000 (16:43 -0800)]
remote: Split preparation from the actual start
* remote.h (remote::prepare): New, get ready to run.
* remote.cxx (stapsh::start, stapsh::prepare): Split the file-upload into
the prepare step, so we're ready to go sooner.
(remote::run): Let remotes prepare first, so they can all start as
close together as possible.
Josh Stone [Fri, 11 Mar 2011 00:35:42 +0000 (16:35 -0800)]
stapsh: Use quoted-printable args in the run command
Per Frank's suggestion, discard the separate "arg" command and just add
arguments directly in the run command. The quoted-printable encoding is
used for whitespace and characters that aren't printable ASCII.
* runtime/staprun/stapsh.c (do_arg): Remove.
(qpdecode): New, decode quoted-printable.
(do_run): Read and QP-decode arguments for staprun.
* remote.cxx (stapsh::send_arg): Remove.
(stapsh::qpencode): New, encode a string with QP escapes.
(stapsh::start): Build the run command with QP-encoded arguments.
Josh Stone [Wed, 9 Mar 2011 18:24:12 +0000 (10:24 -0800)]
stapsh: A systemtap "shell" to aid remote execution
This stapsh agent is a wrapper meant to be automatically invoked through
an ssh connection to transfer systemtap modules to remotes hosts and
invoke staprun on them. The primary motivation of stapsh is make sure
all the exit cases can happen cleanly, especially with sending signals
to the remote and cleaning up the processes and temporary files.
This is meant to replace the code based on multiple connections with an
ssh ControlMaster. For now, that code has only been #if'ed out in
case we still want it for talking with "legacy" remotes.
* runtime/staprun/stapsh.c: New, a basic command shell for uploading and
remotely launching systemtap scripts.
* runtime/staprun/Makefile.am: Add stapsh.
* runtime/staprun/Makefile.in: Regen.
* systemtap.spec: Package stapsh in systemtap-runtime.
* remote.cxx (class stapsh): New, handle communication with a stapsh
remote via any given file descriptors.
(class direct_stapsh): New, launch a direct stapsh instance to run
through. This way we can add stapsh to the testsuite without
requiring any remote access configuration.
(class ssh_remote): Block out the old implementation, and rewrite
as an inheritor of stapsh.
(remote::create): Create direct_stapsh for "--remote stapsh".
(remote::run): Add a polling loop during runtime, where each remote
can add fds to watch and then respond.
* util.cxx (stap_spawn_piped): Allow piped stdin too.
(stap_system_read): Update call to stap_spawn_piped.