summaryrefslogtreecommitdiffstats
path: root/runtime/transport/transport.c
Commit message (Collapse)AuthorAgeFilesLines
* Fixed PR 11148 by reworking transport directory locks.David Smith2010-01-081-14/+30
| | | | | | | | | | * runtime/transport/transport.c (_stp_get_root_dir): No longer locks/unlocks the transport directory. (_stp_remove_root_dir): Ditto. (_stp_transport_fs_init): Locks and unlocks the transport directory. Ensures that the root directory can't be deleted between calling _stp_get_root_dir() and creating the module dir. (_stp_transport_fs_close): Locks and unlocks the transport directory.
* 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.
* Allow ring_buffer to be used if STP_USE_RING_BUFFER is defined.David Smith2009-09-101-2/+3
|
* Allow process begin/end probes for unprivileged users.Dave Brolley2009-09-031-4/+0
| | | | | | | | | | | | | | | | | 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.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-06-221-78/+173
|\
| * Disabled transport version 3 (for now).David Smith2009-06-191-0/+6
| |
| * Removed unused code (and all references to 'utt').David Smith2009-06-181-52/+0
| |
| * Enabled overwrite processing on original transports.David Smith2009-06-181-13/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * runtime/transport/relay_v2.c (_stp_transport_data_fs_overwrite): Renamed from stp_relay_set_overwrite(). * runtime/transport/relayfs.c (stp_relay_set_overwrite): Ditto. * runtime/transport/ring_buffer.c (_stp_transport_data_fs_overwrite): New place holder function. * runtime/transport/transport.c (_stp_detach): Calls _stp_transport_data_fs_overwrite(). (_stp_attach): Calls _stp_transport_data_fs_overwrite(). * runtime/transport/transport.h: Added prototype for _stp_transport_data_fs_overwrite().
| * Fixed STP_TRANSPORT_VERSION 1 behavior.David Smith2009-06-031-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * runtime/transport/control.c (_stp_ctl_write_dbug): Added support for more messages. * runtime/transport/relay_v2.c (_stp_transport_data_fs_start): New function. (_stp_transport_data_fs_stop): Ditto. (_stp_transport_data_fs_close): Moved some functionality into _stp_transport_data_fs_stop() and calls _stp_transport_data_fs_stop() also. (_stp_transport_data_fs_init): Moved some functionality into _stp_transport_data_fs_start() and calls _stp_transport_data_fs_start() also. * runtime/transport/relayfs.c (_stp_transport_data_fs_start): New function. (_stp_transport_data_fs_stop): Ditto. (_stp_transport_data_fs_close): Moved some functionality into _stp_transport_data_fs_stop() and calls _stp_transport_data_fs_stop() also. (_stp_transport_data_fs_init): Moved some functionality into _stp_transport_data_fs_start() and calls _stp_transport_data_fs_start() also. * runtime/transport/ring_buffer.c (_stp_transport_data_fs_start): New empty function. (_stp_transport_data_fs_stop): Ditto. * runtime/transport/transport.h: Added _stp_transport_data_fs_start() and _stp_transport_data_fs_stop() prototypes. * runtime/transport/transport.c (_stp_cleanup_and_exit): Calls _stp_transport_data_fs_stop(). (_stp_transport_close): Calls _stp_transport_fs_close() earlier. (_stp_transport_init): Calls _stp_transport_data_fs_start().
| * Cleanup and better original transport support.David Smith2009-05-261-1/+10
| | | | | | | | | | | | | | | | | | | | * runtime/print.h: Moved _stp_reserve_bytes() prototype here. * runtime/vsprintf.c (_stp_vsnprintf): Includes print.h to get _stp_reserve_bytes() prototype. * runtime/transport/transport.c (_stp_remove_root_dir): Better cleanup for STP_TRANSPORT_VERSION == 1. (_stp_transport_fs_close): Ditto.
| * Added error checking and other updates.David Smith2009-05-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * runtime/vsprintf.c: Added transport.h inclusion for STP_BUFFER_SIZE definition. * runtime/transport/debugfs.c (_stp_register_ctl_channel_fs): Added error checking. * runtime/transport/transport.c (_stp_get_root_dir): Ditto. (_stp_transport_fs_init): Added original transport support and error checking. * runtime/transport/relay_v2.c (__stp_relay_create_buf_file_callback): Added error checking. (_stp_transport_data_fs_init): Ditto. * runtime/transport/ring_buffer.c (_stp_transport_data_fs_init): Ditto. * runtime/transport/utt.c: Removed unused file. * runtime/transport/utt.h: Ditto.
| * Merge commit 'origin/master' into pr7043David Smith2009-05-211-1/+13
| |\ | | | | | | | | | | | | | | | | | | Conflicts: runtime/print.c runtime/transport/transport.c runtime/transport/transport_msgs.h
| * | Start at supporting the original transport (STP_TRANSPORT_VERSION=1).David Smith2009-05-121-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | * runtime/print.c: Only use print_new.c. * runtime/print_new.c (stp_print_flush): Add STP_TRANSPORT_VERSION 1 support. * runtime/transport/transport.c: Removed inclusion of procfs.c. * runtime/transport/procfs.c (_stp_proc_read): Adapt to new interface. (_stp_proc_write): Ditto. * runtime/transport/relayfs.c: Ditto.
| * | Start of support for older transport and cleanup.David Smith2009-05-061-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | * runtime/transport/control.c: Added inclusion of linux/delay.h to get declaration of msleep(). * runtime/transport/relay_v2.c: New skeleton file for transport version 2. * runtime/transport/ring_buffer.c: Cleanup. * runtime/transport/transport.c: Ditto.
| * | Renamed STP_OLD_TRANSPORT to STP_TRANSPORT_VERSION.David Smith2009-04-021-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-04-02 David Smith <dsmith@redhat.com> * runtime.h: Defines STP_TRANSPORT_VERSION instead of STP_OLD_TRANSPORT. * staprun/staprun.h (STP_OLD_TRANSPORT): Ditto. * print.c: Changed STP_OLD_TRANSPORT to STP_TRANSPORT_VERSION. * staprun/mainloop.c (stp_main_loop): Ditto. * transport/transport.c: Ditto. * transport/transport.h: Ditto. * transport/transport_msgs.h: Ditto. * transport/utt.h: Ditto.
| * | First working version that actually produces output.David Smith2009-03-091-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-03-09 David Smith <dsmith@redhat.com> * print_new.c (stp_print_flush): Calls _stp_data_write_reserve() and _stp_data_write_commit(). * transport/ring_buffer.c (__stp_alloc_ring_buffer): Sets up a default buffer size of STP_BUFFER_SIZE; (trace_seq_reset): New function. (peek_next_entry): New function. (__find_next_entry): New function. (find_next_entry_inc): New function. (_stp_data_read_trace): Uses find_next_entry_inc() to get the next entry, then calls _stp_entry_to_user() to copy it to the user's buffer, then calls ring_buffer_consume() to consume it. (_stp_data_write_reserve): New function. (_stp_data_write_commit): New function. * transport/transport.c (_stp_transport_close): Calls functions that were ifdef'ed out. * transport/transport.h (struct _stp_entry): Added _stp_entry definition and _stp_data_write_reserve()/_stp_data_write_commit() prototypes.
| * | Start of new ring_buffer transport.David Smith2009-03-041-10/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-03-04 David Smith <dsmith@redhat.com> * runtime.h: Added _stp_exit() prototype. * transport/ring_buffer.c: New file. * transport/transport.c: Removed unneeded utt_trace lines. Includes transport/ring_buffer.c. (_stp_transport_fs_init): Calls _stp_transport_data_fs_init(). (_stp_transport_fs_close): Calls _stp_transport_data_fs_close(). * transport/transport.h: Added prototypes.
| * | More cleanup.David Smith2009-02-251-21/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-25 David Smith <dsmith@redhat.com> * debug.h: Removed unused variable '_stp_transport_state'. * print_new.c (stp_print_flush): Ifdef'ed out call to utt_reserve(). * runtime.h: Added _stp_warn() prototype. * transport/control.c: Includes control.h, mempool.c, and symbols.c. Renamed '_stp_attached' to '_stp_ctl_attached'. * transport/control.h: Removed _stp_pool_q declaration. * transport/debugfs.c (_stp_register_ctl_channel_fs): Uses _stp_get_module_dir(). * transport/transport.c: Cleanup. * transport/transport.h: Ditto.
| * | Major hacking to minimal config.David Smith2009-02-241-24/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-24 David Smith <dsmith@redhat.com> * print.h: New file. * print.c: Includes new print.h file. * print_new.c (stp_print_flush): Commented out some code that needs replacing. * sym.c: Includes sym.h. * transport/debugfs.c: Includes transport.h. * transport/relayfs.c: Updated _stp_get_root_dir() call. * transport/transport.c: Ifdef'ed out most setup. * transport/transport.h: Ifdef'ed out all but basics. * transport/utt.c (utt_create_tree): Updated _stp_get_root_dir() call. * transport/utt.h: Commented out 'rchan' in struct utt_trace. (utt_reserve): Ifdef'ed out guts.
* | | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-06-171-1/+0
|\ \ \
| * | | Moved time.c inclusion from runtime/transport/transport.c to runtime/runtime.h.David Smith2009-06-161-1/+0
| | |/ | |/| | | | | | | | | | * runtime/runtime.h: Includes time.c. * runtime/transport/transport.c: Removed time.c inclusion.
* / | 2009-04-14 Dave Brolley <brolley@redhat.com>Dave Brolley2009-04-141-0/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * translate.cxx (c_unparser::emit_unprivileged_user_check): Generate code to check _stp_unprivileged_user. * testsuite/lib/systemtap.exp (setup_server): Copy stap-env to $net_path. * runtime/transport/transport.c: Set up _stp_unprivileged_user. * runtime/staprun/staprun_funcs.c (check_signature): Distiguish among verification failure due to errors, tampering, untrusted signer. (check_permissions): Likewise. (check_groups): Set unprivileged_user. * runtime/staprun/staprun.c (insert_stap_module): Set _stp_unprivileged_user. * runtime/staprun/modverify.h (MODULE_OK): #define it. (MODULE_UNTRUSTED,MODULE_CHECK_ERROR,MODULE_ALTERED): Likewise. * runtime/staprun/modverify.c (modverify.h): #include it. (verify_it): Distiguish among verification failure due to errors, tampering, untrusted signer. (verify_module): Likewise. * runtime/staprun/common.c (unprivileged_user): Define it. * runtime/staprun/staprun.h (unprivileged_user): Declare it. * cache.cxx (get_from_cache): Get the module signature file. * stap-authorize-server-cert: Source `dirname $0`/stap-env. * stap-authorize-signing-cert: Likewise. * stap-client: Likewise. * stap-find-or-start-server: Likewise. * stap-find-servers: Likewise. * stap-gen-cert: Likewise. * stap-server: Likewise. * stap-serverd: Likewise. * stap-start-server: Likewise.
* / PR9947: move runtime cleanup out of the work queueJosh Stone2009-03-131-4/+16
|/ | | | | | | | | | | | The kernel lockdep checking found a possible deadlock if a forced rmmod tried to destroy _stp_work_queue at the same time that the work queue was unregistering tracepoints. An unlikely scenario, but still possible. Now the work queue will just issue a STP_REQUEST_EXIT down to usermode, and usermode will echo back an STP_EXIT that triggers the actual probe cleanup. This way the unregistrations are happening in exactly the same context as the registrations were.
* Add selective use of _stp_time_init/kill (PR9822)Josh Stone2009-02-231-6/+0
| | | | | | | | Our gettimeofday runtime has frequent wakeups to stay in sync with kernel time, but this is wasted effort if gettimeofday is not used in the script. This patch moves the calls to _stp_time_init and _stp_time_kill into begin and end/error probes, which only get pulled in if one of the gettimeofday variants is called.
* Removed unused functions and variables.David Smith2009-02-181-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-18 David Smith <dsmith@redhat.com> * io.c (_stp_log): Removed unused function. * map.c (_stp_cmp): Replace _stp_log() with dbug(). * mempool.c (_stp_mempool_resize): Removed unused function. * print.c (next_fmt): Removed unused function. * procfs.c: Removed unused variable '_stp_num_procfs_files'. * regs.c (_stp_ret_addr): Removed unused function. * string.c (_stp_text_str): Removed unused variable 'len'. * string.h: Removed unused variable '_stdout_' and function declaration for deleted function '_stp_vsprintf'. * sym.c: Removed unused variables. * unwind.c (_stp_create_unwind_hdr): Removed unused function. 2009-02-18 David Smith <dsmith@redhat.com> * control.c: Removed unused variable '_stp_current_buffers'. * procfs.c (_stp_set_buffers): Removed unused function. (_stp_register_ctl_channel_fs): Removed unused variables and label. * symbols.c (u32_swap): Removed unused function. (generic_swap): Ditto. (_stp_sort): Ditto. (_stp_section_is_interesting): Ditto. * transport.c (_stp_transport_init): Removed unused variable 'ret'.
* Reduced control channel code duplication.David Smith2009-02-171-2/+4
| | | | | | | | | | | | 2009-02-17 David Smith <dsmith@redhat.com> * control.c: Contains generic control channel functions. * procfs.c: Specific procfs control channel functions. All generic control channel functions moved to control.c. * debugfs.c: New file containing debugfs specific control channel functions. * control.h: New file. * transport.c: Updated file inclusion.
* Moved inclusion of runtime/procfs.c to a better place.David Smith2009-02-121-1/+0
| | | | | | | | | | | | 2009-02-12 David Smith <dsmith@redhat.com> * tapsets.cxx (procfs_derived_probe_group::emit_module_decls): Moved inclusion of procfs.c here from runtime/transport.c 2009-02-12 David Smith <dsmith@redhat.com> * transport.c: Moved inclusion of procfs.c to procfs_derived_probe_group::emit_module_decls() in tapsets.cxx.
* Cleanup. Renamed _stp_{un}lock_debugfs() to _stp_{un}lock_transport_dir().David Smith2009-02-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-12 David Smith <dsmith@redhat.com> * transport.c (_stp_lock_transport_dir): Renamed from _stp_lock_debugfs(), since on older kernels this actually uses procfs. (_stp_unlock_transport_dir): Renamed from _stp_unlock_debugfs(), since on older kernels this actually uses procfs. (_stp_lock_transport_dir): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). * transport.h: Ditto. Also added _stp_transport_init() prototype. * utt.c (utt_remove_root): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). * relayfs.c (_stp_remove_relay_root): Ditto. 2009-02-12 David Smith <dsmith@redhat.com> * procfs.c (_stp_rmdir_proc_module): Changed _stp_lock_debugfs()/_stp_unlock_debugfs() to _stp_lock_transport_dir()/_stp_unlock_transport_dir(). (_stp_mkdir_proc_module): Ditto.
* PR9740/9816? - workaround for kernel valloc bugFrank Ch. Eigler2009-02-051-0/+9
|
* Use 'static' as much as possibleJosh Stone2009-01-281-8/+8
| | | | | | | | | | 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.
* PR9699: build fixes for kernel 2.6.28Frank Ch. Eigler2009-01-061-1/+6
|
* reduce transport debug verbosityFrank Ch. Eigler2008-11-121-2/+1
|
* Merge commit 'origin/master' into pr6429-comp-unwindsymsFrank Ch. Eigler2008-07-091-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'origin/master': fix shutdown race condition for scripts that might exit during begin probes Fix PR 6732: Add runtime/autoconf-real-parent.c check for task_struct field. clarify dejagnu test case name for empty-struct changes add changelog entries for last two changes Add test suite for declaration resolution Fix semantic error: empty struct Add hack to support git 1.6 in git_version.sh Sync latest fix for git_version.sh from RadeonHD's tree Slightly cleanup code of translate.cxx PR2111: add general blurbage to stapprobes.5 on syscalls tapset Use `uname -rvm` for checking system compatibility. Generate Add section to stapex manual page on how installed examples are documented. Install examples, demos and samples. Install tutorial and langref manuals.
| * fix shutdown race condition for scripts that might exit during begin probesFrank Ch. Eigler2008-07-091-2/+2
| |
* | emit all symbol tables at compile time; don't do any module munging; new ↵Frank Ch. Eigler2008-07-041-17/+1
| | | | | | | | unwinder still disabled
* | transport/symbol rework: kernel-only probes workingFrank Ch. Eigler2008-06-291-0/+4
| |
* | STP_RELOCATE message for kernel relocatability (re)adaption, starting ↵Frank Ch. Eigler2008-06-291-1/+2
|/ | | | implementation
* PR5645: Fix sub-buffer size calculation and debug messages.Masami Hiramatsu2008-04-301-1/+5
|
* Change staprun to exec stapio. Add "-d" option to staprun.Martin Hunt2008-04-211-8/+7
|
* Remove misleading error message.Martin Hunt2008-03-311-1/+0
|
* Support for kernels built with CONFIG_FRAME_POINTERMartin Hunt2008-03-301-1/+1
|
* rebased unwind_branch on top of current masterFrank Ch. Eigler2008-03-251-84/+64
|
* 2008-02-27 Martin Hunt <hunt@redhat.com>hunt2008-02-271-16/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | * sym.h (_stp_module): Add text_size, lock, and unwind data pointer. * sym.c (_stp_find_module_by_addr): New function. (_stp_kallsyms_lookup): Call _stp_find_module_by_addr(). (_stp_get_unwind_info): New. * runtime.h: Move debug macros to debug.h. Include it. * debug.h: New file. * map.c: Update debug calls. * map-gen.c: Update debug calls. * pmap-gen.c: Update debug calls. * mempool.c: New file. * symbols.c: Use rwlocks. Use new dbug macros. Handle unwind info if present. * transport.c: Include mempool.c. Update dbug and kbug calls to new macros. * transport_msgs.h (_stp_command_name): Add struct containing message names for debugging. * control.c, procfs.c: Use new dbug macros. Use new mempool functions.
* PR4037 and fixes to better synchronize staprun and stapio.hunt2008-01-151-16/+16
|
* Add support for memory allocation tracking.hunt2008-01-151-1/+2
|
* 2007-11-09 Masami Hiramatsu <mhiramat@redhat.com>hiramatu2007-11-091-0/+6
| | | | | | | | | | | | | | | | PR3858 * print.c: Add -DRELAY_HOST=<hostname> and -DRELAY_GUEST=<hostname> options support. (_stp_print_flush): Disable irqs if -DRELAY_* option is specified. * print_old.c: Export stp_print_flush to other modules if the -DRELAY_HOST option is specified. * print_new.c: Ditto. * transport.c (_stp_transport_init): Reduce relay buffer size to 64KB*2 if -DRELAY_GUEST is specified. * systemtap.printf/sharedbuf.exp: New test for buffer sharing option. * systemtap.printf/sharedbuf.stp: Ditto. * systemtap.printf/hello.stp: Ditto. * systemtap.printf/hello2.stp: Ditto.
* 2007-11-09 Martin Hunt <hunt@redhat.com>hunt2007-11-091-3/+4
| | | | | | | | | PR 5281 * transport.c (_stp_detach, _stp_attach): Call utt_set_overwrite() instead of setting a flag directly. * utt.c (utt_set_overwrite): New. Set overwrite mode. * relayfs.c (utt_set_overwrite): New. Set overwrite mode. * utt.h: Remove global utt_overwrite_flag.
* 2007-11-01 Martin Hunt <hunt@redhat.com>hunt2007-11-011-14/+35
| | | | | | * procfs.c, control.c, transport.c: Recognize when stapio is detached and disable delayed work. Enable when attached. Cleanup code to destroy workqueue on exit.
* 2007-10-12 Martin Hunt <hunt@redhat.com>hunt2007-10-121-9/+6
| | | | | | | | | | * transport.c (_stp_ask_for_symbols): Don't ask for transport_info yet. Need to wait until symbols are received. (_stp_work_queue): Rename _stp_ready_q to _stp_ctl_ready_q. * procfs.c: Create a ".symbols" channel and use it for STP_MODULE and STP_SYMBOLS. Rename "cmd" channel to ".cmd". * control.c: Ditto.
* 2007-09-10 Martin Hunt <hunt@redhat.com>hunt2007-09-101-0/+1
| | | | | | | * procfs.c (_stp_register_ctl_channel): Call _stp_mkdir_proc_module(). (_stp_unregister_ctl_channel): Call _stp_rmdir_proc_module(). * transport.c: Include ../procfs.c runtime procfs functions.