summaryrefslogtreecommitdiffstats
path: root/runtime/task_finder.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed uninitialized variable error in task_finder.c.David Smith2010-04-131-4/+3
| | | | | * runtime/task_finder.c (__stp_call_mmap_callbacks_with_addr): Avoided uninitialized variable error.
* Sprinkle static to prevent unnecessary inclusionJosh Stone2010-03-181-1/+1
| | | | | | * runtime/stack.c (_stp_stack_print_tsk): Static. (_stp_stack_snprint_tsk): Static. * runtime/task_finder.c (__stp_utrace_task_finder_ops): Static.
* Removed bogus task_finder error message.David Smith2010-01-131-1/+1
| | | | | * runtime/task_finder.c (__stp_utrace_attach): No longer prints bogus error message when utrace_barrier succeeds.
* Fixed compilation on f11.David Smith2009-12-211-0/+1
| | | | * runtime/task_finder.c: Fixed last checkin.
* PR11113 fix. Support new utrace API.David Smith2009-12-211-0/+94
| | | | | | | | | | | | | | | | | | | | * tapset-utrace.cxx (utrace_derived_probe_group::emit_module_decls): Handles new utrace api. * runtime/itrace.c (usr_itrace_report_signal): Ditto. (usr_itrace_report_clone): Ditto. (usr_itrace_report_death): Ditto. * runtime/task_finder.c (__stp_utrace_task_finder_report_clone): Ditto. (__stp_utrace_task_finder_report_exec): Ditto. (__stap_utrace_task_finder_report_death): Ditto. (__stp_utrace_task_finder_target_death): Ditto. (__stp_utrace_task_finder_target_quiesce): Ditto. (__stp_utrace_task_finder_target_syscall_entry): Ditto. (__stp_utrace_task_finder_target_syscall_exit): Ditto. * runtime/uprobes2/uprobes.c (uprobe_report_signal): Ditto. (uprobe_report_quiesce): Ditto. (uprobe_report_exit): Ditto. (uprobe_report_clone): Ditto. (uprobe_report_exec): Ditto.
* Improve some runtime struct layoutsJosh Stone2009-10-191-2/+2
| | | | | | | | | | | | | | Guided by pahole, I've shaved off a few padding bytes here and there. New sizes on x86_64: stap_task_finder_target 192 -> 184 stap_itrace_probe 216 -> 208 stap_utrace_probe 328 -> 312 stap_uprobe_tf 200 -> 192 stap_uprobe_spec 48 -> 40 I only changed field layouts, not types or names, so this should be perfectly safe. (FLW)
* task_finder diagnostics: standardize on STP_DEBUG_PRINTKFrank Ch. Eigler2009-09-081-8/+0
| | | | * io.c (DEBUG_TASK_FINDER_PRINTK): Remove conditional.
* task_finder diagnostics: emit start_task_finder dbug message at end of fn.Frank Ch. Eigler2009-09-081-2/+1
| | | | | | * task_finder.c (stap_start_task_finder): Emit _stp_dbug message at end rather at beginning, so printed utrace-engine attach counts reflect status at end of initialization rather than at beginning.
* Warn if the pid specified by -x does not belong to an unprivileged user.Dave Brolley2009-09-081-1/+1
|
* Use task_euid when STAPCONF_TASK_UID is not defined.Dave Brolley2009-09-031-3/+17
|
* Allow process begin/end probes for unprivileged users.Dave Brolley2009-09-031-0/+23
| | | | | | | | | | | | | | | | | 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.
* cleanup: rename task_finder_target->pathname -> procnameFrank Ch. Eigler2009-08-211-13/+13
| | | | | | | | | | 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.
* PR10228: fix non-utrace building regression - cont'dWenji Huang2009-08-201-1/+1
| | | | | | | * runtime/task_finder.c (non-UTRACE): Return 0 for stap_start_task_finder. * translate.cxx (emit_module_init): Let vma tracker specific to utrace.
* PR10228: fix non-utrace building regressionFrank Ch. Eigler2009-08-191-0/+3
| | | | | | | * 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.
* Fixed cut-and-paste error.David Smith2009-06-021-1/+1
| | | | | * runtime/task_finder.c (__stp_call_mmap_callbacks_for_task): Fixed cut-and-paste error.
* Avoid holding semaphore while making mmap callbacks.David Smith2009-06-011-52/+130
| | | | | | | | | * runtime/task_finder.c (__stp_call_mmap_callbacks_for_task): Grabs the 'mmap_sem' sempaphore. Caches vma information, releases the semaphore, then makes mmap callbacks. (__stp_utrace_task_finder_target_quiesce): Calls __stp_call_mmap_callbacks_for_task() to make mmap callbacks on initial attach to a task.
* Avoid 1 case of holding a semaphore while mmap callbacks are being made.David Smith2009-05-281-57/+75
| | | | | | | | | | * runtime/task_finder.c (__stp_call_mmap_callbacks_with_addr): Renamed from __stp_call_mmap_callbacks_with_vma(). Also added some code from __stp_utrace_task_finder_target_syscall_exit() that locks the 'mmap_sem' semaphore. This avoids holding the semaphore while the mmap callbacks are made. (__stp_utrace_task_finder_target_syscall_exit): Just calls __stp_call_mmap_callbacks_with_addr() in the mmap case.
* Cache and retrieve syscall arguments when needed.David Smith2009-04-241-35/+102
| | | | | | | | | | | | * runtime/task_finder.c (__stp_utrace_task_finder_target_syscall_entry): New function that caches syscall arguments for mmap(), munmap(), and mprotect() for use in __stp_utrace_task_finder_target_syscall_exit(). (__stp_utrace_task_finder_target_syscall_exit): Uses cached syscall argument info when making callbacks. (stap_start_task_finder): Initializes map subsytem for storing syscall argument data. * runtime/task_finder_map.c: New file containing functions to save and retrieve syscall arguments.
* Uses upstream ia64 syscall functions.David Smith2009-04-201-3/+0
| | | | | | | | | | | | | 2009-04-20 David Smith <dsmith@redhat.com> * runtime/syscall.h (syscall_get_nr): Uses upstream version of syscall_get_nr() for ia64. (syscall_get_arguments): Ditto. (in_syscall): New ia64-only function from upstream. (syscall_get_set_args_cb): Ditto. (ia64_syscall_get_set_arguments): Ditto. * runtime/task_finder.c (stap_register_task_finder_target): Removed ia64 register cache.
* Uses <asm/syscall.h> when available.David Smith2009-04-091-42/+14
| | | | | | | | | | | | | | | | | | | | 2009-04-09 David Smith <dsmith@redhat.com> * buildrun.cxx (compile_pass): Compile autoconf test for <asm/syscall.h>. * runtime/autoconf-asm-syscall.c: New "autoconf" test the presence of <asm/syscall.h>. * runtime/syscall.h: If <asm/syscall.h> exists, use it. Otherwise, use our private copy of the functions for each architecture. (syscall_get_nr): Renamed from __stp_user_syscall_nr(). (syscall_get_return_value): Renamed from __stp_user_syscall_return_value(). (syscall_get_arguments): Renamed from __stp_user_syscall_arg(). * runtime/task_finder.c (__stp_utrace_task_finder_target_syscall_exit): Uses new syscall.h functions. * tapset/utrace.stp: Ditto.
* Make new stap_task_finder_targets chain on correct list.Mark Wielaard2009-04-091-1/+1
| | | | | * runtime/task_finder.c (stap_register_task_finder_target): Also check both pathlen are zero.
* Make sure code using the vma tracker compiles again.Mark Wielaard2009-04-081-3/+4
| | | | | | | | * runtime/runtime.h: Include task_finder.c. * runtime/sym.c: Always define task_finder callbacks for usage in tapsets. * runtime/task_finder.c: Define dummy stap_task_finder_target when ! defined(CONFIG_UTRACE). * tapsets.cxx: Never include task_finder.c directly.
* PR 9940. Rearchitected task_finder.c a bit.David Smith2009-04-071-275/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-04-07 David Smith <dsmith@redhat.com> PR 9940. * tapsets.cxx (emit_vma_callback_probe_decl): Initialized new callbacks. (utrace_derived_probe_group::emit_probe_decl): Ditto. (uprobe_derived_probe_group::emit_module_decls): Uses new callback. Makes sure mapping is executable before trying to set a probe in it. (itrace_derived_probe_group::emit_module_init): Calls _stp_sym_init(). (utrace_derived_probe_group::emit_module_init): Ditto. (uprobe_derived_probe_group::emit_module_init): Ditto. * runtime/sym.c: Moved task_finder_vma.c inclusion here from task_finder.c. (_stp_sym_init): New function. (_stp_tf_mmap_cb): New function that replaces _stp_tf_vm_cb. (_stp_tf_munmap_cb): Ditto. * runtime/task_finder.c: Removed task_finder_vma.c inclusion. Split vm_callback into 3 callbacks: mmap_callback, munmap_callback, and mprotect_callback. (stap_register_task_finder_target): Initializes new events variables for the new callbacks. (__STP_TASK_VM_BASE_EVENTS): No longer specifies syscall entry events. (__stp_call_mmap_callbacks): New function. (__stp_call_mmap_callbacks_with_vma): Ditto. (__stp_call_munmap_callbacks): Ditto. (__stp_call_mprotect_callbacks): Ditto. (__stp_call_vm_callbacks): Removed. (__stp_utrace_task_finder_target_quiesce): Calls __stp_call_mmap_callbacks() instead of __stp_call_vm_callbacks(). (__stp_utrace_task_finder_target_syscall_entry): Removed function. (__stp_utrace_task_finder_target_syscall_exit): Reports raw mmap()/mprotect()/munmap() events.
* Make task_finder.c compiler if ! defined (CONFIG_UTRACE).Mark Wielaard2009-04-021-2/+28
| | | | | | | * runtime/task-finder.c: If ! defined (CONFIG_UTRACE) define dummy noop API for sym.c consisting of struct stap_task_finder_target, stap_add_vma_map_info, stap_remove_vma_map_info and stap_find_vma_map_info.
* Merge branch 'master' into pr6866Mark Wielaard2009-04-011-17/+28
|\
| * Revert "PR9940: avoid duplicated calling of uprobes in shared libraries"Frank Ch. Eigler2009-03-241-4/+2
| | | | | | | | | | | | | | | | | | | | This fix caused a regression on fedora. stap -ve 'probe process("/bin/ls").function("main") { log(pp()); } probe process("/lib64/libc.so.6").function("*") { log(pp()); }' \ -c /bin/ls hung (with stapio & ls processes spinning) upon startup.
| * PR 9989 fix.David Smith2009-03-241-13/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-03-24 David Smith <dsmith@redhat.com> PR 9989. * runtime/task_finder.c (stap_utrace_detach): Ignores -EINPROGRESS. (stap_utrace_detach_ops): Ignores errors from stap_utrace_detach(), so that other tasks will get detached from this utrace engine. (__stp_utrace_attach): Better error handling from utrace_barrier(). (__stp_utrace_task_finder_target_quiesce): Ditto.
* | Merge branch 'master' into pr6866Mark Wielaard2009-03-221-0/+6
|\|
| * PR9974: adapt to utrace_connected_engine -> utrace_engineFrank Ch. Eigler2009-03-221-0/+6
| | | | | | | | | | | | Adjusted all headers that #include <linux/utrace.h> to follow with: /* PR9974: Adapt to struct renaming. */
* | Merge branch 'master' into pr6866Mark Wielaard2009-03-201-2/+4
|\|
| * PR9940: avoid duplicated calling of uprobes in shared librariesWenji Huang2009-03-191-2/+4
| | | | | | | | | | | | | | Add map_p argument to __stp_call_vm_callbacks_with_vma to well tune the vma callback. Signed-off-by: Wenji Huang <wenji.huang@oracle.com>
* | Remove __stp_tf_vm_cb from task_finder interface.Mark Wielaard2009-03-191-34/+0
|/ | | | | | * runtime/task_finder.c (__stp_tf_vm_cb): Removed. * tapsets.cxx (utrace_derived_probe_group::emit_module_decls): Output task finder vma callback and hook it.
* Get the canonical path of the main file for comparison at runtime.Mark Wielaard2009-03-171-1/+1
| | | | | | | | | When given directly by the user through -d or in case of the kernel name and path might differ. path should be used for matching. * runtime/sym.h (_stp_module): Add path field. * runtime/task_finder.c (__stp_tf_vm_cb): Use module path to compare vm_path. * translate.cxx (dump_unwindsyms): Output canonical path.
* Move vma module tracking from pr6866 branch to master.Mark Wielaard2009-03-151-6/+16
| | | | | | | | | | | | * tapsets.cxx (utrace_derived_probe_group::emit_module_decls): Always emit vm callback probe for __stp_tf_vm_cb. * runtime/task_finder.c (__stp_tf_vm_cb): Always expose, move _stp_dbug statements under ifdef DEBUG_TASK_FINDER_VMA. Find and record corresponding module when vm_path not NULL. * runtime/task_finder_vma.c (struct __stp_tf_vma_entry): Add _stp_module. (stap_add_vma_map_info): Add _stp_module argument and assign. (__stp_tf_get_vma_entry_addr): New static function to get the __stp_tf_vma_entry given an address.
* Fixed __stp_utrace_attach by always checking for mm.David Smith2009-02-111-5/+4
| | | | | | | 2009-02-11 David Smith <dsmith@redhat.com> * task_finder.c (__stp_utrace_attach): Still checks for mm after checking task's flags for PF_KTHREAD.
* Fixed typo in last change.David Smith2009-02-101-2/+2
| | | | | | | 2009-02-10 David Smith <dsmith@redhat.com> * task_finder.c (stap_utrace_detach_ops): Fixed typo. (__stp_utrace_attach): Ditto.
* Ignores kernel threads (by checking for PF_KTHREAD).David Smith2009-02-101-0/+24
| | | | | | | | | 2009-02-10 David Smith <dsmith@redhat.com> * task_finder.c (stap_utrace_detach): Ignores kernel threads by checking task's flags for PF_KTHREAD. (stap_utrace_detach_ops): Ditto. (__stp_utrace_attach): Ditto.
* Use 'static' as much as possibleJosh Stone2009-01-281-6/+6
| | | | | | | | | | This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results.
* PR 9673. Only use one utrace engine for all targets with same path or pid.David Smith2009-01-201-155/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-01-20 David Smith <dsmith@redhat.com> PR 9673. * task_finder.c (struct stap_task_finder_target): Added 'vm_events' field. (stap_register_task_finder_target): Sets vm_events if a vm_callback is present. (__stp_task_finder_cleanup): Only detaches engines on the main __stp_task_finder_list linked list. (__stp_call_callbacks): New function. (__stp_call_vm_callbacks): New function. (__stp_utrace_attach_match_filename): Calls __stp_call_callbacks() to call callbacks. (__stp_utrace_task_finder_target_death): Ditto. (__stp_utrace_task_finder_target_quiesce): Calls __stp_call_callbacks() and __stp_call_vm_callbacks() to call callbacks. (__stp_call_vm_callbacks_with_vma): Renamed from __stp_target_call_vm_callback. (__stp_utrace_task_finder_target_syscall_exit): Calls __stp_call_vm_callbacks() to call vm callbacks. (stap_start_task_finder): Instead of a utrace engine for every task_finder_target, there is now one utrace engine for all targets with the same path or pid.
* PR7046: performance: eliminate duplicate uprobes for multithreaded programs' ↵Frank Ch. Eigler2008-11-251-1/+4
| | | | shlibs
* Fixed __STP_ATTACHED_TASK_EVENTS problem caused by last commit.David Smith2008-09-261-1/+0
| | | | | | | 2008-09-26 David Smith <dsmith@redhat.com> * task_finder.c (__STP_ATTACHED_TASK_EVENTS): Removed UTRACE_STOP, which isn't needed anymore.
* New utrace fixes.David Smith2008-09-251-23/+80
| | | | | | | | | | | | | | | | 2008-09-25 David Smith <dsmith@redhat.com> * task_finder.c (__stp_utrace_attach): Added action flag to know to request the thread to be stopped or not. (stap_utrace_attach): Now just calls __stp_utrace_attach(). (__stp_utrace_task_finder_target_quiesce): Handles utrace_set_events() errors properly. * utrace_compatibility.h (enum utrace_resume_action): Added utrace_resume_action enum. (utrace_control): Added UTRACE_STOP support. (utrace_engine_put): New. (utrace_barrier): New.
* BZ 6755 fix. Wait until all callbacks are finished.David Smith2008-09-121-7/+54
| | | | | | | | | | | | | | | | | | 2008-09-12 David Smith <dsmith@redhat.com> BZ 6755 * task_finder.c: Added 'inuse' count to know when handlers are still running. (__stp_utrace_task_finder_report_clone): If state isn't correct, detach. Increase 'inuse' count when starting, decrement when exiting. (__stp_utrace_task_finder_report_exec): Ditto. (__stp_utrace_task_finder_target_death): Ditto. (__stp_utrace_task_finder_target_quiesce): Increase 'inuse' count when starting, decrement when exiting. (__stp_utrace_task_finder_target_syscall_entry): Ditto. (__stp_utrace_task_finder_target_syscall_exit): Ditto. (stap_stop_task_finder): Wait until all callbacks are finished.
* Utrace on ia64 fast fetch-register supportMasami Hiramatsu2008-09-091-0/+6
|
* task_finder <-> target_pid coupling; staprun/target_cmd fork under ptrace ↵Frank Ch. Eigler2008-09-051-2/+7
| | | | control
* Merge commit 'origin/master' into pr4225Frank Ch. Eigler2008-09-011-46/+74
|\ | | | | | | | | | | | | | | | | | | | | * commit 'origin/master': Fix memory access error in nfs.proc.read_setup, nfs.proc.write_setup and nfs.proc.commit_setup Update NEWS regarding the systemtap client/server. New man page for the systemtap client/server and related utilities. Repopulate symbol/type info. Pushed quiesce logic down into the task_finder layer. Added bug 6841 fix utrace syscall test. PR6731: improve listing mode to list variables
| * Pushed quiesce logic down into the task_finder layer.David Smith2008-08-291-46/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-29 David Smith <dsmith@redhat.com> * tapsets.cxx (utrace_derived_probe_group::emit_probe_decl): Pushed quiesce logic down into the task_finder layer. (utrace_derived_probe_group::emit_module_decls): Removed quiesce handler routines. Syscall probe handler detaches if systemtap state isn't correct. 2008-08-29 David Smith <dsmith@redhat.com> * task_finder.c (__stp_utrace_attach_match_filename): Don't call the callback when the interesting thread is found, call it when the tread is quiesced. (stap_start_task_finder): Ditto. (__stp_utrace_task_finder_target_quiesce): Call the callback.
* | Merge commit 'origin/master' into pr4225Frank Ch. Eigler2008-08-281-10/+10
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'origin/master': PR5686: correct regression in semok/optimize.stp trailing whitespace removal, as approved by emacs fix global-var array index rendering fix NEWS to refer to simpler context.stp tapset functions in auto-printing blurb Document written but unread global variable automatic display. 2nd try initial Make _get_sock_addr return correct address in kernel before 2.6.16. Automatically print written but unread globals Make nodwf test passed when CONFIG_QUOTACTL unset Uses STAPCONF_DPATH_PATH instead of a kernel version check. Simplified "rpm" target a bit. Moved tar archive creation step from "rpm" target to "dist-gzip" target. remove support for "make dist" since git-archive does as well; Examples html files moved into subdir. 2008-08-25 David Smith <dsmith@redhat.com> ChangeLog Entries Robustness improvements for the stap client/server
| * Uses STAPCONF_DPATH_PATH instead of a kernel version check.David Smith2008-08-261-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2008-08-26 David Smith <dsmith@redhat.com> * buildrun.cxx (compile_pass): Added autoconf-dpath-path.c. 2008-08-26 David Smith <dsmith@redhat.com> * autoconf-d_path-path.c: New file. * task_finder.c (__stp_get_mm_path): Uses STAPCONF_DPATH_PATH instead of a kernel version check to determine how to call d_path(). (__stp_utrace_task_finder_target_quiesce): Ditto. (__stp_target_call_vm_callback): Ditto.
* | Merge commit 'origin/master' into pr4225Frank Ch. Eigler2008-08-211-50/+149
|\| | | | | | | | | | | | | | | | | | | | | * commit 'origin/master': Added task finder target parameter to vm_callback functions. Supports original and new utrace interfaces. Add ChangeLog entries stap client/server now pass 'make installcheck' Looks for both mmap and mmap2. PR 6841 fix. Add missing 'process' bindings.