summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/staprun_funcs.c
Commit message (Collapse)AuthorAgeFilesLines
* Regenerate autotools files using autoreconf to pick up latest Makefile.am ↵Dave Brolley2009-12-011-1/+1
| | | | changes.
* Make sure system types are defined.Dave Brolley2009-12-011-2/+3
|
* Fix build error when !HAVE_NSSWenji Huang2009-11-301-2/+2
| | | | | * runtime/staprun/staprun_funcs.c (assert_stap_module_permissions): Mark parameters unused.
* PR 10984 Additional Work. TOCTOU race checking access permissions before ↵Dave Brolley2009-11-271-51/+77
| | | | canonicalizing /lib/modules/KVER/systemtap.
* Merge branch 'master' of ssh://sources.redhat.com/git/systemtapDave Brolley2009-11-251-2/+0
|\
| * include modverify.h unconditionally.Dave Brolley2009-11-241-2/+0
| |
* | Improve error messages related to module signing.Dave Brolley2009-11-251-15/+7
|/
* PR 10976, 10984. Loading of signed modules (script module and uprobes) ↵Dave Brolley2009-11-241-61/+121
| | | | limited to members of stapusr.
* Relax restrictions on ownership and access permissions of signer's cert ↵Dave Brolley2009-11-121-0/+1
| | | | database.
* Use 'module_realpath' instead of overwriting 'path' in insert_module.Dave Brolley2009-11-101-18/+14
| | | | Update comments to clearly explain the security issues involved.
* Replace the use of the global variable 'modpath' in diagnosticDave Brolley2009-11-101-2/+4
| | | | | | | | messages within verify_it with the use of a 'module_name' parameter passed in. Add a comment in insert_module explaining why it's ok to overwrite the 'path' parameter with the canonicalized path.
* Don't reference global variable modpath in insert_module and its helpers.Dave Brolley2009-11-091-29/+56
| | | | | | | | | | | 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.
* 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-061-11/+11
| | | | | | 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.
* Add 'unused' attribute to module_data and module_size arguments of ↵Dave Brolley2009-08-111-2/+4
| | | | check_permissions.
* 2009-08-06 Dave Brolley <brolley@redhat.com>Dave Brolley2009-08-061-43/+44
| | | | | | | | | | | | | | | | | | | * 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.
* Fix compile error when not HAVE_NSS with staprun.Maran2009-08-051-1/+1
| | | | | | | * runtime/staprun/staprun_funcs.c (check_permissions): Declare check_signature_rc outside HAVE_NSS block. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* 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
* | Only sign modules if --unprivileged is specified.Dave Brolley2009-06-111-1/+1
| | | | | | | | | | | | Don't generate an error message for unsigned modules. Make sure module signature exists before attempting to copy to the cache. Allow timer p[robes for unprivileged users.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-05-221-1/+14
|\|
| * Restore staprun's support for REAL_UID/GIDJosh Stone2009-05-221-1/+14
| | | | | | | | | | This is needed for run-stap so that stapio and all child processes can run as the originally invoking user instead of root.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-05-061-1/+1
|\|
| * Problems using server scripts when not on PATH.Dave Brolley2009-05-061-1/+1
| | | | | | | | HAVE_NSS related compile time warning.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-05-051-3/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: modsign.cxx runtime/staprun/modverify.c runtime/staprun/staprun_funcs.c stap-authorize-server-cert stap-authorize-signing-cert stap-serverd systemtap.spec
| * Module signing and verification using a separate file for the module signature.Dave Brolley2009-05-041-64/+130
| |
| * Really fix run-stap this time, I promise!Josh Stone2009-04-021-1/+14
| |
* | 2009-04-14 Dave Brolley <brolley@redhat.com>Dave Brolley2009-04-141-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-03-251-0/+9
|\| | | | | | | | | | | Conflicts: Makefile.in
| * Fix for CVE-2009-0784: stapusr module-path checking raceFrank Ch. Eigler2009-03-251-0/+9
| | | | | | | | | | * runtime/staprun/staprun_funcs.c (check_path): Save fully canonicalized and checked module path for later loading.
* | 2009-03-12 Dave Brolley <brolley@redhat.com>Dave Brolley2009-03-121-50/+135
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * util.cxx (remove_file_or_dir): New function. * util.h (remove_file_or_dir): New function. * systemtap.spec (stap): Add stap-env, stap-gen-cert, stap-authorize-cert, and stap-authorize-signing-cert. (stap-client): Remove stap-find-or-start-server, stap-add-server-cert. Add stap-authorize-server-cert. (stap-server): Add stap-find-servers, stap-find-or-start-server, stap-authorize-server-cert. Remove stap-gen-server-cert. * stap-find-servers: Source stap-env. Use $stap_avahi_service_tag. (initialization): Set timeout to 10. (find_servers): Run avahi-browse in the background and wait for it. Use a temp file for the output of avahi-browse. Kill avahi-browse if the timeout expires. (match_server): Set read timeout. (fatal): New function. * stap-find-or-start-server: Source stap-env. Use $stap_exec_prefix. Always exit with 0. * stap-start-server: Source stap-env. Check for the server PID as a running process and for avahi-publish-service running as a child in order to verify that the server is ready. * stap-add-server-cert: Renamed to stap-authorize-server-cert. Source stap-env. Call stap-authorize-cert. * stap-client: Source stap-env. Use $stap_user_ssl_db and $stap_root_ssl_db. Use $stap_tmpdir_prefix_client, $stap_tmpdir_prefix_server. Use $stap_exec_prefix. (configuration): Removed. (staprun_running): Removed. (interrupt): Don't kill staprun. * stap-server: Source stap-env. Use $stap_user_ssl_db and $stap_root_ssl_db. Use $stap_tmpdir_prefix_client, $stap_tmpdir_prefix_server. Use $stap_exec_prefix. (configuration): Removed. * session.h (systemtap_session): Add cert_db_path. * runtime/staprun/staprun_funcs.c (config.h): #include it. (modverify.h): #include it. (check_signature): New function. (check_groups): New function extracted from check_permissions. (check_permissions): Call check_groups and check_signature. * runtime/staprun/mainloop.c (cleanup_and_exit): Pass modpath to staprun, not modname. * main.cxx (main): Initialize cert_db_path. Handle LONG_OPT_SIGN_MODULE. Save the module signature if the module was signed and is being saved. (LONG_OPT_SIGN_MODULE): #define it. (long_options): Add --sign-module. * cache.cxx (config.h): #include it. (add_to_cache): Add the module signature file to the cache if the module has been signed. * buildrun.cxx (modsign.h): #include it. (compile_pass): Call sign_module, if requested. * configure.ac: Define HAVE_NSS if NSS libraries are available. * Makefile.am (AM_CPPFLAGS): Add -DSYSCONFDIR. (bin_SCRIPTS): Add stap-env, stap-gen-cert, stap-authorize-cert, stap-authorize-signing-cert, stap-authorize-server-cert. Remove stap-gen-server-cert, stap-add-server-cert. (stap_SOURCES): Add nsscommon.c, modsign.cxx (stap_CPPFLAGS): Add $(nss_CFLAGS), $(nspr_CFLAGS). (stap_LDADD): Add -lnss3. (staprun_SOURCES): Add nsscommon.c. * modsign.cxx: New file. * modsign.h: New file. * nsscommon.c: New file. * nsscommon.h: New file. * runtime/staprun/modverify.c: New file. * runtime/staprun/modverify.h: New file. * stap-authorize-cert: New file. * stap-authorize-signing-cert: New file. * stap-env: New file. * Makefile.in: Regenerated. * aclocal.m4: Regenerated. * config.in: Regenerated. * configure: Regenerated. * doc/Makefile.in: Regenerated. * doc/SystemTap_Tapset_Reference/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * testsuite/aclocal.m4: Regenerated.
* Fix PR 6903 by checking for the real uid, not the euid.David Smith2008-09-181-1/+1
| | | | | | | | 2008-09-18 David Smith <dsmith@redhat.com> PR 6903. * staprun_funcs.c (check_permissions): Instead of checking the effective uid, check the real uid for root permissions.
* remove capabilities logic, cont'dFrank Ch. Eigler2008-09-051-15/+15
|
* Change staprun to exec stapio. Add "-d" option to staprun.Martin Hunt2008-04-211-12/+0
|
* rebased unwind_branch on top of current masterFrank Ch. Eigler2008-03-251-92/+0
|
* 2008-02-21 David Smith <dsmith@redhat.com>dsmith2008-02-211-1/+11
| | | | * staprun_funcs.c (check_path): Small security fix.
* Print out more descriptive error messages on non-root systemtap invocationananth2008-02-041-2/+9
| | | | Thanks to Jim for fixing typos and grammar.
* 2008-01-21 Martin Hunt <hunt@redhat.com>hunt2008-01-211-2/+0
| | | | | * symbols.c (send_module): Simplify and use new send_data() function to keep longword alignment.
* PR4037 and fixes to better synchronize staprun and stapio.hunt2008-01-151-13/+23
|
* 2007-10-12 Martin Hunt <hunt@redhat.com>hunt2007-10-121-10/+36
| | | | | | | | | | | | | | | | 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.
* PR 5709kenistoj2007-10-081-13/+14
| | | | | | | | | | | | | | | | | | | | | | | * 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-14 David Smith <dsmith@redhat.com>dsmith2007-08-141-0/+443
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.