Mark Wielaard [Mon, 5 Sep 2011 21:37:11 +0000 (23:37 +0200)]
PR13112 (and PR13108) blacklist probing function from include/asm .h files.
dwflpp.cxx (build_blacklist): all include/asm .h blfile patterns might
need "full path" so prefix those with '.*'
Add new XFAIL semok.exp inb_blacklisted.stp testcase.
PR6503: introduce systemtap_module_refresh() entry point
This new function in the generated code is to get all active probe
point families to reevaluate applicability, to retry inserting probes
that may have failed during systemtap_module_init (e.g., due to
modules being offline), or disarm/remove probes that are no longer
applicable (e.g. due to modules having gone offline). The default
implementation is empty.
* runtime/transport/symbols.c (_stp_module_notifier): A hack worthy of
Alan Smithee himself, supply a disappointing subset of
module-section-address data tuples as modules come and go.
Frank Ch. Eigler [Wed, 31 Aug 2011 17:42:17 +0000 (13:42 -0400)]
PR6503: add module notifier
* runtime/transport/symbols.c (_stp_module_notifier): New function.
Do nothing.
* runtime/transport/transport.c (_stp_handle_start): Register it.
(_stp_cleanup_and_exit): Unregister it.
Frank Ch. Eigler [Wed, 31 Aug 2011 17:04:27 +0000 (13:04 -0400)]
runtime: remove probe_start/_exit() intermediary
These functions were unnecessary; the runtime can call to the
translator-generated systemtap_module_init|exit throughout.
Documentation and comment changes dominate this patch.
Frank Ch. Eigler [Wed, 31 Aug 2011 15:52:29 +0000 (11:52 -0400)]
PR6503 part 1: separate out _stp_kmodule_update_address
* runtime/sym.c (_stp_kmodule_update_address): New function, body
pulled from river at ...
* runtime/transport/symbols.c (_stp_do_relocation): Chop into two bits.
Auto-discovered dependencies are fine when building on the system the
package will be used on; but for distributions such as Gentoo or for
cross-compilation, they only cause headaches if they are not configurable.
By adding two simple ./configure options, the problem is solved.
Checking for directories directly on the /usr disallows building against a
locally-installed NSS or Avahi, and makes cross-compilation difficult.
By using pkg-config, it's easy to override the results, which allow
building against non-system libraries as well as properly identifying
cross-compiled libraries.
Chris Meek [Tue, 30 Aug 2011 13:42:28 +0000 (09:42 -0400)]
PR12773 cont'd: Added Kernel Debuginfo Support
NOTE: Due to BZ733690, abrt cannot download the kernel-debuginfo.
As soon as that bug is fixed, this feature should work.
setupdwfl.cxx
- Added get_kernel_build_id_from_notes()
- This is used to extract the build ID hex string
from /sys/kernel/notes
- Added download_kernel_debuginfo(systemtap_session &s)
- This attempts to extract the build ID hex string
from /lib/modules/<release>/build/vmlinux.id and
if it fails, it calls the above function. It then
calls abrt to attempt to download the associated
debuginfo.
setupdwfl.cxx
Added function declarations for the above.
Frank Ch. Eigler [Thu, 25 Aug 2011 21:21:22 +0000 (17:21 -0400)]
PR13057 related, remove process.**.return.maxactive(N) probe type
The .maxactive stuff is strictly for kretprobes, so should not be
present in process (uprobes) probes. Use the existing
bind_unprivileged_p flag as a proxy for whether we're dealing with
kernel vs. process probe point hierarchy.
* tapsets.cxx (dwarf_derived_probe::register_*_variants): Make
bind_unprivileged_p an explicit (non-defaulted) argument.
Update callers.
(register_function_variants): Skip TOK_MAXACTIVE variant for process
probes.
Dave Brolley [Thu, 25 Aug 2011 16:14:10 +0000 (12:14 -0400)]
PR 11441 - continue with unprivileged test suite
- New unprivileged_all.exp replaces previously existing unprivileged
mode test suites.
- Tests all known probe point types for expected success/failure for
unprivileged users.
- Checks the above directly and also using an alias.
- Checks that all known probe point types have been tested (uses
--dump-probe-types).
Dave Brolley [Thu, 25 Aug 2011 16:10:59 +0000 (12:10 -0400)]
PR 13057 Provide a Command Line Option to Dump Supported Probe Points
New command line option, --dump-probe-types, has been added. If
--unprivilged is also specified, the dump will be limited to
probe types available to unprivileged users.
David Smith [Thu, 18 Aug 2011 18:34:01 +0000 (13:34 -0500)]
Fixed PR13055 by getting procfs probes working on 3.1 kernels.
* runtime/procfs.c (_stp_rmdir_proc_module): Fix problem where
'/proc/systemtap' wasn't getting removed correctly.
(_stp_mkdir_proc_module): Add support for kernels where neither
path_lookup() or kern_path_parent() are exported (such as the 3.1
kernels).
* buildrun.cxx (compile_pass): Convert compile test for kern_path_parent()
to an export test. Add exports tests for path_lookup() and
vfs_path_lookup().
* runtime/autoconf-kern-path-parent.c: Removed.
Josh Stone [Wed, 17 Aug 2011 21:46:45 +0000 (14:46 -0700)]
PR13078: Support stap --remote unix:/path sockets
* remote.cxx (unix_stapsh): New, connects to an AF_UNIX socket.
(stapsh::get_reply): Deal with possible stapsh stderr chatter.
(stapsh::handle_poll): Rework to handle some corner cases better,
like having the same fd for in and out.
* testsuite/systemtap.base/stapsh-unix.exp: New test using socat.
* testsuite/systemtap.base/stapsh-unix.stp: New test.
Lukas Berk [Wed, 17 Aug 2011 20:36:04 +0000 (16:36 -0400)]
Initialize POD members that were previously uninitialized
* coveragedb.h: initialize type in coverage_element
* csclient.h: initialize argc in compile_server_client
* dwflpp.cxx: initialize blacklist_func, blacklist_func_ret,
and blacklist_file in dwflpp
* dwflpp.h: initialize entrypc in func_info
* elaborate.cxx: initialize num_newly_resolved, num_still_unresolved,
assert_resolvability and t in typeresolution_info
* session.cxx: initialize automatic_server_mode in systemtap_session
* staptree.cxx: initialize privileged in probe, tok in component,
and epilogue_style in probe_alias
* staptree.h: initialize num_index and expr_index in component
* tapset-utrace.cxx: initialize has_library in derived_probe
* tapsets.cxx: initialize has_process and has_library in
dwarf_derived_probe, has_library in base_query,
has_relative, relative_val, choose_next_line, and
entrypc_for_next_line in dwarf_query, op in
var_expanding_visitor and probe_type, probe_loc,
probe_scn_offset, probe_scn_addr, arg_count, base,
and semaphore in sdt_query
* translate.cxx: initialize action_counter and
probe_or_function_needs_deref_fault_handler in
c_unparser
Mark Wielaard [Wed, 17 Aug 2011 11:46:48 +0000 (13:46 +0200)]
PR6961 - backtrace from non-pt_regs probe context
When printing a kernel backtrace use the kernel dump_trace if available.
If the kernel is compiled with frame pointers we can guess the stack
pionter pretty reliably, otherwise let dump_stack figure it out and
skip some of the framework stack frames before starting the print the
remaining stack.
Josh Stone [Mon, 8 Aug 2011 20:54:06 +0000 (13:54 -0700)]
PR11209: Add cpu_clock and local_clock
This adds cpu_clock_ns(cpu), local_clock_ns(), and their coarser
variants. These are monotonic wallclock time sources, rather than the
absolute time-since-epoch sort. On kernels too old for these functions,
it falls back to stap's gettimeofday.
A kernel supports this only if it has the functions exported, and if it
is deemed new enough to have the patches that make it NMI-safe. See the
comment in timestamp_monotonic.stp for details.
* buildrun.cxx: Add export checks for cpu_clock and local_clock.
* tapset/timestamp_monotonic.stp: Define the new functions.
* testsuite/buildok/timestamp_monotonic-embedded.stp: Build them.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Include the new docs.
Dave Brolley [Tue, 16 Aug 2011 21:24:04 +0000 (17:24 -0400)]
Testsuite Improvements.
Previously, server.log and the server certificates were cleared each
time a server was started. Clearing them once per test run instead
allows the log of all servers started during testing to be examined
after the tests are finished. It also ensures that the same server
certificates are used by all servers started during testing.
'yes': Automatically download debuginfo - no timeout.
Also, if no value is given to the option, it
is the same as this.
'no': Do not automatically download debuginfo. Also
if the option is not specified at all, it
defaults to this.
'ask': Show output from abrt, including file size of
needed debuginfo, and make it wait for user
input before downloading.
'<number>' A positive number, in seconds, to represent
the timeout to use when downloading. If the
download takes longer than this, it will
abort the download.
**NOTE** Due to a few bugs in abrt, both the 'ask' feature
and the 'timeout' feature will not work properly. In terms
of the 'ask feature (BZ726192), it will ask the user, but
abrt then assumes 'yes' right away and continues the
download. When this is fixed in abrt, stap should function
properly. In terms of the timeout feature (BZ730107), stap
does stop if a timeout occurs, but the download process
continues to completion.
Mark Wielaard [Tue, 16 Aug 2011 15:37:27 +0000 (17:37 +0200)]
warn_overflow.exp: Add -DMAXSKIPPED=9999 to prevent false failures.
The syscall.* probe handlers try to overflow the cmd message buffers
which might take some time, so add -DMAXSKIPPED=9999 to not error
out because some probes take too long.
Mark Wielaard [Tue, 16 Aug 2011 12:31:29 +0000 (14:31 +0200)]
Reintroduce timer for transport cmd channel, don't wake_up unconditionally.
Revert parts of commit a85c8a "runtime/io.c: Explicitly signal setting of
_stp_exit_flag" and commit 46ac9e "Remove _stp_ctl_work_timer from module
transport layer". Introduce a new test wake_up.exp that shows a deadlock
when sending cmd messages and waking up the reader immediately.
Renamed _stp_ctl_write to _stp_ctl_send, which can be called from
everywhere. Rename _stp_ctl_send to _stp_ctl_send_notify that can be
called from user context in the transport layer itself (this will
immediately notify any readers). Document all places that use
_stp_ctl_send_notify directly to clarify why that is safe.
See http://sourceware.org/ml/systemtap/2011-q3/msg00163.html
Josh Stone [Tue, 16 Aug 2011 00:30:17 +0000 (17:30 -0700)]
Add a compat #define FIELD_SIZEOF
This was added in kernel 2.6.18. RHEL4 backported this definition, but
it was reported missing in another enterprise distro. It's an easy
one-line definition to add for compatibility though.
Mark Wielaard [Sun, 14 Aug 2011 21:07:46 +0000 (23:07 +0200)]
Implement and use select to wait for cmd channel data.
Add a poll implementation to runtime/transport/control.c
(_stp_ctl_poll_cmd) based on the _stp_ctl_ready_q wait queue.
Check whether select is supported in runtime/staprun/mainloop.c
(stp_main_loop) and use pselect with a sigmask that includes
SIGURG to get EINTR notifications whenever an interruptable
event occurred.
Mark Wielaard [Fri, 12 Aug 2011 17:34:20 +0000 (19:34 +0200)]
Remove _stp_ctl_work_timer from module transport layer.
The _stp_ctl_work_timer would trigger every 20ms to check whether
there were cmd messages queued, but not announced yet and to
check the _stp_exit_flag was set.
This commit makes all control messages announce themselves and
check the _stp_exit_flag in the _stp_ctl_read_cmd loop (delivery
is still possibly delayed since the messages are just pushed on
a wait queue).
Josh Stone [Thu, 11 Aug 2011 21:30:05 +0000 (14:30 -0700)]
Fix the uprobes.ko path when used with remotes
When uprobes.ko is sent through stapsh, it will go in a temp path that
only stapsh knows. However, we were sending -u/path/to/uprobes.ko with
a client side path, which would only work for --remote localhost. :/
Now the path is sanitized to ./ for the stapsh working directory.
* buildrun.cxx (make_run_command): Take a remotedir instead of a module
name. When set, use it to normalize both the uprobes and module path.
Also check versions that a uprobes path is even supported (>=1.4).
* remote.cxx (stapsh::start): The remotedir is simply "." for stapsh.
(ssh_legacy_remote:start): The remotedir is the known from the prior
mktemp -d. Also start sending the module signature across, add a note
why we unfortunately can't send uprobes in legacy mode, and specify
the staprun command without any path in case the remote is different.
Mark Wielaard [Thu, 11 Aug 2011 16:53:01 +0000 (18:53 +0200)]
Be more explicit about when the session needs symbol data. pragma:symbols.
Introduce /* pragma:symbols */ which is added to those tapset functions
that use print_addr or print_stack with symbol resolving. Now we no longer
have to output the symbol tables at translate time if unnecessary.
Although we could do even less work (see the new comment in translate.cxx).
Mark Wielaard [Thu, 11 Aug 2011 10:34:01 +0000 (12:34 +0200)]
Only collect and emit unwind data in translator if the session needs it.
When we hit the translator the session already knows whether or not it
will possibly need the unwind data. Only collect and emit it, if the
session does. This can save writing out tens of MB to stap-symbols.h
for simple scripts that never call any backtrace() function.
Chris Meek [Thu, 4 Aug 2011 14:11:38 +0000 (10:11 -0400)]
PR12773: Use abrt to download and install debuginfo
dwflpp.cxx
In setup_user(), pass the session to setup_dwfl_user().
setupdwfl.cxx
Added internal_find_debuginfo() and
execute_abrt_action_install_debuginfo_to_abrt_cache() to call
abrt to automatically download and install the needed debuginfo.
setupdwfl.h
Added function declarations.
util.h
Added hex_dump() to convert a binary string to a hex string.
Mark Wielaard [Mon, 8 Aug 2011 09:08:42 +0000 (11:08 +0200)]
sdt*exp: When the compiler doesn't recognize flag, mark test as UNTESTED.
Older gcc compilers don't recognize all the -std=[c|gnu]++0x flags we
throw at them. Instead of marking these compilations as FAIL, mark them
as UNTESTED now, so we only see real FAILures in the result (there are
still a couple left against -pedantic).