Mark Wielaard [Fri, 9 Sep 2011 21:28:00 +0000 (23:28 +0200)]
Revert "Remove CONFIG_UTRACE check in pass 2 (dwarfbuilder)."
This reverts commit 2fd2c46ca19c8d995d2376ab8ca1d3e62fb6f43e.
<jistone> tsk tsk, mjw is making a liar out of pass-2 / -l
The issue is that pass-2 does not just list the probes,
but also selects which optional probes might trigger.
Mark Wielaard [Fri, 9 Sep 2011 11:46:45 +0000 (13:46 +0200)]
Fix systemtap.examples/process/syscalltimes script and add test.
stap was a little too smart for the script, optimizing out unused
variables and producing WARNINGS/ERRORS for deleted variables.
Make all variable manipulation conditional on their actual usage,
add -w to surpress warnings, add a new option -c 'process' to run
during script invocation and add a meta testcase for the testsuite.
Mark Wielaard [Fri, 9 Sep 2011 07:05:09 +0000 (09:05 +0200)]
Remove CONFIG_UTRACE check in pass 2 (dwarfbuilder).
pass 4 (buildrun) already checks for CONFIG_UTRACE, so remove it from
pass 2 (dwarfbuilder) so scripts containing process() probes can at least
be semantically checked and inspected with stap -l on arches that don't
have utrace yet.
Mark Wielaard [Thu, 8 Sep 2011 15:22:25 +0000 (17:22 +0200)]
Remove commented out and outdated (confusing embedded C) example from SBG.
Just remove so there are no false positives while looking for dangerous
embedded C snippets. The actual example just includes the thread-times.stp
file which is fine.
Chris Meek [Thu, 8 Sep 2011 12:09:51 +0000 (08:09 -0400)]
PR12221: Added the build ids to the script's hash
hash.cxx
Added the build IDs from the session variables's build_ids
vector to the script's hash.
session.h
Added the build_ids vector to the session.
setupdwfl.cxx
Extracted the build IDs in setup_dwfl_kernel and
setup_dwfl_user and added them to the build_ids vector.
Also, rearranged the code for downloading the debuginfo
to facilitate this patch.
Mark Wielaard [Thu, 8 Sep 2011 11:57:21 +0000 (13:57 +0200)]
Rename CONTEXT regflags to probe_flags. Now simply indicates user mode.
Renamed common_probe_context.h regflags to probe_flags, rename constant
from _STP_REGS_USER_FLAG to _STP_PROBE_STATE_USER_MODE and use throughout
tapsets to check whether in user_mode() or not.
I believe this because three variables, arr_struct, primary_colors_var, incomplete_struct_type, has been changed to conditional defined in systemtap.base/sdt_types.c:
Dave Brolley [Tue, 6 Sep 2011 19:48:29 +0000 (15:48 -0400)]
PR11441 - unprivileged mode test suite enhancements.
- Created a script which identifies all embedded C code in our tapset
sources.
- Tests to ensure that calls to each function containing embedded C are
accepted/rejected for unprivileged users, as appropriate.
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).