hunt [Fri, 17 Aug 2007 20:02:15 +0000 (20:02 +0000)]
2007-08-17 Martin Hunt <hunt@redhat.com>
PR3857
From Masami Hiramatsu
* utt.c (utt_subbuf_start_callback): Use overwrite flag.
* control.c (_stp_ctl_open_cmd): Set overwrite_flag off.
(_stp_ctl_close_cmd): Set overwrite flag on.
fche [Fri, 17 Aug 2007 17:29:30 +0000 (17:29 +0000)]
2007-08-17 Frank Ch. Eigler <fche@elastic.org>
As suggested by "Zhaolei" <zhaolei@cn.fujitsu.com>:
* elaborate.cxx (semantic_pass_optimize[12],
unresolved, invalid, mismatch): Use stringstream and
print_error(semantic_error) instead of ad-hoc cerr.
jistone [Fri, 17 Aug 2007 01:54:28 +0000 (01:54 +0000)]
2007-08-16 Josh Stone <joshua.i.stone@intel.com>
PR 4591
* parse.cxx (parser::parse_symbol): Tweak 'print' matching to allow
all the new variants with printd and println.
* staptree.h (struct print_format): Add fields for the new print
variants, and parse_print() to help matching.
* staptree.cxx (print_format::parse_print): New static method to
match the print variants and determine their properties.
(print_format::print): Handle the new print types.
(deep_copy_visitor::visit_print_format): Copy the new fields.
* translate.cxx (c_unparser::visit_print_format): Insert delims and
newlines where appropriate for new print functions.
* stap1.in: Document the new print functions.
testsuite/
* lib/stap_run.exp: Make sure to match the entire output, in case
there are multiple pass/fail messages.
* buildok/printf.stp: Add lines for new print variants.
* parseko/printd01.stp: Make sure that bad printd calls are handled.
* parseko/printd02.stp: Ditto.
* parseko/printd03.stp: Ditto.
* parseko/printd04.stp: Ditto.
* systemtap.base/print.stp: Try a bunch of different print calls.
* systemtap.base/print.exp: Driver for above.
hunt [Thu, 16 Aug 2007 12:55:19 +0000 (12:55 +0000)]
2007-08-16 Martin Hunt <hunt@redhat.com>
* aux_syscalls.stp (__get_argv): Add parameter to
optionally skip the first argv (argv[0]).
(__get_compat_argv): Ditto.
* syscalls.stp (execve): Set args to the whole argv.
For argstr use filename plus argv starting at [1].
(compat_execve): Ditto.
* ppc64/syscalls.stp (sys32_exevve): Ditto.
From Cai Fei <caifei@cn.fujitsu.com>
* syscalls.stp (sts_getpgid): Add pid arg.
dsmith [Tue, 14 Aug 2007 19:48:35 +0000 (19:48 +0000)]
2007-08-14 David Smith <dsmith@redhat.com>
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().
* 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.
dsmith [Tue, 14 Aug 2007 19:46:54 +0000 (19:46 +0000)]
2007-08-14 David Smith <dsmith@redhat.com>
Merge from setuid-branch. Changes also by Martin Hunt
<hunt@redhat.com>.
* Makefile.am: Added staprun_funcs.c and cap.c to
staprun_SOURCES. Added -lcap to staprun_LDADD. Removed
stp_check reference. Added stapio program. Staprun is now
setuid.
* Makefile.in: Rebuilt.
* configure.ac: Version increase to 0.6 and checks for libcap
availability. Removed stp_check reference.
* configure: Regenerated.
* stp_check.in: Removed.
* systemtap.spec.in: Version increase to 0.6-1 and added
BuildReq for libcap-devl (and removed sudo requirement).
Added %pre script to create new groups. Staprun is now
setuid.
* NEWS: Added info on new security model.
* INTERNALS: Removed sudo reference.
* README.security: New file.
* main.cxx (main): Make sure module name isn't too long.
* hash.cxx: Moved MODULE_NAME_LEN define to hash.h.
* hash.h: Moved MODULE_NAME_LEN define here from hash.cxx.
* buildrun.cxx (run_pass): No longer runs staprun with "sudo".
* stap.1.in: Removed sudo references and added information about
the stapdev/stapusr groups.
* staprun.8.in: Added information about module detaching and
attaching. Removed sudo references and added information
about the stapdev/stapusr groups. Removed reference to
staprun needing to be run as root. Removed reference to
removed '-u USERNAME' option.
* .cvsignore: Removed stp_check and added stapio and stap_merge.
dsmith [Tue, 14 Aug 2007 15:29:40 +0000 (15:29 +0000)]
2007-08-14 David Smith <dsmith@redhat.com>
Merge from setuid-branch. Changes also by Martin Hunt
<hunt@redhat.com>.
* Makefile.am: Added staprun_funcs.c and cap.c to
staprun_SOURCES. Added -lcap to staprun_LDADD. Removed
stp_check reference. Added stapio program. Staprun is now
setuid.
* Makefile.in: Rebuilt.
* configure.ac: Version increase to 0.6 and checks for libcap
availability. Removed stp_check reference.
* configure: Regenerated.
* stp_check.in: Removed.
* systemtap.spec.in: Version increase to 0.6-1 and added
BuildReq for libcap-devl (and removed sudo requirement).
Added %pre script to create new groups. Staprun is now
setuid.
* NEWS: Added info on new security model.
* INTERNALS: Removed sudo reference.
* README.security: New file.
* main.cxx (main): Make sure module name isn't too long.
* hash.cxx: Moved MODULE_NAME_LEN define to hash.h.
* hash.h: Moved MODULE_NAME_LEN define here from hash.cxx.
* buildrun.cxx (run_pass): No longer runs staprun with "sudo".
* stap.1.in: Removed sudo references and added information about
the stapdev/stapusr groups.
* staprun.8.in: Added information about module detaching and
attaching. Removed sudo references and added information
about the stapdev/stapusr groups. Removed reference to
staprun needing to be run as root. Removed reference to
removed '-u USERNAME' option.
* .cvsignore: Removed stp_check and added stapio and stap_merge.
dsmith [Tue, 14 Aug 2007 15:27:58 +0000 (15:27 +0000)]
2007-08-14 David Smith <dsmith@redhat.com>
Merge from setuid-branch. Changes also by Martin Hunt
<hunt@redhat.com>.
* control.c (_stp_ctl_write): Make sure we don't overflow.
(_stp_ctl_open_cmd): Do not allow multiple opens of the control
file.
(_stp_ctl_write_cmd): Once STP_START is received, ignore
everything except STP_EXIT. Create another state variable
"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
initialized is 0. Also check that current pid is the same as the
pid that did insmod.
(_stp_register_ctl_channel): Bug fix - sets owner/group after
checking for NULL.
* procfs.c (_stp_ctl_write): Make sure we don't overflow.
(_stp_ctl_open_cmd): Do not allow multiple opens of the control
file.
(_stp_ctl_write_cmd): Once STP_START is received, ignore
everything except STP_EXIT. Create another state variable
"initialized". Don't respond to STP_SYMBOLS or STP_MODULES unless
initialized is 0. Also check that current pid is the same as the
pid that did insmod.
(_stp_register_ctl_channel): Set ownership of cmd file and percpu
files for bulkmode.
* relayfs.c (utt_trace_setup): Set ownership of percpu files.
Improved error handling.
(utt_trace_remove): Improved error checking.
* utt.c (utt_remove_tree): Improved error checking.
(utt_trace_cleanup): Ditto.
(utt_create_buf_file_callback): Set file ownership.
(utt_create_global_buf_file_callback): Set file ownership.
* transport.h: Delcare _stp_uid, _stp_gid, and _stp_init_pid.
* transport.c (_stp_transport_init): Set _stp_uid, _stp_gid, and
_stp_init_pid.
dsmith [Tue, 14 Aug 2007 15:23:59 +0000 (15:23 +0000)]
2007-08-14 David Smith <dsmith@redhat.com>
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().
* 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.
jistone [Sat, 11 Aug 2007 02:19:25 +0000 (02:19 +0000)]
2007-08-10 Josh Stone <joshua.i.stone@intel.com>
PR 4593
* translate.cxx (c_unparser::emit_common_header): Add an
error_buffer to the context to allow dynamic error messages.
* tapsets.cxx (dwflpp::express_as_string): Let deref / store_deref
fill in last_error with a detailed message.
runtime/
* loc2c-runtime.h (deref, store_deref): Set an error message with
the pointer value and name into last_error, since it's hard to
determine the details once you've already jumped to deref_fault.
tapset/
* conversions.stp (kernel_string, kernel_long, kernel_int,
kernel_short, kernel_char, user_string_warn): Use the
CONTEXT->error_buffer to create an error message instead of a static
local array.
dsmith [Tue, 7 Aug 2007 14:33:41 +0000 (14:33 +0000)]
2007-08-07 David Smith <dsmith@redhat.com>
PR 4736 (partial fix)
* systemtap.printf/end1b.exp: Changed 'FAIL' to 'fail', so
the rest of the testsuite will continue.
* systemtap.printf/mixed_outb.exp: Ditto.
* systemtap.printf/out1b.exp: Ditto.
* systemtap.printf/out2b.exp: Ditto.
* systemtap.printf/out3b.exp: Ditto.
PR 4295
* systemtap.samples/args.exp: Tests to make sure the '-m' option
leaves a module in the current directory.
* systemtap.base/cache.exp (stap_compile): Added cleanup.
* systemtap.maps/pmap_agg_overflow.exp: On single processor
systems, this test reported an unsupported test and a test failure
when it should have only reported an unsupported test. Fixed.
* syscall*.stp: Major reorganization work.
* aux_syscalls.stp (_sigprocmask_how_str): Rewrite
in C so real arch-dependent header files
will be used.
(_mlockall_flags_str): Ditto.
roland [Tue, 3 Jul 2007 19:49:36 +0000 (19:49 +0000)]
2007-07-03 Roland McGrath <roland@frob.com>
* Makefile.am (install-exec-local, install-elfutils): Use $(DESTDIR).
(SRCDIR): Variable removed.
(check): Use sh code in commands instead.
* Makefile.in: Regenerated.