summaryrefslogtreecommitdiffstats
path: root/cache.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Add startswith/endswith helpersJosh Stone2010-03-111-2/+2
| | | | | Inspired by the Python equivalents, these new utility functions just make it a little cleaner to match at the beginning or end of a string.
* PR11246 cont'd: Add options for cache controlJosh Stone2010-03-021-3/+7
| | | | | | | | | | | | | | | | --disable-cache : turn off all caching --clean-cache : clean up stale entries and then quit --poison-cache : force regeneration of items that would have hit the cache These are undocumented for now, until we decide whether they are generally useful. * main.cxx (main): Parse the new options. * session.h (systemtap_session): Add poison_cache; document the others. * clean.cxx (clean_cache): No longer static. (get_stapconf_from_cache, get_script_from_cache): Respect poison. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto. (dwarf_cast_expanding_visitor::filter_special_modules): Ditto.
* PR11246 cont'd: Separate script/stapconf cachingJosh Stone2010-03-021-14/+30
| | | | | | | | | | | I'm separating the caching and creation logic for stapconf, so it can be conditionalized on s.use_cache instead of s.use_script_cache. * session.h (systemtap_session): Store base_hash for better reuse. * hash.cxx (get_base_hash): Get the base from the session, or build it. (find_hash): Split into separate script/stapconf versions. * cache.cxx (add_to_cache, get_from_cache): Ditto. * main.cxx (main): Adapt caller, and delay stapconf until pass-4.
* PR11246: Add more granular cache controlJosh Stone2010-03-021-4/+7
| | | | | | | | | | | | | | There are some module options that require us to disable caching for the script, but before now this had a global effect. There are some cache objects, like tracepoint and @cast query modules, which we would like to cache even when the script itself needs to be uncached. * session.h (systemtap_session): New use_script_cache flag. * main.cxx (main): -m & -k can just disable the script cache. Failure to create the cache directories still disables all caching. * hash.cxx (create_hashdir): Failure disables all caching. * cache.cxx (add_to_cache): Failure only toggles the script caching. If the stapconf fails though, we don't need to block the .ko reuse.
* PR9931: generate log to help diagnosing occasional cache hash collisionsWenji Huang2010-02-031-0/+20
| | | | | | | | | | | | | | | | | Ideas from Frank Ch. Eigler: - extending the hash.add() function to pass names along with the hash-mix values, so that class hash can internally track the hash-report string - storing the reports themselves in the cache, beside the .ko / .c files, and changing the cache-size-limit logic to delete these .txt files upon garbage collection * hash.h : New member parm_stream. * hash.cxx (get_parms): New function to convert parms stream to string. (hash::add): Aggregrate parms stream. (create_hash_log): New function to log hash operation. (find_*_hash): Log hash at the end of function. * cache.cxx (clean_cache): Remove log when cache reaches limitation.
* Don't reference global variable modpath in insert_module and its helpers.Dave Brolley2009-11-091-0/+7
| | | | | | | | | | | 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.
* Remove cached signature files along with modulesJosh Stone2009-09-281-4/+9
| | | | | * cache.cxx (cache_ent_info::cache_ent_info): Count the sgn in the size (cache_ent_info::unlink): Remove the sgn too.
* Simplify copy_file callsJosh Stone2009-09-281-26/+8
| | | | | | | | | | | | | | Every single copy_file call we had was converting strings to char*, printing the same error message, and optionally printing the same verbose string. Let's canonicalize that. * util.cxx (copy_file): Take string filenames, add a verbose flag, and consolidate the message printing. * cache.cxx (add_to_cache): Pass strings and remove message printing. (get_from_cache): Ditto. * main.cxx (main): Ditto. * tapsets.cxx (tracepoint_builder::get_tracequery_module): Ditto. (dwarf_cast_expanding_visitor::filter_special_modules): Ditto.
* 2009-09-14 Dave Brolley <brolley@redhat.com>Dave Brolley2009-09-141-49/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modsign.cxx (init_cert_db_path): Use 'system' call. (sign_module): Renamed to 'main'. This is now an independant program. Check for arguments. Return 1 on error. * buildrun.cxx (modsign.h): Don't #include it. (compile_pass): Don't sign the module. * main.cxx (main): Don't copy the module signature. * cache.cxx (add_to_cache): Don't cache the module signature. * Makefile.am (bin_PROGRAMS): Add stap-sign-module. (stap_SOURCES): Remove modsign.cxx and nsscommon.c. (stap_sign_module_SOURCES): New variable. (stap_sign_module_CPPFLAGS): New variable. (stap_sign_module_LDFLAGS): New variable. (stap_sign_module_LDADD): New variable. * stap-server (initialization): Initialize unprivileged. (parse_options): Handle --unprivileged. (create_response): Call stap-sign-module if --unprivileged was specified. * systemtap.spec: Add stap-sign-module to stap-server. * Makefile.in: Regenerated. * doc/Makefile.in: Regenerated. * doc/SystemTap_Tapset_Reference/Makefile.in: Regenerated. * grapher/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * aclocal.m4: Likewise. * testsuite/aclocal.m4: Likewise. * configure: Likewise. * testsuite/configure: Likewise.
* PR10543: do module cache cleaning before copying new file into the cacheFrank Ch. Eigler2009-08-211-2/+4
| | | | | | ... otherwise the new stuff can get cleaned before use. * cache.cxx (add_to_cache): Do clean_cache() first, not last.
* Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-08-041-0/+7
|\ | | | | | | | | | | Conflicts: cache.cxx
| * PR10204: Place userspace markers in systemtap itselfKent Sebastian2009-07-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | * 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
| * Module signing and verification using a separate file for the module signature.Dave Brolley2009-05-041-2/+48
| |
* | Only sign modules if --unprivileged is specified.Dave Brolley2009-06-111-21/+12
| | | | | | | | | | | | 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.
* | 2009-04-30 Dave Brolley <brolley@redhat.com>Dave Brolley2009-04-301-25/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | * modsign.cxx (unistd.h,sts/stat.h,systypes.h,pwd.h): #include them. (check_cert_file_permissions, check_db_file_permissions) (check_cert_db_permissions): New functions. (check_cert_db_path): Don't check for keyFiles. * main.cxx (usage): Remove --signing-cert option. (main): Likewise. * cache.cxx (cassert): #include it. (add_to_cache): Assume the module is signed. * buildrun.cxx (compile_pass): Always sign the module. * stap-server.8.in: Update documentation.
* | Merge branch 'master' of git://sources.redhat.com/git/systemtapDave Brolley2009-04-211-2/+16
|\|
| * Cleanup typequery user modules from the cache tooJosh Stone2009-04-201-2/+16
| |
* | 2009-04-14 Dave Brolley <brolley@redhat.com>Dave Brolley2009-04-141-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* | 2009-03-12 Dave Brolley <brolley@redhat.com>Dave Brolley2009-03-121-2/+37
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Clean up the autoconf cachingJosh Stone2009-02-071-45/+117
| | | | | | | | | | | | | | | | | This makes the stapconf caching process quite a bit more transparent. The options are now cached in a header file as #defines, and this header file is a normal build dependency instead of calling so many make $(shell ...) commands. * buildrun.cxx (compile_pass): Pull in autoconf options in a header of #defines rather than -DXXX, and make that header a build dependency. * buildrun.cxx (output_autoconf): New function to consolidate the computation of each autoconf test. * cache.cxx (add_to_cache, get_from_cache, clean_cache): Start treating the stapconf header as a first-class cached item. * cache.h: Move definitions of things only needed in cache.cxx * hash.cxx (find_stapconf_hash): Generate stapconf_name as a .h now. * main.cxx (main): Default the stapconf_name based on getpid().
* Add Vim modelines for GNU style in stapJosh Stone2009-01-281-0/+2
|
* buildrun/caching warning cleanupFrank Ch. Eigler2008-11-291-5/+12
|
* Added creation of a default cache limit file if it doesn't exist.root2008-10-171-4/+6
|
* Minor changes to cache.cxx (cache_clean).Kent Sebastian2008-10-171-32/+15
|
* copyright year tweakFrank Ch. Eigler2008-10-151-1/+1
|
* build fix for invalid glob (..., NULL, ...) call, as remarked upon by gcc 4.1.2Frank Ch. Eigler2008-10-101-1/+1
|
* Functions implementing cache limiting.Kent Sebastian2008-10-101-0/+168
|
* 2007-05-31 Frank Ch. Eigler <fche@elastic.org>fche2007-05-311-0/+1
| | | | | | PR 3579 From Eugeniy Meshcheryakov <eugen@debian.org> * cache.cxx, parse.cxx: Add #include <cstring> for gcc 4.3.
* 2007-01-29 Frank Ch. Eigler <fche@elastic.org>fche2007-01-291-0/+12
| | | | | | | | | * main.cxx (main): For successful last_pass=4, print compiled module name. * cache.cxx (get_from_cache): Ditto. 2007-01-29 Frank Ch. Eigler <fche@elastic.org> * systemtap.base/cache.exp (stap_compile): Accept new -p4 output.
* 2006-11-08 David Smith <dsmith@redhat.com>dsmith2006-11-081-2/+13
| | | | | | * cache.cxx (get_from_cache): To preserve semantics with non-cached use, if the last pass is 3, display the cached C source.
* 2006-10-23 David Smith <dsmith@redhat.com>dsmith2006-10-231-0/+113
* main.cxx (printscript): New function containing code moved from main(). (main): Added code to create cache directory, call function to generate hash, and see if we can use cached source/module. If pass 4 is actually run to produce a new module, we call add_to_cache() to cache the result. * session.h (struct systemtap_session): Added hash/cache session data. * cache.cxx: New file handling adding/getting files from the cache. * cache.h: New header file for cache.cxx. * hash.cxx: New file containing C++ wrapper for routines in mdfour.c and the find_hash function which computes the hash file name for an input script. * hash.h: New header file for hash.cxx. * mdfour.c: New file containing MD4 hash code. * mdfour.h: New header file for mdfour.c. * util.cxx: New file containing several utility functions used by the caching code. * util.h: New header file for util.cxx. * Makefile.am: Added new C/C++ files. * Makefile.in: Regenerated.