David Smith [Thu, 31 May 2012 20:19:01 +0000 (15:19 -0500)]
Give better errors when the kernel won't support the task_finder.
* runtime/runtime.h: Only include task_finder.c if the kernel supports it.
* runtime/vma.c: Surround code that needs the task_finder with '#ifdef
HAVE_TASK_FINDER'.
* runtime/task_finder.c: If we don't have the prerequisites for the
task_finder, give an error instead of silently defining dummy
functions.
Chris Meek [Thu, 31 May 2012 18:19:04 +0000 (14:19 -0400)]
PR13667: Hardcoded netfilter constants, cleaned up
Since certain older versions of the kernel do not define some
netfilter constants, we had to hardcode all the values
so that it would compile on those older kernels (i.e. RHEL 4 and 5).
This is OK, since we were only including the netfilter_* headers
to map the constants to their equivalent values.
Serguei Makarov [Fri, 25 May 2012 18:57:58 +0000 (14:57 -0400)]
PR14146: adapted manpager.sh to produce passable tapset::* manpages.
The resulting manpages can act as 'very succinct' (read: utterly
bare-bones) tables of contents listing documented functions and probes,
and referring the user to probe::* and function::* manpages generated by
the 'robust' (read: hideously complicated and slow, but very reliable)
DocBook toolchain.
manpager.sh is currently not hooked up to the build sequence, pending
delivery of a fresh supply of fingers to cross in hope that everything
works as advertised.
Frank Ch. Eigler [Fri, 25 May 2012 16:04:04 +0000 (12:04 -0400)]
PR14168: sanitize $PATH for kbuild invocation
* buildrun.cxx (make_any_make_cmd): Use env(1) to unset and change
some environment variables, particularly $PATH.
(run_make_cmd): Don't unsetenv here for the stap process any more.
* testsuite/systemtap.base/kbuildenv.exp: Test it.
* NEWS: Mention it.
Frederic Turgis [Thu, 24 May 2012 01:21:06 +0000 (21:21 -0400)]
Allow tuning of reader thread ppoll timeout value
Default value of 200ms causes too many wake-ups for embedded platforms
low power use-cases. Timeout of several seconds is expected on these.
New option is -T x where x is timeout in ms.
* runtime/staprun/common.c (parse_args): Parse -T option.
(usage): Mention it.
* runtime/staprun/relay.c (reader_thread): Use -T value to override default
polling interval.
* runtime/staprun/staprun.8: Document it.
translate.cxx may model duplicate probe handlers by changing multiple
*_derived_probe ->name's to the same string, which upsets
tapset-netfilter.cxx code generation. Use an index for the contexts
where required.
* tapset-netfilter.cxx (netfilter_derived_probe ctor): Assign unique
nf_filter index.
(emit_module_decls, emit_module_init, emit_module_exit): Use when
appropriate.
Serguei Makarov [Wed, 23 May 2012 15:22:26 +0000 (11:22 -0400)]
Added section describing netfilter probes to stapprobes.3stap.
Note that the link to tapset::netfilter (3stap) is currently broken.
That man page is waiting on a fix for PR14146. If that bug gets delayed
indefinitely, it may be necessary to delete the reference for the time
being, and refer people to the Tapset Reference document instead.
Serguei Makarov [Tue, 22 May 2012 18:20:21 +0000 (14:20 -0400)]
Initial version of improved tapset for netfilters.
This tapset exposes the ability to track IPv4 network packets using the
netfilter hooks mechanism. Support for IPv6 is still very patchy, and
support for other protocols (ARP, bridge) is basically nonexistent.
Mark Wielaard [Mon, 21 May 2012 10:57:41 +0000 (12:57 +0200)]
Add testcase for PR14107 Bad user unwinding from kernel fatal signal handler.
This is really a kernel bug, see bug report, when the CFI for the assembly
code is missing we cannot properly recover the register state for the user
process and might give a bad/missing user backtrace.
Chris Meek [Fri, 18 May 2012 18:54:34 +0000 (14:54 -0400)]
PR13667: Fixed guru mode hook-not-defined bug
Before, when in guru mode, it would pass the hook/priority
strings across without checking/converting them to numbers. This
caused a bug where perfectly legal strings (such as NF_IP_PRE_ROUTING)
would be unrecognized in the generated code since their definitions
are not available in kernel space.
Now, it checks/converts all the strings to numbers whether in guru
mode or not, but only complains about mismatches if not in guru mode.
If in guru mode, it will still pass the initial string across if it
doesn't match anything else.
Chris Meek [Wed, 16 May 2012 20:52:35 +0000 (16:52 -0400)]
PR13667: Range checking for hooks and priorities
- Added more strict range checking for hook names
- Added support for arp and bridge netfilter hooks
- Added range checking of priority strings for ipv4
and ipv6 hooks, numerical checking for all
Mark Wielaard [Mon, 14 May 2012 10:39:10 +0000 (12:39 +0200)]
plt.exp: Don't count unreliable plt invocations.
Depending on gcc version and glibc used plt calls to malloc, free and
__cxa_finalize differ too much (or are just optimized away completely)
to rely on them in the test. Just take them out.
David Smith [Thu, 10 May 2012 20:04:17 +0000 (15:04 -0500)]
Update bz6503.exp testcase.
* testsuite/systemtap.base/bz6503.exp: Make the test work by non-root
users. Also add fat/vfat modules as suggested in BZ820487.
* testsuite/systemtap.base/bz6503.stp: Add fat/vfat modules as
alternatives as suggested in BZ820487.
David Smith [Tue, 8 May 2012 21:07:08 +0000 (16:07 -0500)]
Give good error messages for inodes uprobes registration errors.
* translate.cxx (c_unparser::emit_module_init): Only print an error if
'probe_point' isn't NULL.
* tapsets.cxx (uprobe_derived_probe_group::emit_module_inode_init): Let
stapiu_init() handle reporting errors by setting 'probe_point' to NULL.
* runtime/uprobes-inode.c (stapiu_get): Print errors when needed.
(stapiu_reg): Ditto.
Nitin A Kamble [Tue, 8 May 2012 18:13:49 +0000 (14:13 -0400)]
configury: automake 1.12 as deprecated automatic de-ANSI-fication support
Fix this issue with automake 1.12:
| configure.ac:23: error: automatic de-ANSI-fication support has been removed
[fche:] Note that the systemtap git repository and source releases include
autoconf- and automake-generated files, so this is only an issue for those
who have an unusual reason to regenerate them.
Signed-Off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Mark Wielaard [Tue, 8 May 2012 17:59:07 +0000 (19:59 +0200)]
PR14079 - caller() pass-4 error if no uretprobes in script
caller() is odd in that it tries to do both kernel and user caller.
There is no ucaller(). Move it into its own tapset and include the
right uprobes related structures.
* runtime/uprobes-inc.h: New include file to be included in ...
* runtime/stack.c: here and ...
* tapset/context-caller.stp: here. New tapset, with just the caller context
function, removed from ...
* tapset/context-unwind.stp: here.
* doc/SystemTap_Tapset_Reference/tapsets.tmpl: Also include context-caller.stp.
David Smith [Mon, 7 May 2012 21:40:38 +0000 (16:40 -0500)]
Improve the case-scope testcase output handling.
* testsuite/systemtap.base/cast-scope.stp: Print the probe strings in a
defined order (since the process.function and process.mark probes can
end up at the same address).
Mark Wielaard [Mon, 7 May 2012 08:20:21 +0000 (10:20 +0200)]
Cleanups and fixes for DWARF unwinder.
Add explict comments and set_*_rule functions for different states.
Do data alignment in processCFI, not afterwards in unwind_frame.
Remove unnecessary UNW_DEFAULT_RA. Make unwind_item state union
explicit about (unsigned) reg versus (signed) offset. Same for
unwind_reg_state cfa.
We now use tapset-mark.cxx style script/probe locals for incoming and
outgoing parameters. These are written/read during the probe prologue
function, and specially marked to prevent optimization/elision.
respond to pending_interrupts during sub-make sequence
* buildrun.cxx (run_make_cmd): If we already received a ^C as per
pending_interrupts, but some naive caller has tried to run yet
another inferior make, abort without even trying.
Mark Wielaard [Thu, 3 May 2012 19:49:11 +0000 (21:49 +0200)]
PR14057 - ERROR: Your privilege credentials (stapsys) are insufficient...
Initialize user_credentials to pr_unknown in init_staprun and set them
to pr_all when getuid() == 0 in assert_stap_module_permissions or
assert_uprobes_module_permissions.
David Smith [Thu, 3 May 2012 19:20:34 +0000 (14:20 -0500)]
Improved task_finder2 mmap tracking and better task_work cleanup.
* runtime/task_finder2.c (__stp_tf_alloc_task_work): New function.
(__stp_tf_free_task_work): Ditto.
(__stp_tf_cancel_task_work): Ditto.
(__stp_tf_quiesce_worker): Renamed from __stp_task_worker(). Uses
__stp_tf_free_task_work() to free the task_work structure.
(__stp_utrace_task_finder_target_quiesce): Uses
__stp_tf_alloc_task_work() to allocate a task_work structure.
(__stp_tf_mmap_worker): New task_work worker function.
(__stp_utrace_task_finder_target_syscall_exit): If we're in an atomic
context, use task_work_add() to call __stp_tf_mmap_worker().
(stap_stop_task_finder): Call __stp_tf_cancel_task_work() to cancel all
outstanding task work requests.
Mark Wielaard [Wed, 2 May 2012 19:13:30 +0000 (21:13 +0200)]
Fix PR13992 cont. Do iterate_over_modules, just not over libraries.
The original fix for PR13992 (commit 0ce08aa) failed to iterate of any
modules when no executable path was found, which made the exelib.exp
testcase fail. Refixed by iterating of modules, just not over libraries.
David Smith [Wed, 2 May 2012 17:51:13 +0000 (12:51 -0500)]
Removed EXPERIMENTAL_KPROBE_SDT support.
* tapsets.cxx (dwarf_derived_probe_group): Removed 'has_semaphores' member
variable.
(dwarf_derived_probe_group::enroll): Throw an error if we have a
semaphore.
(dwarf_derived_probe_group::emit_module_decls): No longer emit semaphore
support in struct stap_dwarf_probe or include kprobes-common.c.
(dwarf_derived_probe_group::emit_module_init): No longer initialize
semaphore info in struct stap_dwarf_probe.
(dwarf_derived_probe_group::emit_module_exit): No longer decrement
semaphores on module exit.
(sdt_query::have_kprobe): Remove kprobe2_type support.
(sdt_query::handle_probe_entry): Ditto.
(sdt_query::iterate_over_probe_entries): Ditto.
(sdt_query::convert_location): Ditto.
* sdt_types.h: Remove KPROBE2_TYPE define and kprobe2_type enum value.
* runtime/kprobes-common.c: Deleted.
* runtime/kprobes-common.h: Removed deleted function declarations.
* scripts/probe_perf/bench.sh: Remove EXPERIMENTAL_KPROBE_SDT test.
* testsuite/sys/sdt.h: Removed EXPERIMENTAL_KPROBE_SDT support.
* testsuite/systemtap.base/sdt.exp: Ditto.
* testsuite/systemtap.base/sdt_misc.exp: Ditto.
David Smith [Fri, 27 Apr 2012 20:43:16 +0000 (15:43 -0500)]
Use new task_work kernel feature to truly stop tasks.
* buildrun.cxx (compile_pass): Add STAPCONF_TASK_WORK_ADD_EXPORTED autoconf.
* runtime/autoconf-utrace-via-ftrace.c (__autoconf_func): Makes sure
<linux/task_work.h> is present and works.
* runtime/autoconf-utrace-via-tracepoints.c (__autoconf_func): Ditto.
* runtime/runtime.h: Added export kludge variables for task_work_add() and
task_work_cancel().
* runtime/stp_utrace.c (utrace_init): If the task_work_* functions aren't
exported, use kallsyms_lookup_name() to find them.
(utrace_cleanup): Cancel work function if necessary.
(utrace_task_alloc): Initialize task work structure.
(utrace_free): Cancel work function if necessary.
(utrace_do_stop): Use task_work_add() functionality to replace
set_notify_resume().
(utrace_stop): Ditto.
(utrace_control): Ditto.
(finish_report): Ditto.
(utrace_resume): Updated to work as task worker function.
* runtime/task_finder2.c (__stp_task_worker): New function.
(__stp_utrace_task_finder_target_quiesce): If we can't sleep, use
task_work_add() to truly stop the task.
* runtime/uprobes-inode.c (stapiu_change_plus): Check build-ids.
David Smith [Tue, 24 Apr 2012 16:04:35 +0000 (11:04 -0500)]
Updated and added syscall testsuite debug scripts.
* testsuite/systemtap.syscall/test-debug.tcl: Updated regexp that looks
for specially formatted comments in the test executable source.
* testsuite/systemtap.syscall/test-debug-cmd.tcl: New script, similar to
test-debug.tcl, but displays the output on the command line (instead of
in its own window).
* testsuite/systemtap.syscall/test-debug-cmd-nd.tcl: New script, similar to
test-debug-cmd.tcl, but used the nd_sycall tapset.
staprun is compiled single-threaded, but recent improvements to
util.cxx made it implicitly pthreads-dependent. Conditionalize
pthread_* calls with #ifndef SINGLE_THREADED throughout.
Josh Stone [Fri, 20 Apr 2012 00:11:14 +0000 (17:11 -0700)]
PR13999: Let "%#c" add escapes for nonprintables
The special '#' flag previously didn't do anything for characters. Now
it signals that non-printable characters should be escaped in the output
string, either using C shortcuts or octal values.
* runtime/vsprintf.c (_stp_vsprint_char_size, _stp_vsprint_char): New
functions to size and fill the buffer, accounting for escape chars.
(_stp_vsnprintf): Use the new char functions.
* translate.cxx (c_unparser::emit_compiled_printfs): Ditto.
* testsuite/systemtap.printf/char2.*: Test %#c
* NEWS, stap.1: Document it.