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.
Josh Stone [Thu, 19 Apr 2012 21:11:00 +0000 (14:11 -0700)]
PR13998: pretty-print bit fields numerically
When a struct member has bit attributes, we should always pretty-print
it as a number, even if the underlying type is a character. Since these
attributes only show up in DWARF on the member, not the type die, we
need to treat it as a special case from the struct member iteration.
* tapsets.cxx (dwarf_pretty_print::recurse_bitfield): Print the incoming
type numerically, regardless of whether it's a char.
(dwarf_pretty_print::recurse_struct_members): If a member has a
bit_offset attribute, use recurse_bitfield instead of normal recurse.
* testsuite/systemtap.printf/pretty-bits.*: Test how bitfields are
pretty-printed, both for ints and chars underneath.
PR13992: let stap tolerate -d /foo/bad/path --ldd argument
* translate.cxx (add_unwindsym_ldd): Skip unresolvable path that
results in skeleton dwflpp. We'll get a warning later.
* testsuite/transok/eleven.stp: New test case.
Dave Brolley [Tue, 17 Apr 2012 19:16:47 +0000 (15:16 -0400)]
BZ 813323: stapusr-only users no longer able to run unsigned modules in /lib/modules/`uname -r`/systemtap
- Elevate the user's privilege level to stapdev when the module is loaded from
/lib/modules/`uname -r`/systemtap.
- Suppress error messages about failure to verify the module's signature
when a signature is not required.
Josh Stone [Thu, 12 Apr 2012 19:59:50 +0000 (12:59 -0700)]
Synchronize class/struct declarations
We are not very consistent about choosing struct vs class types, and in
some cases we have a mismatch between declaration and definition of a
given type. Gcc doesn't care, but clang -Wall complains:
CXX stap-main.o
In file included from ../main.cxx:12:
../staptree.h:489:1: error: struct 'vardecl' was previously declared
as a class [-Werror,-Wmismatched-tags]
struct vardecl: public symboldecl
^~~~~~
class
../staptree.h:218:7: note: previous use is here
class vardecl;
^
In all cases, I left the definition alone, and adjusted the declaration
to match, so it should be semantically unchanged.
Josh Stone [Thu, 12 Apr 2012 19:51:24 +0000 (12:51 -0700)]
sdt_query: initialize probe_type/loc as unknown.
The fields, probe_type and probe_loc, are meaningless to start, and are
later set as the queried module is examined. Commit 74fe61bc tried to
make sure that all POD types in this class are initialized, but these
two were essentially self-assigned. Gcc misses this uninitialized use,
but clang caught it:
CXX stap-tapsets.o
../tapsets.cxx:6058:38: error: field is uninitialized when used here [-Werror,-Wuninitialized]
base_query(dw, params), probe_type(probe_type), probe_loc(probe_loc), base_probe(base_probe),
^
../tapsets.cxx:6058:61: error: field is uninitialized when used here [-Werror,-Wuninitialized]
base_query(dw, params), probe_type(probe_type), probe_loc(probe_loc), base_probe(base_probe),
^
Values for "unknown" are now added to these enum types to initialize
with, and dealt with where needed.
Josh Stone [Thu, 12 Apr 2012 19:35:25 +0000 (12:35 -0700)]
dwflpp: Mark loc2c_error as noreturn
Clang complains thusly:
../dwflpp.cxx:2281:15: error: no matching function for call to
'c_translate_constant'
*tail = c_translate_constant (pool, &loc2c_error, this,
^~~~~~~~~~~~~~~~~~~~
In file included from ../dwflpp.cxx:54:
../loc2c.h:46:18: note: candidate function not viable: no known
conversion from 'void (*)(void *, const char *, ...)' to
'void (*)(void *, const char *, ...) __attribute__((noreturn))'
for 2nd argument
struct location *c_translate_constant (struct obstack *,
^
The declaration for loc2c_error just needs the matching attribute.
Josh Stone [Thu, 12 Apr 2012 19:26:41 +0000 (12:26 -0700)]
csclient: check directly for negative IPv4 pieces
As noted by clang, the code was looking for negative values of an
unsigned variable (which was read by strtoul).
CXX stap-csclient.o
../csclient.cxx:2638:44: error: comparison of unsigned expression < 0
is always false [-Werror,-Wtautological-compare]
if (errno != 0 || *estr != '\0' || p < 0 || p > 255)
~ ^ ~
This can never be negative, but strtoul will implicitly case negative-
looking strings to unsigned, which will make them fail p > 255 anyway.
But to be more direct, switch to [signed] long and use strtol.
Dave Brolley [Tue, 10 Apr 2012 18:14:24 +0000 (14:14 -0400)]
Don't compile csclient.cxx and cscommon.cxx when HAVE_NSS is false.
- Don't compile the files at all (Makefile.am)
- #if HAVE_NSS added to the files in case another distro compiles
them anyway.
- Don't call functions in these files from elsewhere.
David Smith [Thu, 5 Apr 2012 19:27:51 +0000 (14:27 -0500)]
Added meta file for nfsdtop.stp and regenerated example index files.
* testsuite/systemtap.examples/network/nfsdtop.meta: New file.
* testsuite/systemtap.examples/network/nfsdtop.stp: Made executable and
added '#! /usr/bin/env stap' line at the top.
* testsuite/systemtap.examples/index.html: Regenerated.
* testsuite/systemtap.examples/index.txt: Ditto.
* testsuite/systemtap.examples/keyword-index.html: Ditto.
* testsuite/systemtap.examples/keyword-index.txt: Ditto.
David Smith [Wed, 4 Apr 2012 20:50:29 +0000 (15:50 -0500)]
Fix module build problem on ARM.
* runtime/vma.c (_stp_vma_match_vdso): Call __access_process_vm_noflush()
instead of __access_process_vm(). When reading user memory, the
__access_process_vm_noflush() and __access_process_vm() functions are
fairly equivalent and we're only reading here. (The write side of
__access_process_vm() calls non-exported functions on ia64, mips,
and arm.)
* runtime/sym.c (_stp_build_id_check): Ditto.
David Smith [Mon, 2 Apr 2012 19:24:21 +0000 (14:24 -0500)]
Fix module build problem on RHEL5 ia64.
* runtime/sym.c (_stp_build_id_check): Only call __access_process_vm()
when we're not using in-kernel utrace. On RHEL5 ia64 calling
__access_process_vm() doesn't work since it ends up calling
flush_icache_range(), which isn't exported.
* runtime/vma.c (_stp_vma_match_vdso): Ditto.
David Smith [Thu, 29 Mar 2012 20:31:33 +0000 (15:31 -0500)]
Fix stapiu cleanup to not hold rcu lock while decrementing semaphores.
* runtime/uprobes-inode.c (stapiu_decrement_process_semaphores): Unlock
rcu while writing semaphores. Otherwise we're atomic and we can't be in
atomic context while writing semaphores.
Wade Farnsworth [Wed, 28 Mar 2012 14:47:06 +0000 (07:47 -0700)]
Update sdt_misc.exp testcase for ARM
* Omit -m64 switch for wildcard tests, as ARM does not implement this
switch
* Mark a subset of the V1 and V2 tests as XFAIL, as they are known to fail
due to broken operand parsing on ARM. Note that this brokenness does
not affect V3.
David Smith [Fri, 23 Mar 2012 20:52:01 +0000 (15:52 -0500)]
Improve build-id checking when the task we're interested in isn't 'current'.
* translate.cxx (emit_module_init): Moved include files to
runtime/runtime.h.
* runtime/runtime.h: Moved includes here from translate.cxx. Rearranged
order a bit, to allow use of __access_process_vm() earlier.
* runtime/sym.c (_stp_build_id_check): Instead of passing in a flag to
indicate build-id checking a user module, instead pass a task_struct
pointer in. If the task_struct pointer isn't 'current', use
__access_process_vm() to read data.
(_stp_module_check): Update _stp_build_id_check() call.
(_stp_kmodule_check): Ditto.
(_stp_usermodule_check): Ditto.
* runtime/vma.c (_stp_vma_match_vdso): If the task we're trying to match
isn't 'current', use __access_process_vm() to read data.
Frank Ch. Eigler [Wed, 21 Mar 2012 01:02:19 +0000 (21:02 -0400)]
PR13876: avoid miscompilation of duplicated tapset function
It was found that the translator got confused if the same function was
defined by the tapset and the end-user script. The same problem can
also afflict global variables. Along the way, clean up error
formatting.
* staptree.h (semantic_error): Drop msg2 field, which was only ever
used for the perfunctory string "vs".
* elaborate.cxx (semantic_pass_symbols): Perform duplicate
global-variable & function testing and rejection.
(symresolution_info::find_function): Print an extra warning for
the case of mismatched function callee/caller arities.
(derive_probes): Prepare chained "while resolving
probe point" semantic_error instead of msg2 based additions.
* session.cxx (register_library_aliases): Ditto.
(print_error): Adjust to loss of msg2. Print tok1 / tok2
and source-context in a more readable way.
* tapsets.cxx (visit_target_symbol_context): Use const semantic_error*
temps to adjust to chaining changes.
* testsuite/systemtap.base/statement.exp: Adjust to changed error message.
* translate.cxx (*): Adjust to loss of semantic_error msg2.