summaryrefslogtreecommitdiffstats
path: root/runtime
Commit message (Collapse)AuthorAgeFilesLines
* PR 10706 fixed by switching to unbuffered output.David Smith2009-11-031-1/+1
| | | | | * runtime/staprun/mainloop.c (stp_main_loop): Switched to unbuffered output (instead of line buffered output).
* Fix for bug 10866 (exit with rc != 0 on script ERRORs).Breno Leitao2009-11-032-11/+15
| | | | | | This patch just make the RC=1 when any output line starts with ERROR:. Also some minors error that was returning 0 instead of 1 were fixed.
* Removed extra declarations.David Smith2009-10-291-3/+0
| | | | | * runtime/transport/transport.h: Removed extra declarations of _stp_transport_init() and _stp_transport_close().
* PR10854: Use a mutex around transport startup/shutdownJosh Stone2009-10-271-15/+23
| | | | | | | | | | | | | | | We had a race where the probe setup could be called during/after the probe shutdown in abnormal circumstances, which leads to kernel callbacks still registered after module unload. (BOOM) Now the setup/shutdown activities and related flags are guarded by a mutex, so we should have strict ordering. * runtime/transport/transport.c (_stp_transport_mutex): New. (_stp_handle_start): Grab the mutex, and make sure we're not exiting. (_stp_cleanup_and_exit): Grab the mutex. (_stp_lock_inode, _stp_unlock_inode): Use kernel version for checking inode locking type.
* Refactor probe locking into shared functionsJosh Stone2009-10-211-0/+68
| | | | | | | | | | | | 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.
* Limit the number of call frame instructions we process in the unwinder.Mark Wielaard2009-10-201-0/+7
| | | | | * runtime/unwind.c (processCFI): Fail if the number of instructions is larger than MAX_CFI (currently 512).
* Make sure cie and fde end point to sane values in while doing unwind_frame.Mark Wielaard2009-10-201-0/+11
| | | | | * runtime/unwind.c (unwind_frame): Check end read from cie or fde doesn't go passed end of unwind table.
* Be paranoid about table size resolving cie_for_fde and fde_pointer_type.Mark Wielaard2009-10-202-9/+22
| | | | | | * runtime/unwind.c (cie_for_fde): Take table and table_len into account. (fde_pointer_type): Likewise. * runtime/unwind/unwind.h: Adjust function prototypes.
* 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)
* bemoan that _stp_*printf can't be protected with gcc attribute printfFrank Ch. Eigler2009-10-191-1/+5
|
* fix 32-bit compatibility for @hist_log printingWenji Huang2009-10-191-1/+1
| | | | | * stat-common.c (_stp_stat_print_histogram_buf): Fix HIST_PRINTF parameter passing.
* Avoid lockdep warnings.Srikar Dronamraju2009-10-192-14/+34
| | | | | | | | | | | | | | | | | | | | uprobe_fork_uproc() runs with parent_uproc->rwsem locked. However uprobe_mk_process() that gets called within uprobe_fork_uproc() also locks child_uproc->rwsem after initializing it. Lockdep report confuses this to acquiring a lock that already has been acquired and suggests using sub-classes. The alternatives we have are: 1. use classes level to distinguish different uproc structures. 2. unlock parent_uproc->rwsem before we call uprobe_fork_uproc(). 3. dont try locking child_uproc->rwsem; since we are protected by uproc_mutex as well as parent_uproc->rwsem; We use the last approach. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> ---
* Merge branch 'master' of sourceware.org:/git/systemtapJosh Stone2009-10-133-19/+18
|\
| * runtime shutdown errors: simplify, improve error specificityFrank Ch. Eigler2009-10-133-19/+18
| | | | | | | | | | | | | | | | * transport/control.c (*_cmd): Return -Ecodes rather than "-1" from file_operations callbacks. * staprun/ctl.c (init_ctl_channel): Return distinct error codes. * staprun/staprun.c (remove_module): Skip connection attempt to .ctl file; just do delete_module() with O_NONBLOCK.
* | Refactor some of the histogram printingJosh Stone2009-10-131-56/+29
| | | | | | | | | | | | | | * runtime/stat-common.c (reprint_buf): Removed. (_stp_stat_print_histogram_buf): Use a local HIST_PRINTF macro to abstract the buffer management. Also convert reprint_buf calls to either %* formats or simple for-loops.
* | PR10257: Add support for sprint[ln](@hist_*).Przemyslaw Pawelczyk2009-10-131-32/+42
|/ | | | | | | | * 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.
* PR10761: pass -v's to final "staprun -d" if appropriateFrank Ch. Eigler2009-10-131-60/+54
| | | | | * mainloop.c (cleanup_and_exit): Remove non-BUG9788_WORKAROUND branch. Remove execlp branch. Pass -v to staprun-d if verbose.
* PR 10575. Improves running target commands.David Smith2009-10-131-18/+43
| | | | | | | * runtime/staprun/mainloop.c (signal_usr1): Renamed from signal_dontcare. Sets a new variable, usr1_interrupt. (start_cmd): Avoids pause() race condition by switching to blocking SIGUSR1, then waiting on SIGUSR1 with sigsuspend().
* build: fix !HAVE_NSS caseFrank Ch. Eigler2009-10-071-2/+1
| | | | | * staprun_funcs.c (assert_permissions): Move "check_signature_rc" variable inside #if HAVE_NSS.
* PR10724: staprun: simplify permissions checking logicCharley Wang2009-10-062-19/+19
| | | | | | Pending advice from Frank and Dave, changed check_permission to return void and renamed it to assert_permission. assert_permission simply returns if permissions are okay, and calls exit(-1) if there are any permissions errors.
* No longer need buffer iterators.David Smith2009-09-251-2/+0
| | | | * runtime/tranport/ring_buffer.c: Removed 'USE_ITERS' definition.
* PR10632: simplify randint() implementationFrank Ch. Eigler2009-09-231-24/+10
| | | | | | | | | * tapset/random.stp (randint): Make it 1-arity (imply min=0). Document with kerneldoc. * doc/Systemtap_Tapset_Reference/tapsets.tmpl: Extract the docs. * runtime/arith.c (_stp_random_pm_u): Rename without _pm. (_stp_random_pm): Rewrite in terms of ..._u. * testsuite/random.stp: Adapt & simplify.
* PR1062: runtime functionCharley Wang2009-09-231-0/+22
| | | | * arith.c (_stp_random_pm_u): New function.
* Forward-ported staplog.c crash support (PR 10644).David Smith2009-09-232-3/+7
| | | | | | | | | | | | | | * staplog.c (get_rchan): Separated original relayfs code and current relayfs code. (get_rchan_buf): Ditto. (output_cpu_logs): Ditto. (get_rchan_addr): Handles original relayfs code detection. (setup_global_data): Looks for '_stp_relay_data' structure instead of '_stp_utt' structure. (open_output_file): Improved error message. * runtime/transport/relay_v2.c: Rearranged struct _stp_relay_data_type to make things a bit easier for staplog.c. * runtime/transport/relayfs.c: Ditto
* PR10390: ftrace() tapset functionFrank Ch. Eigler2009-09-231-0/+8
| | | | | | | | | | | * tapset/logging.stp (ftrace): New function. (*): Add kerneldoc to other functions. * doc/SystemTap_Tapset_Reference/tapsets.tmpl: Process logging.stp. * stapfuncs.3stap.in: Remove "LOGGING" section, now redundant. * runtime/autoconf-trace-printk.c: New autoconf test. * buildrun.cxx (compile_pass): Build it. * NEWS: Mention it. * testsuite/buildok/logging.stp: Test it.
* PR10655 part 1: uprobes: track sdt semaphores properlyFrank Ch. Eigler2009-09-181-0/+1
| | | | | | | | | | | | | | | | | | | commit 6846cfc8 introduced an unintended side-effect where semaphore tracking was identified with stap_uprobe_specs[] elements, which are normally static/const. This kernel patch <http://article.gmane.org/gmane.linux.kernel/854187> catches and panics on this. The cure is to move the variable over to the stap_uprobes[] array. * tapsets.cxx (uprobe emit_module_decls): Add sdt_sem_address to stap_uprobe{} struct, to contain per-process relocated semaphore address. (emit_module_decls,_init): Remove tsk field, restore constness of appropriate locals. Activate uprobe semaphore right around uprobe activation time. Remove semaphore clearing upon process exit, since by then it's gone. (emit_module_exit): Use remembered relocated semaphore address to clean up. Fix "-uprobe" DEBUG_UPROBES message. * runtime.h: #include <linux/sched.h>. * dtrace.in (*_semaphore): Make it an unsigned short - intended 16 bits on all common architectures/multilibs.
* Fixed relay_old.c by providing ppoll().David Smith2009-09-182-9/+12
| | | | | | | * runtime/staprun/staprun.h: Put ppoll() declaration here (so that relay_old.c can use it). * runtime/staprun/relay.c (ppoll): Made ppoll() non-static so that relay_old.c can use it.
* Uprobes not currently supported on ia64.William Cohen2009-09-181-1/+0
|
* PR10595 Work around uprobe2 causing selinux failures for kernel 2.6.28+.Mark Wielaard2009-09-171-3/+32
| | | | | | | | | | We allocate a "fake" unlinked shmem file because anonymous memory might not be granted execute permission when the selinux security hooks have their way. Only do this for 2.6.28 or higher since shmem_file_setup() isn't exported before that. * runtime/uprobes2/uprobes.c (uprobe_setup_ssol_vma): Use shmem_file_setup to setup the ssol vma area when using 2.6.28+.
* PR10650: markup some unprivileged-safe tapset functionsFrank Ch. Eigler2009-09-163-2/+42
| | | | | | | | | | | | | | | | | Add /* unprivileged */ to a variety of tapset embedded-c functions, together with uid-assertion-checking code as needed. This is only an initial set, and may need to grow or shrink after further testing. Prototyped-By: Dave Brolley <brolley@redhat.com> * runtime/runtime.h (is_myproc, assert_is_myproc): New macros. * runtime/addr-map.c (lookup_bad_addr): Reject if !is_myproc in unprivileged mode. * runtime/print.c (_stp_print_kernel_info): Add unprivileged mode info. * tapset/DEVGUIDE: Document /* pure */ and /* unprivileged */. * tapset/*.stp: Add /* unprivileged */ here and there, in questionable cases along with an assert_is_myproc().
* * sdt.h (STAP_SEMAPHORE): New. Add guard to utrace probe points.Stan Cox2009-09-162-53/+55
| | | | | | | | | | | | | | * 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.
* Signal-based file switching support for old relayMasami Hiramatsu2009-09-161-14/+68
| | | | | | | | | | | * runtime/staprun/relay_old.c (switch_oldoutfile): New function for file switching. (process_subbufs): Use switch_oldoutfile. (reader_thread): Use ppoll() instead of poll() for receiving SIGUSR2 and switch output file when receiving a signal(SIGUSR2). (switchfile_handler): Send SIGUSR2 signal to reader threads for file switching. (init_oldrelayfs): Assign switchfile_handler to SIGUSR2.
* Signal-based file switching support for relay/ring buffer.Masami Hiramatsu2009-09-161-22/+61
| | | | | | | | | | * runtime/staprun/relay.c (switch_outfile): New function for file switching. (reader_thread): Don't assign empty_handler to SIGUSR2, and switch output file when receiving signal(SIGUSR2) on ppoll. (switchfile_handler): Send SIGUSR2 signal to reader threads for file switching. (init_relayfs): Assign switchfile_handler to SIGUSR2. * staprun.1.in: Add FILE SWITCHING BY SIGNAL section.
* Allow ring_buffer to be used if STP_USE_RING_BUFFER is defined.David Smith2009-09-101-2/+3
|
* build: support x86-64 without CONFIG_IA32_EMULATIONFrank Ch. Eigler2009-09-101-0/+1
| | | | * runtime/syscall.h (x86_64 MMAP2_SYSCALL_NO): Define.
* PR10602 prime: runtime: shrink stack frame of _stp_do_relocation().Frank Ch. Eigler2009-09-091-1/+1
| | | | * transport/symbols.c (_stp_do_relocation): Make msg static.
* PR10602: improved fix for REG_IP lvalueFrank Ch. Eigler2009-09-091-6/+14
| | | | | | | | | * runtime/regs.h (SET_REG_IP): Define. (REG_IP_LVALUE): Undefine. * tapsets.cxx (*::emit_module_decls): Use SET_REG_IP() instead of old LVALUE? conditional. Written by jkenisto & jistone.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDavid Smith2009-09-091-2/+4
|\
| * Fix relay_old implementation of fsize_max and fnum_max.Masami Hiramatsu2009-09-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With old relayfs, out_fd is used only when non-bulk mode. However, open_oldoutfile and open_relayfs_files open files with fopen and set only percpu_tmpfile. This will cause a problem with -S option, that out_fd will be closed when the file size reaches fsize_max and new fd will be opened only on percpu_tmpfile. So, out_fd should be synchronized with percpu_tmpfile. * runtime/staprun/relay_old.c (open_oldoutfile): Set fd of output file to out_fd[cpu]. (open_relayfs_files): Ditto.
* | Removed unneeded casts.David Smith2009-09-091-5/+5
|/ | | | | | | * runtime/transport/ring_buffer.c (_stp_event_to_user): Removed unneeded cast. (_stp_data_write_reserve): Ditto. (_stp_data_write_commit): Ditto.
* PR10524: reduce massive-uprobe script modules' .data consumptionFrank Ch. Eigler2009-09-082-17/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fix typo: KERN_ERROR -> KERN_ERR from last commitFrank Ch. Eigler2009-09-081-1/+1
|
* PR10575: emit KERN_ERRORs on transport control message failuresFrank Ch. Eigler2009-09-081-0/+3
| | | | | | | | Suspecting that some kernel->user control messages may be getting lost, let's more robustly log these occurrences. * runtime/transport/control.c (_stp_ctl_send): printk(KERN_ERROR) instead of ignoring errors.
* 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.
* runtime diagnostics: remove ANSI goo, add -DSTAP_DEBUG_PRINTK option.Frank Ch. Eigler2009-09-081-1/+8
| | | | | | * runtime/io.c (_stp_vlog): Don't put ansi highlighting into debugging messages. #if STAP_DEBUG_PRINTK, direct all diagnostics to appropriate printk channel instead of runtime trace buffer.
* Warn if the pid specified by -x does not belong to an unprivileged user.Dave Brolley2009-09-081-1/+1
|
* Fix build-id check for relocatable kernelEugeniy Meshcheryakov2009-09-071-1/+2
| | | | | | 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).
* rc = 0 should be return 0 for database not ownder by root.Dave Brolley2009-09-041-1/+1
|
* Check for bad address range or size in lookup_bad_addr.Dave Brolley2009-09-041-0/+4
|