summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/staprun.c
Commit message (Collapse)AuthorAgeFilesLines
* Change KERNEL_RELOC_SYMBOL to "_stext" on ppc32Anton Vorontsov2009-12-011-1/+1
| | | | | | | | Currently staprun fails at send_relocation_kernel(), this is because ppc32 doesn't have ".__start" symbol. I think we should use _stext, just as other arches. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
* Don't reference global variable modpath in insert_module and its helpers.Dave Brolley2009-11-091-6/+4
| | | | | | | | | | | This allows insert_module to to be used for loading the signed uprobes.ko module. Allow the use of $$parms and $$return in uprobes based probes for unprivileged users. Re-add management of module signatures in the cache. Don't know why it was removed.
* Revert change which loads uprobes.ko using insert_module.Dave Brolley2009-11-051-3/+5
|
* PR 9973: Sign uprobes.ko when it is created and load it using insert_module.Dave Brolley2009-11-051-5/+3
| | | | Create home directory manually for stap-server.
* runtime shutdown errors: simplify, improve error specificityFrank Ch. Eigler2009-10-131-12/+10
| | | | | | | | * 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.
* PR10724: staprun: simplify permissions checking logicCharley Wang2009-10-061-8/+8
| | | | | | 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.
* Allow process begin/end probes for unprivileged users.Dave Brolley2009-09-031-9/+1
| | | | | | | | | | | | | | | | | 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.
* PR10506 experiment: use /sbin/insmod for uprobes.ko loadingFrank Ch. Eigler2009-08-101-2/+7
| | | | * runtime/staprun/staprun.c (enable_uprobes): insmod, not insert_module().
* 2009-08-06 Dave Brolley <brolley@redhat.com>Dave Brolley2009-08-061-3/+0
| | | | | | | | | | | | | | | | | | | * modverify.c (staprun.h): #include it. (verify_it): Now accepts module data and signature data as arguments. Don't open and read the signature here. Don't read the module here. (verify_module): Now accepts module data as argument. Read the signature once here. * modverify.h (verify_module): Now accepts module data as argument. * staprun.c (main): Don't call check_permissions here. * staprun.h (check_permissions): Prototype removed. * staprun_funcs.c (check_permissions): Now static. Accepts module data as argument. Pass module data to check_signature. (insert_module): Canonicalize the module path early here. Call check_permissions here, passing it the mapped module data. (check_signature): Now accepts module data as argument. Pass the module data to verify_module. (check_path): Use the already-canonicalized module path.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-08-041-0/+1
|\ | | | | | | | | | | Conflicts: cache.cxx
| * PR10204: Place userspace markers in systemtap itselfKent Sebastian2009-07-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * cache.cxx (add_to_cache,clean_cache): add static markers * main.cxx (main): likewise * runtime/staprun/common.c (send_request): likewise * runtime/staprun/mainloop.c (stp_main_loop): likewise * runtime/staprun/staprun.c (remove_module): likewise * runtime/staprun/staprun.h: include sdt.h * runtime/staprun/staprun_funcs.c (insert_module): likewise * util.cxx (stap_system): likewise * tapset/stap_staticmarkers.stp: new file
* | 2009-04-14 Dave Brolley <brolley@redhat.com>Dave Brolley2009-04-141-4/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* PR7082: support non-setuid use of $SYSTEMTAP_RUNTIME to find uprobes.koFrank Ch. Eigler2008-12-091-4/+10
|
* PR7063: honor SYSTEMTAP_STAPRUN and SYSTEMTAP_STAPIO environment variablesRoland McGrath2008-12-031-2/+10
|
* PR6925: tolerate modules left over from previous crashed? stap sessionsFrank Ch. Eigler2008-12-031-2/+12
|
* PR4783: remove traces of stap{run,io} self-renicingFrank Ch. Eigler2008-11-281-5/+0
|
* PR4886: check build-id if able.Wenji Huang2008-10-061-0/+5
| | | | This provides sanity check of debuginfo file based on build-id. Many cases are considered, whether build-id exists in debuginfo file or not, whether module is loaded or not, whether build-id exists in runtime kernel/module. It will do work when LD >= 2.18 and kernel >=2.6.23, otherwise no check.
* remove capabilities logic, cont'dFrank Ch. Eigler2008-09-051-57/+49
|
* pass /sys/module/*/sections/* addresses to the kernel module tooFrank Ch. Eigler2008-07-071-7/+83
|
* emit all symbol tables at compile time; don't do any module munging; new ↵Frank Ch. Eigler2008-07-041-1/+2
| | | | unwinder still disabled
* transport/symbol rework: kernel-only probes workingFrank Ch. Eigler2008-06-291-1/+6
|
* STP_RELOCATE message for kernel relocatability (re)adaption, starting ↵Frank Ch. Eigler2008-06-291-0/+102
| | | | implementation
* PR5645: Fix sub-buffer size calculation and debug messages.Masami Hiramatsu2008-04-301-1/+1
|
* Allow staprun to run on kernels without capabilities configured.Martin Hunt2008-04-221-3/+2
|
* Change staprun to exec stapio. Add "-d" option to staprun.Martin Hunt2008-04-211-78/+85
|
* rebased unwind_branch on top of current masterFrank Ch. Eigler2008-03-251-3/+0
|
* 2007-10-12 Martin Hunt <hunt@redhat.com>hunt2007-10-121-2/+3
| | | | | | | | | | | | | | | | Changes to separate the symbols from the command channel. * cap.c (init_cap): Add CAP_DAC_OVERRIDE. * staprun.h: Change init_ctl_channel prototype. * ctl.c (init_ctl_channel): Modify to open either a command or symbol channel. Use ".cmd" and ".symbols" as the new names. * mainloop.c (init_stapio): Call init_ctl_channel(0); * staprun.c (cleanup): Call stop_symbol_thread(). (main): Call start_symbol_thread(). * staprun_funcs.c (handle_symbols): Make a thread. (start_symbol_thread): New. (stop_symbol_thread): New.
* * staprun error-check reordering for parseko/cmdline* testsfche2007-10-121-9/+11
| | | | | * staprun.c (main): Move checks for init_cap and getuid from just before command line argument parsing to just after.
* PR 5709kenistoj2007-10-081-10/+67
| | | | | | | | | | | | | | | | | | | | | | | * main.cxx: Add pass 4.5: make uprobes.ko in runtime/uprobes * buildrun.cxx: Add uprobes_enabled() and make_uprobes(). Factor run_make_cmd() out of compile_pass(). * buildrun.h: Add uprobes_enabled and make_uprobes decls. * tapsets.cxx: Do correct #include for modprobed uprobes.ko; set need_uprobes in pass 2. * session.h: Add need_uprobes * runtime/staprun/common.c: Add -u option -> need_uprobes * runtime/staprun/staprun_funcs.c: Generalize insert_module() to support inserting uprobes.ko. * runtime/staprun/staprun.c: Add enable_uprobes(). insert_module call becomes insert_stap_module(). * runtime/staprun/staprun.h: Reflect insert_module() and need_uprobes changes * runtime/uprobes/*.[c,h]: uprobes is built as a module, rather than included into the source of the stap-generated module. * runtime/uprobes/Makefile: Added
* 2007-08-15 David Smith <dsmith@redhat.com>dsmith2007-08-151-1/+7
| | | | * staprun.c (main): Quit if effective uid is not root.
* 2007-08-15 Martin Hunt <hunt@redhat.com>hunt2007-08-151-0/+3
| | | | | | PR4736 * staprun.c (cleanup): Set priority back to normal before removing module.
* 2007-08-14 David Smith <dsmith@redhat.com>dsmith2007-08-141-121/+153
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge from setuid-branch. Changes also by Martin Hunt <hunt@redhat.com>. * staprun.c (init_staprun): Drop CAP_SYS_ADMIN when we're done with it. (main): Calls parse_modpath instead of path_parse_modname. Just call parse_modpath with argv[optind]. Let it allocate and set modpath and modname. If no modulename was given, display usage and exit. Drop CAP_SYS_NICE when we're done with it. Set atexit(exit_cleanup) so cleanup always gets called and modules get removed. Call handle_symbols. (run_stapio): Set argv[0] to stapio so that it executes as itself instead of staprun. (cleanup): Only do cleanups once and only try to remove module when appropriate. (exit_cleanup): New. Calls cleanup(). (mountfs): Sets uid to root before making directory and then restores uid. (setup_ctl_channel): Uses DEBUGFS define and improved error message. (setup_relayfs): Ditto. (setup_oldrelayfs): Uses DEBUGFS and RELAYFS defines. (run_stp_check): Replaced by mountfs(). (mountfs): New function. Replaces an external script with C code. (init_staprun): Calls mountfs() instead of run_stp_check(). * staprun.h: Renamed path_parse_modname to parse_modpath. Added MODULE_NAME_LEN define. Added [_][p]err macros. Removed VERSION_CMD. * mainloop.c (cleanup_and_exit): Make sure initialized is 2 before exiting with code 2. (stp_main_loop): Set initialized to 2 when STP_TRANSPORT is received. Call cleanup_and_exit() with proper status. (start_cmd): exit 1 instead of -1. (system_cmd): Ditto. (init_staprun): Renamed init_stapio. (cleanup_and_exit): Set exit status. * cap.c: New file. * common.c: New file. * stapio.c: New file. * staprun_funcs.c: New file. * Makefile: Removed. * symbols.c (get_sections): Move the filter code up so that uninteresting section names are filtered out before attempting to open them. (do_kernel_symbols): Better detect overfow conditions and realloc new space. (do_module): After sending all modules, send a null message to indicate we are finished. * ctl.c (init_ctl_channel): When attempting to attach, if the control channel doesn't exist, print a better error message. * relay_old.c (init_oldrelayfs): Errors out if open_relayfs_files() couldn't open any files. PR 4795 * mainloop.c (send_request): Fixed buffer overflow check. * staprun.h: Added buffer overflow checking versions of strcpy/sprintf/snprintf. * common.c (path_parse_modname): Checks for overflows on strcpy/sprintf/snprintf. (read_buffer_info): Ditto. * ctl.c (init_ctl_channel): Ditto. * relay.c (init_relayfs): Ditto. * relay_old.c (open_relayfs_files): Ditto. (init_oldrelayfs): Ditto. * staprun_funcs.c (insert_module): Ditto. (check_path): Ditto. * symbols.c (get_sections): Ditto.
* 2007-05-08 Martin Hunt <hunt@redhat.com>hunt2007-05-081-3/+5
| | | | | | | | | | | | | | | | | | Signal handler cleanup. * mainloop.c (fatal_handler): New. Cleanly handle unexpected fatal signals. (setup_main_signals): New. Set signals once mainloop is entered. (setup_signals): New. Block certain signals during initialization. Set handler for fatal signals. * relay.c (reader_thread): Use ppoll(). Terminate on SIGUSR2 after reading any remaining data. (close_relayfs): Remove sleep hack. Send SIGUSR2 to all threads. Runtime debug messages. * staprun.h: Change dbug() to accept a debuglevel and enable it. * *.c: Modify dbug() calls.
* 2007-03-26 Martin Hunt <hunt@redhat.com>hunt2007-03-261-21/+47
| | | | | | | | | | | | | | | | * mainloop.c (run_stp_check): Just use system() call. (init_staprun): Remove _stp_pid module parameter. (cleanup_and_exit): If closed==2, just exit without removing module. (driver_poll): Remove. We no longer require stap running. (_stp_main_loop): Remove call to driver_poll. * ctl.c (init_ctl_channel): Don't put files in systemtap_pid, revert back to systemtap/modulename. * relay.c: Revert back to systemtap/modulename paths. * relay_old.c: Ditto. * staprun.c: Add -L and -A args.
* 2007-03-14 Martin Hunt <hunt@redhat.com>hunt2007-03-141-0/+158
* staprun.c: Renamed from stpd.c. Removed quiet and print_only options. Added "-x" option as an alias for "-t". Removed "-m" option. Updated arg processing to leave 4 slots for modoptions[]. Bump the priority of staprun. * ctl.c: New. Transport control channel functions. * relay.c: New. Relayfs control functions for new transport. * relay_old.c: New. Relayfs control functions for older versions of relayfs. * mainloop.c: New. Staprun main loop. * staprun.h: Renamed from librelay.h. Cleaned up. * stap_merge.c: Renamed. Updated for modified save format.