David Smith [Fri, 16 Dec 2011 20:32:20 +0000 (14:32 -0600)]
Rename tapset/rpc.stp variable to indicate its internal-only nature.
* tapset/rpc.stp (_sunrpc.clnt.create_client.rpc_new_client_inline):
Rename 'args' to '__args' to indicate that '__args' is an internal-only
variable. Deprecate old name.
* NEWS: Mention 'args' variable deprecation.
* stap.1: Ditto.
Mark Wielaard [Fri, 16 Dec 2011 18:25:32 +0000 (19:25 +0100)]
task_finder_vma.c (__stp_tf_vma_new_entry): No unnecessary atomic allocs.
We can be a little nicer when allocating kernel memory under the
traditional task_finder which uses utrace. See
http://sourceware.org/ml/systemtap/2011-q4/msg00357.html
Mark Wielaard [Fri, 16 Dec 2011 15:59:00 +0000 (16:59 +0100)]
modname/symdata: Try harder to retrieve module name when requested.
When the user really wants a kernel module name with an address and
we are unable to map it to any existing one then fall back on using
__module_text_address() with appropriate locking.
Mark Wielaard [Fri, 16 Dec 2011 15:43:04 +0000 (16:43 +0100)]
_stp_vma_mmap_cb: Also extend mapping that don't overlap but are connected.
If a vma mapping for a module already exist but a new mapping for the module
is added that is connected right at the end of it, then just extend the
existing vma mapping. This fixes the exelib.exp testcase on s390x for PIE
executables.
William Cohen [Thu, 15 Dec 2011 16:27:45 +0000 (11:27 -0500)]
Adjust periodic.stp example to run on kernels without struct delayed_work
RHEL-5 kernels have the timer_expire_entry tracepoint, but do not have
struct delayed_work. Some @defined magic is used to select the
fallback if struct delayed_work is not around.
Dave Brolley [Tue, 13 Dec 2011 21:08:38 +0000 (16:08 -0500)]
PR 13496: stap could show some progress of the communication with the server
- Moved "Using a compile server" message to -v level
- Moved details of automatic server detection to -vv level
- Moved reasons for server acceptance/rejection to -vvv level
- Moved details of clent/server request/response packaging to -vvvv level.
David Smith [Tue, 13 Dec 2011 17:33:38 +0000 (11:33 -0600)]
Add HAVE_TASK_FINDER define to simplify some code.
* runtime/runtime.h: Add HAVE_TASK_FINDER define if we've got any form of
utrace.
* runtime/task_finder.c: Use HAVE_TASK_FINDER to know whether to define
dummy functions.
* runtime/vma.c (_stp_vma_init): Use HAVE_TASK_FINDER define.
Frank Ch. Eigler [Mon, 12 Dec 2011 22:50:59 +0000 (17:50 -0500)]
configury: fix make -j all install
Due to an autoconf weirdness, make -j all install would run make
all-recursive and make install-recursive in parallel, and let the two
builds step on each others' toes.
* Makefile.am (install): Explicitly require all. Recurse by hand.
* Makefile.in: Regenerated.
Mark Wielaard [Mon, 12 Dec 2011 21:52:18 +0000 (22:52 +0100)]
PR13467 Provide alternative testcase for pointer_array.exp.
pointer_array.exp depends on indexing an array from a user pointer in
kernel context. This doesn't work on s390x, which has separate user and
kernel space addresses. kallsyms_expand_symbol.exp decodes the kallsyms
table from kernel space using various array pointer manipulations.
Mark Wielaard [Mon, 12 Dec 2011 14:54:59 +0000 (15:54 +0100)]
Protect just the transport state with _stp_transport_mutex.
_stp_transport_mutex was held over the whole of _stp_handle_start()
and _stp_cleanup_and_exit(). This is unnecessary and dangerous since
some functions that get called could sleep. Add a new state variable
_stp_start_called and protect just that together with _stp_exit_called
to make sure _stp_handle_start() and _stp_cleanup_and_exit() are only
executed once.
Frank Ch. Eigler [Mon, 12 Dec 2011 14:28:23 +0000 (09:28 -0500)]
PR13489: support inode-uprobes without EXPORT_SYMBOL*'s
Until lkml sees fit to EXPORT_SYMBOL* various inode-uprobes related
symbols, we must kludge around this.
* buildrun.cxx (compile_pass): Track export status for
register_uprobe, unregister_uprobe, task_user_regset_view.
* runtime/runtime.h: Declare void* versions if needed.
* runtime/transport/transport.c: kallsyms_lookup_name them if needed.
* runtime/loc2c-runtime.h, runtime/uprobes-inode.c: Use them.
Mark Wielaard [Fri, 9 Dec 2011 14:24:03 +0000 (15:24 +0100)]
Move __stp_tf_vma_map check from commit 972ea1 to stap_find_vma_map_info().
Commit 972ea1 misapplied the check to stap_add_vma_map_info. This can
never be called when the vma tracker hasn't been initialized. But
stap_find_vma_map_info[_user] potentially could be called. And so this
function needs to check that sure__stp_tf_vma_map is initialized.
Mark Wielaard [Fri, 9 Dec 2011 09:46:20 +0000 (10:46 +0100)]
PR11671 Allocate __stp_tf_vma_entry dynamically.
Get rid of TASK_FINDER_VMA_ENTRY_ITEMS and __stp_tf_vma_free_list_items
array list completely. All __stp_tf_vma_entry are allocated dynamically
now. This is possible since stap_add_vma_map_info() is only called
through the task_finder from a user context.
There is no more fixed maximum number of VMA pages that will be tracked
at runtime. This reduces memory use for those scripts that don't need any,
or only limited target process VMA tracking and allows easier system
wide probes inspecting shared library variables and/or user backtraces.
stap will now silently ignore -DTASK_FINDER_VMA_ENTRY_ITEMS.
tracepoints: tolerate kernel event headers without their own #include <linux/tracepoint.h>
include/trace/events/writeback.h lacks this, which means that
systemtap tracepoint _aux.o files fail to build.
* tapsets.cxx (tracepoint_derived_probe_group::emit_module_decls): Generously
offer to emit the possibly missing #include <...> into the FOO_aux_N.c file.
Mark Wielaard [Thu, 8 Dec 2011 16:09:55 +0000 (17:09 +0100)]
Introduce stap_destroy_vma_map and allocate vma free at vma init time.
We don't keep a static __stp_tf_vma_free_list_items anymore, but allocate
the items once in stap_initialize_vma_map(), which can now return failure
when there isn't enough memory. Make sure to call stap_destroy_vma_map()
when the module is unloaded to clean up.
Chris Meek [Thu, 8 Dec 2011 17:41:00 +0000 (12:41 -0500)]
PR13076: Added time interval to cache cleaning
cache.cxx:
Added a new file to the cache - cache_clean_interval_s - to keep
track of the new cache clean time interval. Now the cache will
only be cleaned when the time since the previous clean is longer
than the interval, rather than every time a new entry is added
to the cache. The default interval is 30 sec.
Dave Brolley [Tue, 6 Dec 2011 21:32:26 +0000 (16:32 -0500)]
staprun: User privilege checking in restricted environments.
- Make sure staprun builds with all combinations of HAVE_ELF and
HAVE_ELF_GETSHDRSTRNDX.
- When HAVE_ELF_GETSHDRSTRNDX is not defined, we must assume the
highest required privilege level for signed modules (stapsys).
Josh Stone [Mon, 5 Dec 2011 21:04:19 +0000 (13:04 -0800)]
tapset: Make addr_to_node ignore !NODE_DATA(nid)
In the block added for RHEL4 compatibility, there was even a comment
indicating that we'd like to skip nodes that aren't online. We can't
make that check due to missing an EXPORT for node_online_map, but
checking for a non-NULL pointer for NODE_DATA(nid) gets approximately
the same result.
* session.cxx (parse_cmdline): Parse it.
(usage): Note it.
* session.h (modinfos): Store it.
* hash.cxx (find_script_hash): Mix it.
* translate.cxx (translate_pass): Use it.
* testsuite/systemtap.base/modinfo.exp: Lightly test it.
* NEWS, stap.1: Document it.
Mark Wielaard [Thu, 1 Dec 2011 19:26:19 +0000 (20:26 +0100)]
_stp_get_mm_counter: Fix kernel version check.
The kernel version check was wrong in two ways. First it tested against
kernel_v >= "3.1.0" but linux commit 172703 "mm: delete non-atomic mm
counter implementation" was actually integrated for 3.0. But fedora
names their 3.0 kernels 2.6.40 (and 3.1 kernels 2.6.41, depending on
release). So change the test to kernel_v >= "2.6.40".
The reason this wasn't found earlier was that there is another check
for CONFIG_NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS which is almost always
true (but not on arm tegra kernels).
Mark Wielaard [Thu, 1 Dec 2011 19:22:51 +0000 (20:22 +0100)]
systemtap.examples/check.exp: Don't try running tests that failed to build.
Just mark them UNTESTED if the build phase FAILed. This also saves time
since the run phase will try to build the testcase again (and will always
FAIL doing that).
David Smith [Thu, 1 Dec 2011 17:49:41 +0000 (11:49 -0600)]
Fix the dtrace_clone.exp test to properly test with/without semaphores.
* testsuite/systemtap.clone/dtrace_clone.exp: Use the correct #define to
get rid of the semaphores.
* testsuite/systemtap.clone/dtrace_clone.c: Be sure to ifdef out all the
semaphores.
Mark Wielaard [Thu, 1 Dec 2011 11:05:35 +0000 (12:05 +0100)]
Document some new features and improvements since systemtap 1.6.
task_backtrace removed, MAXBACKTRACE documented, new probe_type() function,
unwind and symbol data only processed when really necesessary, kernel
backtraces for non-pt_regs probe context (timer and tracepoints),
ubacktrace() from kernel probe points, s390x user space support, ppc,
s390x and arm dwarf unwinder support, arm uprobes port.
PR13306 asked for a way to skip handlers when probe alias prefixes
fail. This implementation is a little bigger hammer, but believed
to be more generally useful.
* session.cxx: Initialize/copy/getopt new option.
* session.h: Store it.
* hash.cxx (find_script_hash): Mix it in.
* tapsets.cxx (common_probe_entryfn_epilogue): Skip various
MAXERRORS/MAXSKIPPED processing when flag is set.
* tapset.h (common_probe_entryfn_epilogue): Drop middle default
argument since it got confusing. Add new argument.
* tapsets*.cxx (*::emit_module_decls): Update ..._epilogue callers.
Mark Wielaard [Wed, 30 Nov 2011 13:02:27 +0000 (14:02 +0100)]
nd_syscalls.stp: Probe sys_accept4 for kernel 2.6.28+.
Since 2.6.28 sys_accept is chained through sys_accept4. Probe
sys_accept4 only for newer kernels to not miss some accept
syscalls. Don't probe both or we will get double hits.
Frank Ch. Eigler [Tue, 29 Nov 2011 22:23:29 +0000 (17:23 -0500)]
testsuite: xfail->kfail buildok failures
Use kfail to designate problems that represent unfixable issues such
as compiler limitations (debuginfo missing from here or there).
xfail is inappropriate, as we use this to designate failures we
want to see, e.g., the detection of deliberate input errors.
* lib/stap_buildok.exp: Removed, inlined back into
* systemtap.pass1-4/buildok.exp: Pull switch code in here. Use kfail*.
* systemtap.exelib/pthreadprobes.exp: Don't look at buildok_known_failures,
which didn't have any pthread awareness anyway.
David Smith [Tue, 29 Nov 2011 21:52:13 +0000 (15:52 -0600)]
Added individual tests for function.call and function.return probes.
* testsuite/systemtap.base/uprobes.exp: Added sub-tests that check .call
and .return probes individually.
* testsuite/systemtap.base/uprobes_call.stp: New file.
* testsuite/systemtap.base/uprobes_return.stp: New file.
Frank Ch. Eigler [Tue, 29 Nov 2011 21:29:09 +0000 (16:29 -0500)]
PR13458: laugh in the face of xslt
Using a dozen-line xslt script, one can sort the generated tapsets.xml
documentation's reference sections. Thank you interwebs:
http://stackoverflow.com/questions/572854/how-to-sort-a-subelement-of-xml-with-xslt
http://www.w3schools.com/xpath/xpath_syntax.asp
William Cohen [Tue, 29 Nov 2011 20:38:11 +0000 (15:38 -0500)]
Mark buildok/memory-write_shared_copy.stp as KFAIL when it fails
Kernels built with older versions of gcc do not have the needed argument
information for inlined functions. vm.write_shared_copy probes inlined
functions and suffers from PR1155 in this situation. This patch marks
it as a KFAIL with a mention of PR1155 when it fails.
Mark Wielaard [Tue, 29 Nov 2011 16:53:35 +0000 (17:53 +0100)]
Make cast-scope testcase more robust. Prevent line-reordening.
Setting a statement line probe is somewhat fragile since different GCCs
output different line tables. Make sure that there is a known single
statement line in the testcase to probe.
Mark Wielaard [Tue, 29 Nov 2011 11:32:05 +0000 (12:32 +0100)]
Support fallback kernel dump_stack() with or without bp argument.
There has been some flip-flopping in the kernel whether or not dump_stack()
takes a bp argument. We now support either with or without.
See linux commits v2.6.36-9872-g9c0729d and v2.6.38-793-ge8e999c.
Mark Wielaard [Tue, 29 Nov 2011 11:32:05 +0000 (12:32 +0100)]
Support fallback kernel dump_stack() with or without bp argument.
There has been some flip-flopping in the kernel whether or not dump_stack()
takes a bp argument. We now support either with or without.
See linux commits v2.6.36-9872-g9c0729d and v2.6.38-793-ge8e999c.
Josh Stone [Mon, 28 Nov 2011 21:06:15 +0000 (13:06 -0800)]
PR13440: Use real userspace addresses in @cast tests
Some architectures make a harder distinction between user/kernel
addresses, so we shouldn't be faking our user memory.
* testsuite/systemtap.base/cast.*: Remove userspace @cast.
* testsuite/systemtap.base/cast-user.*: Add a new test for userspace
@casts with an honest userspace address.
Josh Stone [Mon, 28 Nov 2011 21:02:16 +0000 (13:02 -0800)]
PR13354: Add a type cast to satisfy old compilers
RHEL4-era gcc tried to make "fake_remote?-1:i" unsigned (as 'i' is), and
then complained about making -1 unsigned. Since remote::create just
wants an int anyway, cast "i" in the ternary.