| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
| |
* runtime/sym.h (_stp_module): add unwind_hdr_addr member.
* runtime/unwind.c (read_ptr_sect): Modification of read_pointer that
also handles offsets from text or "data" sections.
(read_pointer): Use it.
(_stp_search_unwind_hdr): Use read_ptr_sect to calculate values that
are relative to the .eh_frame_hdr section.
(unwind_frame): Search the frame header if this is an eh frame.
* translate.cxx (get_unwind_data): Get the eh_frame_hdr too.
(dump_unwindsyms): Write out eh_frame_hdr stuff.
|
|
|
|
|
|
| |
* access_process_vm (__access_process_vm_noflush): New
* tapsets.cxx (uprobe_derived_probe_group::emit_module_exit): Use it.
* translate.cxx (translate_pass): Declare it.
|
|
|
|
|
|
| |
* translate.cxx (translate_pass): Don't #include <access_blah.>
* tapsets.cxx, tapset-utrace.cxx: Replace __access_process_vm()
calls with get_user() / put_user() respectively.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We already had code in place to try a deref on the requested memory
buffer, but it was missing the static-precision case. Thus, it was
possible to craft an address that would pass the check on the first byte
but would pagefault at the end of the buffer.
While we're at it, we should also be limiting the number of bytes in
such a read, so even legitimately-huge buffers won't chew up kernel
time. I've arbitrarily chosen 1024 as the limit, but we can revisit
that later. (see also PR10490)
TODO: we need a reliable testcase where a starting address is valid but
the end address is bogus. In PR11112, the reproducer was using a huge
precision to run off the heap, but we need something that will
consistently work even with <1024 length.
|
|
|
|
|
| |
* translate.cxx (emit_function): Fixed MAXNESTING test to not allow too
deep recursion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's easily available in kretprobes and uretprobes and is consistent
with the rest of the program state.
* translate.cxx (emit_common_header) : add uretprobe_instance to context.
* tapsets.cxx (common_probe_entryfn_prologue): Initialize ri in
context to 0.
(dwarf_derived_probe_group::emit_module_decls): Change IP to return
address in kretprobes.
(uprobe_derived_probe_group::emit_module_decls): enter_uretprobe_probe:
set ri (uretprobe_instance) in context. Change IP to return
address in uretprobes. Don't emit uprobe include and #define
* runtime/runtime.h : Add includes and #define for uprobes.
* runtime/stack.c (_stp_stack_print, _stp_stack_snprint): Add extra
argument for uretprobe_instance.
* tapset/context-unwind.stp (print_backtrace, backtrace): Pass NULL
for uretprobe_instance to _stp_stack_print.
* tapset/ucontext-unwind.stp (print_ubacktrace, ubacktrace): pass
uretprobe_instance to _stp_stack_print
* testsuite/systemtap.context/uprobe_uaddr.exp : new test for uaddr in
function probes
* testsuite/systemtap.context/uprobe_uaddr.stp : new file
|
|
|
|
|
|
|
| |
This probably means that build-id will not be loaded at all and
happens for example with ARM kernel.
See also: http://sources.redhat.com/ml/systemtap/2009-q4/msg00574.html
|
|
|
|
|
|
|
|
|
|
|
| |
* translate.cxx (emit_common_header): Change type of 'contexts' to an
array of struct context pointers.
(emit_module_init): Allocate a context structure for each possible cpu.
Free each if an error occurs.
(emit_module_exit): Update contexts reference. Free each possible cpu's
context structure.
* tapsets.cxx (common_probe_entryfn_prologue): Use array instead of percpu
data for context structure.
|
| |
|
|
|
|
|
|
|
| |
* runtime/sym.h: Define _stp_need_vma_tracker.
* translate.cxx (emit_symbol_data_done): Output _stp_need_vma_tracker value.
(c_unparser::emit_module_init): If STP_NEED_VMA_TRACKER isn't defined
check _stp_need_vma_tracker to call _stp_sym_init().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 2.6.25, kretprobes can carry a data packet to be filled in an
entry_handler. This patch lets us store our implicitly-saved $target
variables in .return probes in that data area.
* tapset/kretprobe.stp: New get/set functions for kretprobe data.
* translate.cxx (c_unparser::emit_common_header): Add context->pi_longs.
* tapsets.cxx
(dwarf_var_expanding_visitor::visit_target_symbol_saved_return): Switch
between the old and new methods of saving $vars in .return probes.
(dwarf_var_expanding_visitor::gen_mapped_saved_return): The old way.
(dwarf_var_expanding_visitor::gen_kretprobe_saved_return): The new way.
(dwarf_derived_probe::join_group): Don't register paired entry-handlers.
(dwarf_derived_probe::dwarf_derived_probe): Remember saved-var details.
(dwarf_derived_probe_group::emit_module_decls): Output saved-var details.
Also split the kretprobe handler whether we're on entry or return.
(dwarf_derived_probe_group::emit_module_init): Prepare the entry handler.
* testsuite/systemtap.base/kretprobe-vars.stp: Test implicit $var saving.
|
|
|
|
|
|
|
|
|
|
|
|
| |
For scripts with thousands of probes, we save a fair amount of code-gen
time in pass-4 by having the common locking code extracted into shared
functions.
* runtime/probe_lock.h (stp_lock_probe, stp_unlock_probe): New.
* translate.cxx (c_unparser::emit_lock_decls): New, emits a static
const array of locks needed for each probe.
(c_unparser::emit_locks): Just call stp_lock_probe.
(c_unparser::emit_unlocks): Just call stp_unlock_probe.
|
|
|
|
|
|
|
|
|
|
| |
If we leave the number of args unbounded, then an excessively-sized
printf could cause a kernel stack overflow. I've arbitrarily chosen 32
as our new maximum.
* translate.cxx (c_unparser::visit_print_format): Throw if >32 args.
* testsuite/transko/varargs.stp: Assert that 33 args aren't allowed.
* testsuite/transok/varargs.stp: Assert that 32 args are ok.
|
|
|
|
|
| |
* translate.cxx (MAX_UNWIND_TABLE_SIZE): New define.
(dump_unwindsyms): Check debug_len and eh_len against new limit.
|
|
|
|
|
|
|
|
| |
* parse.cxx (parser::parse_symbol): Add sprint[ln] to @hist_* hack.
* runtime/stat-common.c: Replace reprint with new reprint_buf, add more
generic _stp_stat_print_histogram_buf and call it from the older one.
Also correct some formatting issues.
* translate.cxx (c_unparser::visit_print_format): Add sprint case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
unprivileged users.
2009-10-08 Dave Brolley <brolley@redhat.com>
* elaborate.h (emit_unprivileged_assertion): New virtual method of deriv
ed_probe.
(emit_process_owner_assertion): New static method of derived_probe.
(check_unprivileged): New virtual method of derived_probe_builder.
(match_node::unprivileged_ok): Removed.
(match_node::allow_unprivileged): Removed.
(match_node::unprivileged_allowed): Removed.
* elaborate.cxx (translate.h): #include it.
(emit_unprivileged_assertion): New virtual method of derived_probe.
(emit_process_owner_assertion): New static method of derived_probe.
(check_unprivileged): New virtual method of derived_probe_builder.
(match_node::unprivileged_ok): Removed.
(match_node::allow_unprivileged): Removed.
(match_node::unprivileged_allowed): Removed.
(find_and_build): Don't check for unprivileged restrictions here. Call t
he
builder's check_unprivileged method.
(alias_expansion_builder::check_unprivileged): New virtual method.
* tapset-been.cxx (be_derived_probe::emit_unprivileged_assertion): New v
irtual
method.
(be_builder::check_unprivileged): Likewise.
(never_derived_probe::emit_unprivileged_assertion): Likewise.
(never_builder::check_unprivileged): Likewise.
(register_tapset_been): Don't call allow_unprivileged.
* tapset-itrace.cxx (itrace_derived_probe::emit_unprivileged_assertion):
New virtual
method.
(itrace_builder::check_unprivileged): Likewise.
(register_tapset_itrace): Don't call allow_unprivileged.
* tapset-utrace.cxx (utrace_derived_probe::emit_unprivileged_assertion):
New virtual
method.
(utrace_builder::check_unprivileged): Likewise.
(register_tapset_utrace): Don't call allow_unprivileged.
* tapset-timer.cxx (timer_derived_probe::emit_unprivileged_assertion): N
ew virtual
method.
(timer_builder::check_unprivileged): Likewise.
(register_tapset_timers): Don't call allow_unprivileged.
* tapsets.cxx (uprobe_derived_probe::emit_unprivileged_assertion): New v
irtual
method.
(uprobe_builder::check_unprivileged): Likewise.
(register_standard_tapsets): Don't call allow_unprivileged.
(register_statement_variants): Remove unprivileged_ok_p parameter. Don't
call
allow_unprivileged.
(register_function_variants): Likewise.
(register_function_and_statement_variants): Likewise.
(register_patterns): Don't call allow_unprivileged.
* translate.cxx (emit_probe): Call v->emit_unprivileged_assertion.
|
|
|
|
|
|
|
|
|
|
| |
* setupdwfl.h: Introduce DwflPtr.
* setupdwfl.cxx: Cache kernel_dwfl and user_dwfl. Keep track of last used
module strings. Return cached versions if same query used.
* dwflpp.h: Use DwflPtr instead of Dwfl*.
* dwflpp.cxx: Use DwflPtr and don't dwfl_end().
* translate.cxx: Likewise. Run through dwfl_getmodules() with returned
ptr offset.
|
|
|
|
|
|
|
|
|
| |
* setupdwfl.h: Add setup_dwfl_user() and is_user_module().
* setupdwfl.cxx: Likewise.
* dwflpp.cxx (setup_user): Use setup_dwfl_user().
* translate.cxx (emit_symbol_data): Likewise and is_user_module().
* tapsets.cxx (dwarf_cast_expanding_visitor::visit_cast_op):
Use is_user_module().
|
|
|
|
|
|
|
|
|
|
|
| |
* setupdwfl.h: New header file.
* setupdwfl.cxx: New source file containing shared setup_dwfl_kernel() code.
* dwflpp.cxx (dwfl_report_offline_predicate): Removed.
(setup_kernel): Call setup_dwfl_kernel().
* translate.cxx (dwfl_report_offline_predicate2): Remove.
(emit_symbol_data): Call setup_dwfl_kernel().
* Makefile.am (stap_SOURCES): Add setupdwfl.cxx.
* Makefile.in: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* itrace.h (__access_process_vm): Moved from here...
* runtime/access_process_vm.h: New. ...to here.
* translate.cxx (translate_pass): Include access_process_vm.h
* session.h (sdt_semaphore_addr): New.
* tapsets.cxx (sdt_query::record_semaphore): New. Record sdt_semaphore_addr.
(uprobe_derived_probe_group::emit_module_decls): Allow for uprobe guard variable to be set and unset.
(uprobe_derived_probe_group::emit_module_decls): Likewise.
(uprobe_derived_probe_group::emit_module_exit): Likewise.
* tapset-utrace.cxx (utrace_derived_probe_group::emit_probe_decl): Likewise.
(utrace_derived_probe_group::emit_module_decls): Likewise.
(utrace_derived_probe_group::emit_module_exit): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The general approach is to rip out task_finder_tgt's from all over the
place (including the unwindsym vmcbs, and the stap_uprobe_specs), and
instead have a small handful of them: one for all unwindsyms, and one
per abstract probed process (PID or NAME). These are in turn shared
by all new stap_unwind_specs by index.
Before: probe process("./stap").function("*")
-rw-r--r--. 1 fche users 11775283 2009-09-08 20:26 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko
text data bss dec hex filename
445158 8351944 4306472 13103574 c7f1d6 /var/tmp/fche/systemtap/cache/96/stap_96c0479d674db55ec98d8a8750a790e7_7989596.ko
After: (Note how data shrank, though text gained a bit in const-init-data.)
-rw-r--r--. 1 fche users 4021569 2009-09-08 20:27 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko
text data bss dec hex filename
1896511 2192 4324808 6223511 5ef697 /var/tmp/fche/systemtap/cache/e4/stap_e46e88634efd850b1586e81c231c239a_8058419.ko
* tapsets.cxx (uprobe_derived_probe_group): Rewrite emit_module_decls,
and adjust emit_module_init.
* runtime/sym.c (_stp_sym_init): Initialize unwindsyms-shared vmcb.
* runtime/sym.h (_stp_module): Remove *vmcb field.
* translate.cxx (emit_module_init, dump_unwindsyms): Adapt.
* translate.h (assert_0_indent): Flush output before possibly assert-failing.
|
|
|
|
|
|
| |
Save offset of build id relative to _stext instead of absolute
address for kernel and apply relocations at run-time. This fixes
Debian bug #545277 (http://bugs.debian.org/545277).
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
2009-09-03 Dave Brolley <brolley@redhat.com>
* tapsets.cxx (visit_cast_op): Don't disallow unprivileged users.
Annotate synthesized function with /* unprivileged */.
* tapset-utrace.cxx (register_tapset_utrace): Call allow_unprivileged
for process begin and end probes.
* translate.cxx (translate_pass): Generate '#define STP_PRIVILEGED 1'
unless --unprivileged was specified.
* runtime/transport/transport.c: Don't define _stp_unprivileged_user.
* runtime/task_finder.c (__stp_utrace_attach_match_filename): Check
that _stp_uid equals the task euid when STP_PRIVILEGED is not defined.
(stap_start_task_finder): Likewise.
* runtime/staprun/staprun.c (insert_stap_module): Don't generate
module option _stp_unprivileged_user.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We always use lex_cast either to string or from string, so I made that
explicit, and got rid of some string copies in the process. There was
also stringify(), which was redundant to lex_cast<string>.
We also always used lex_cast_hex to string, so that's now hard-coded and
again eliminated a string copy.
For lex_cast_qstring<string>, there's no need to write the streamify the
input, so a specialization now operates directly on the input.
Hopefully this is a bit cleaner, and I do measure it to be a little
faster on scripts with many probes.
|
|
|
|
|
|
|
|
|
|
|
| |
_stp_vscnprintf is only suitable for calls from the script, with slightly
different conventions (64-bit ints/pointers, extra formatting directives).
* runtime/runtime.h (_stp_{dbug,warn,error}): Add __attribute__ format(printf).
* runtime/io.c (_stp_vlog): Ditto. Use vscnprintf().
* runtime/sym.c (_stp_module_check): Remove hexdumping (%.*M) of mismatching
buildids. Switch to _stp_warn from printk (KERN_WARNING).
* translate.cxx, runtime/unwind.c: Numerous print formatting tweaks.
|
|
|
|
|
|
|
|
|
|
| |
The previous name made it easy to misread the purpose of this
field. It is only for matching executable names, not for
shared libraries.
* runtime/task_finder.c (task_finder_target): Rename field.
(*): Adjust.
* tapset-itrace.cxx, tapset-utrace.cxx, tapsets.cxx, translate.cxx: Ditto.
|
|
|
|
|
|
|
| |
* runtime/task_finder.c (non-UTRACE): Return 0 for
stap_start_task_finder.
* translate.cxx (emit_module_init): Let vma tracker
specific to utrace.
|
|
|
|
|
|
|
| |
* translate.cxx (dump_unwindsyms): Decide based on modname[] not
mainfile[] to emit a vmcb.
* runtime/task_finder.c (non-UTRACE): Include dummy stap_{start,stop}_*
functions.
|
|
|
|
|
|
|
|
| |
* translate.cxx (emit_common_header, translate_pass): Use new
recursion_info visitor to calculate appropriate MAXNESTING value for
scripts with or without recursion.
* tapsets.cxx (common_probe_entryfn_prologue): Initialize c->nesting = -1.
* stap.1.in: Clarify MAXNESTING value.
|
|
|
|
|
|
| |
* translate.cxx (emit_common_header): Emit probe locals into
a separate union, not into the locals[] array.
(emit_probe): Adapt.
|
|
|
|
|
| |
* translate.cxx (c_unparser::emit_probe): Unlocks global variables, then
calls _stp_print_flush() (instead of the other way around).
|
|
|
|
|
|
|
|
|
|
|
|
| |
* main.cxx (main): For "-d /path" arguments, enable task finder.
* runtime/sym.h (_stp_module): Add *vmcb member.
* task_finder{.cxx,.h} (emit_vma_callback_probe_decl): Zap.
* tapset-itrace.cxx, tapset-utrace.cxx: Use unwindsyms_modules
instead.
* tapsets.cxx (uprobe::emit_module_decls): Ditto.
* translate.cxx (emit_module_init): Emit task finder registrations
for vmcb's associated with _stp_modules.
(dump_unwindsyms): Associate vmcbs with user-space unwindsyms entries.
|
|
|
|
|
|
|
| |
We were jumping through a few hoops to deal with elfutils < 0.138 that
did not have the _ELFUTILS_PREREQ macro. I've added an always-false
dummy macro to take its place when it doesn't exit. All of the other
"#ifdef _ELFUTILS_PREREQ" ugliness can now go away.
|
|
|
|
|
|
|
|
| |
* translate.cxx (translate_pass): Raise MAXSTRINGLEN to 256 for 32bit arches
and to 512 for 64bit arches.
* testsuite/systemtap.context/backtrace.tcl: Don't set MAXSTRINGLEN.
* testsuite/systemtap.exelib/ustack.tcl: Likewise.
* testsuite/systemtap.string/str_replace.exp: Explicitly set MAXSTRINGLEN.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
cache.cxx
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Rather than just numeric literals, we can now support arbitrary
expressions for the index value. Note that loc2c won't allow this for
noncontiguous arrays, as the access methods need to be statically
computed, but for contiguous arrays and pointers-as-arrays it works
just fine.
* staptree.h (target_symbol::component): Add expression_array_index.
* staptree.cxx (target_symbol::visit_components): New helper.
(target_symbol::assert_no_components): Recognize new array type.
(target_symbol::component::print): Print subexpressions.
(traversing_visitor::visit_target_symbol, visit_cast_op): Visit the
indexing components too.
(varuse_collecting_visitor::visit_target_symbol): Ditto.
(update_visitor::visit_target_symbol, visit_cast_op): Ditto.
* elaborate.cxx (void_statement_reducer::visit_target_symbol): New.
(void_statement_reducer::visit_cast_op): Save indexes too.
* parse.cxx (parser::parse_target_symbol_components): Parse expressions.
* tapsets.cxx (dwarf_var_expanding_visitor::visit_target_symbol): Pass
expression-indexes as parameters (indexN) to the dwarf function.
(dwarf_cast_expanding_visitor::visit_cast_op): Ditto.
(tracepoint_var_expanding_visitor::visit_target_symbol_arg): Ditto.
(sdt_var_expanding_visitor::visit_target_symbol): Visit the new @cast.
* dwflpp.cxx (dwflpp::translate_components): Use THIS->indexN.
* translate.cxx (c_unparser::visit_target_symbol): Correct error msg.
* testsuite/systemtap.base/pointer_array.stp: Use a simple index.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* stap.1.in: Document that -w disables all warning messages.
* dwflpp.cxx (get_module_dwarf): Only output warning when session
suppress_warnings is not set.
* translate.cxx (dump_unwindsyms): Likewise.
(emit_symbol_data_done): Likewise.
* tapsets.cxx (query_module_symtab): Likewise.
(read_from_elf_file): Take systemtap_session, check suppress_warnings
before emitting warning.
(read_from_text_file): Likewise.
(get_symtab): Call read_from_elf_file and read_from_text_file with session.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* dwflpp.cxx (dwflpp ctor): Parametrize for user/kernel modes.
Update callers.
(dwfl_report_offline_predicate): New function. Filter and
abort searches early if possible.
(setup_kernel): Use new predicate.
* dwflpp.h: Corresponding changes.
* tapsets.cxx (dwfl_report_offline_predicate): Remove this shared
implementation.
(dwarf_builder): Turn kern_dw into module_name->dwflpp* map, just
like user_dw.
(get_kern_dw): Adapt.
(dwarf_build_no_more): Adapt.
* tapsets.h: Remove old shared predicate.
* translate.cxx (dwfl_report_offline_predicate2): New function.
Filter and abort searches early if possible.
(emit_symbol_data): Use it.
|
|\| |
|
| |
| |
| |
| |
| |
| | |
* translate.cxx (emit_symbol_data_done): Special case
_stp_kretprobe_trampoline emission for -1, which is invalid
in hex if host width > target width.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For shared libraries (.dynamic sections) we need the eh frame section
address offset. This is the sh_addr if the shared library isn't prelinked
(since the base load address is zero in that case), otherwise it is
the module start address minus the bias (which also works for the
non-prelinked case).
* translate.cxx (get_unwind_data): Adjust eh_addr for module start and
bias if module isn't absolute (has no relocations).
* testsuite/systemtap.exelib/ustack.tcl: Accept all prelink tests.
|
| |
| |
| |
| | |
tagged by /* unprivileged */.
|
|\| |
|
| |
| |
| |
| |
| | |
* translate.cxx (translate_pass): Emit module_parm stuff at the very end.
* testsuite/buildok/null.stp: New test.
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When anything in systemtap_module_init fails, and we return non-zero,
then the module load is aborted. The normal module unload path
(systemtap_module_exit) is not even attempted, so we need to make sure
that all partially-allocated resources are returned.
Our timer callbacks for the gettimeofday subsystem are a classic example
of this error. If we don't unregister the timers before aborting init,
they will later be called and cause a kernel fault.
We also were neglecting to free the percpu context. A memory leak is
less harmful, but that's fixed now too.
|
| |
| |
| |
| | |
* translate.cxx (emit_symbol_data): Use ~0 instead of -1 for big unsigned constant
|