David Smith [Wed, 10 Feb 2010 22:35:46 +0000 (16:35 -0600)]
Fixed PR 11270 by adding nd_syscall testcase.
* testsuite/systemtap.syscall/test.tcl: Now uses global variable
'test_script' to find test script to run.
* testsuite/systemtap.syscall/syscall.exp: Sets test_script.
* testsuite/systemtap.syscall/nd_sys.stp: New test script. Copy of
sys.stp, but uses nd_syscall probes.
* testsuite/systemtap.syscall/nd_syscall.exp: New testcase. Copy of
syscall.exp, but uses nd_sys.stp test script.
Mark Wielaard [Tue, 9 Feb 2010 11:22:37 +0000 (12:22 +0100)]
rhbz#563114 Make syscall.pipe sys32_pipe probe alias optional on x86_64.
Some distributions might have backported the pipe fd leak patch and removed
the sys32_pipe kernel function even before 2.6.32. So make the probe alias
optional instead of relying on a version check.
* tapset/x86_64/syscalls.stp (syscall.pipe): Make alias optional.
(syscall.pipe.return): Likewise.
David Smith [Mon, 8 Feb 2010 21:59:29 +0000 (15:59 -0600)]
Fixed BZ559643 by doing 'spawn;expect;wait' instead of 'spawn;wait;expect'.
* testsuite/systemtap.base/labels.exp: Corrected order of
'spawn;expect;wait' calls. Added 'wait' calls when needed. Also,
doesn't run the "labels exe .label" test if uprobes isn't supported.
* tapsets-mark.cxx, tapsets.cxx: Don't even publish probe point families that are
inappropriate for use in --unprivileged mode.
(dwarf_derived_probe_*unprivileged*): Remove, to default to blanket no-permission
rather than emit_process_owner_permission mode.
* testsuite/semko/fortyeight.stp: New test.
Josh Stone [Fri, 5 Feb 2010 01:47:31 +0000 (17:47 -0800)]
PR11234: Rewrite __get_argv without embedded-C
We now implement __get_argv's string building in pure stap script.
Also, every argument is now quoted, which is different than before, but
it's much more robust about handling special characters.
David Smith [Wed, 3 Feb 2010 17:56:58 +0000 (11:56 -0600)]
Fixed PR 11078. Changed code to avoided procfs race condition.
* runtime/procfs.c: Allow STP_MAX_PROCFS_FILES define to be overridden.
(_stp_create_procfs): Calls proc_create() instead of create_proc_entry()
to avoid a race condition.
* runtime/procfs-probes.c: New file containing procfs probe support
routines.
* tapset-procfs.cxx (procfs_derived_probe::join_group): Update struct
_stp_procfs_data definition.
(procfs_derived_probe::emit_module_decls): Include procfs-probes.c,
which is where the definition of struct stap_procfs_probe exists.
Update generated routines to read/write procfs data.
(procfs_derived_probe_group::emit_module_init): Pass file_operations
argument to _stp_create_procfs(). Initialize mutex.
(procfs_var_expanding_visitor::visit_target_symbol): Update generated
code.
Wenji Huang [Wed, 3 Feb 2010 02:21:24 +0000 (10:21 +0800)]
PR9931: generate log to help diagnosing occasional cache hash collisions
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.
David Smith [Tue, 2 Feb 2010 22:14:39 +0000 (16:14 -0600)]
Fix procfs_write.exp so that it will pass under RHELl5.
* testsuite/systemtap.base/procfs_write.exp: Small changes for RHEL5
support.
* testsuite/lib/stap_run.exp (stap_run): Increase maximum number of
characters to match against.
Dave Brolley [Tue, 2 Feb 2010 19:08:31 +0000 (14:08 -0500)]
Compile server logging and robustness.
Log certificate location and status when starting server.
Additional care in handling arguments in stap-serverd.
New test case discovered by fuzzing added and fixed.
Mark Wielaard [Tue, 2 Feb 2010 12:47:19 +0000 (13:47 +0100)]
Make sure cfa_ops are always retrieved through dwfl global address.
dwflpp::translate_location() works on the dw address space, but
get_cfa_ops() starts out with dwfl calls (only dwarf_cfi_addrframe()
needs to be adjusted for bias).
* dwflpp.cxx (translate_location): Pass pc plus module bias through to
get_cfa_ops.
(get_cfa_ops): Adjust for bias when calling dwarf_cfi_addrframe(),
add frame start/end address when found if verbose logging.
* testsuite/systemtap.exelib/lib.stp: Add $foo and $bar variables to
process.function probes.
* testsuite/systemtap.exelib/libmarkunamestack.stp: Likewise.
* testsuite/systemtap.exelib/lib.tcl: Expect correct values for
process.function probe variables.
* testsuite/systemtap.exelib/libmarkunamestack.tcl: Likewise.
Josh Stone [Fri, 29 Jan 2010 05:00:58 +0000 (21:00 -0800)]
PR11234: Ensure __get_argv doesn't overflow
That function was calling strlcpy as if the return value was the number
of bytes copied, but strlcpy actually returns the length of the input
string. We now use min() to handle the case when it's bigger than the
buffer length, and drop out of the loop when that happens.
David Smith [Mon, 25 Jan 2010 21:04:55 +0000 (15:04 -0600)]
Fixed PR 11220 by setting MAP_STRING_LENGTH to MAXSTRINGLEN.
* runtime/map.h: Set MAP_STRING_LENGTH to MAXSTRINGLEN so that large
strings can be stored in arrays.
* testsuite/systemtap.base/array_string.exp: New testcase.
Tim Moore [Wed, 20 Jan 2010 17:05:26 +0000 (18:05 +0100)]
use eh_frame_hdr table to speed up unwinding
* runtime/sym.h (_stp_module): add unwind_hdr_addr member.
* runtime/unwind.c (read_ptr_sect): Modification of read_pointer that
also handles offsets from text or "data" sections.
(read_pointer): Use it.
(_stp_search_unwind_hdr): Use read_ptr_sect to calculate values that
are relative to the .eh_frame_hdr section.
(unwind_frame): Search the frame header if this is an eh frame.
* translate.cxx (get_unwind_data): Get the eh_frame_hdr too.
(dump_unwindsyms): Write out eh_frame_hdr stuff.
Josh Stone [Tue, 19 Jan 2010 23:36:35 +0000 (15:36 -0800)]
PR11195: Prevent all nested argument substitution
Our existing protection only made sure that the first token in a
substitution wasn't a nested substitution. That's not sufficient when
there could be multiple tokens involved. This patch makes sure that no
nested tokens are ever allowed to be argument substitutions.
This also adds a cursor_suspended_line/column and resets the main
cursor_line/column to the beginning of the substitution, so errors will
point a little closer to the right place.
Josh Stone [Mon, 18 Jan 2010 22:36:47 +0000 (14:36 -0800)]
Fix the listing mode of process.library.mark
Our hack for producing nicer listing modes was to write the mark name in
component index 1. That's fine for process.mark, but writes the wrong
position for process.library.mark. It now munges the last probe
component of any number of indexes.
(A better fix is due in PR10831, preserving the derivation chain.)
Mark Wielaard [Mon, 18 Jan 2010 08:13:30 +0000 (09:13 +0100)]
PR11173 Markers get a bad address in prelinked libraries.
Our literal_addr_to_sym_addr() function was just wrong. To compensate for
raw addresses read from elf (either given by the user or through a mark
transformation) we need to know what the elf_bias is (as returned by
dwfl_module_getelf) before feeding them to any libdwfl functions.
* tapsets.cxx (query_module_dwarf): Always add elf_bias to raw function or
statement addresses before calling query_addr().
(query_addr): Don't call literal_addr_to_sym_addr().
* dwflpp.h (literal_addr_to_sym_addr): Removed.
* dwflpp.cxx (literal_addr_to_sym_addr): Likewise.
Frank Ch. Eigler [Fri, 15 Jan 2010 08:06:52 +0000 (03:06 -0500)]
PR11105: robustify stap-server
* main.cxx (main): Always downgrade client-provided -p5 to -p4.
* stap-client (unpack_response): Sanitize stdout due to same.
* stap-server-connect.c: Eliminate a bunch of globals.
(handle_connection): Make things locals instead. Base tmp files
on $TMPDIR.
(spawn_and_wait): New helper function.
(handleRequest): New monster function to inline rest of old
stap-server-request.
Josh Stone [Fri, 15 Jan 2010 00:40:45 +0000 (16:40 -0800)]
PR11151: Recover stap_uprobes slots on process exit
When a process exits, it won't necessarily bother to munmap all of its
shared libraries. This patch makes sure that with uprobes in libraries,
we still grab an exit notification and clear everything out.
* runtime/uprobes-common.c (stap_uprobe_process_munmap): New.
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Use above
callback so that we can recover our resources on process exit.
Stan Cox [Thu, 14 Jan 2010 03:26:10 +0000 (22:26 -0500)]
Use __access_process_vm_noflush for static user semaphore decrement.
* access_process_vm (__access_process_vm_noflush): New
* tapsets.cxx (uprobe_derived_probe_group::emit_module_exit): Use it.
* translate.cxx (translate_pass): Declare it.
Tim Moore [Wed, 13 Jan 2010 18:37:51 +0000 (19:37 +0100)]
map through uretprobe trampoline in an arbitrary task
* runtime/uprobes2/uprobes.c (uprobe_get_pc_task): new function
(lookup_uretprobe): new helper function
(uprobe_get_pc): use it
* runtime/uprobes2/uprobes.h (uprobe_get_pc_task): declare
* runtime/uprobes/uprobes.c : ditto
* runtime/uprobes/uprobes.h : ditto
David Smith [Wed, 13 Jan 2010 15:30:12 +0000 (09:30 -0600)]
Fix PR11160 by handling ppc syscall.sigaction32 correctly.
* tapset/aux_syscalls.stp (_struct_old_sigaction32_u): New function.
* tapset/syscalls2.stp (syscall.sigaction32): Uses new
_struct_old_sigaction32() function to provide a human readable version
of the sigaction argument.
* testsuite/systemtap.syscall/test.tcl (run_one_test): Use additional C
flags when pre-processing test files to better determine which tests are
valid on which platforms.
Mark Wielaard [Wed, 13 Jan 2010 14:11:58 +0000 (15:11 +0100)]
Faulty conditionals are parse errors, not semantical errors.
The test was correct, the given construct should fail. But it fails because
it is a parse error, not because it is a semantical error. So move into the
right pass1-4 sub-directory.
* testsuite/semko/conditional.stp: Moved to...
* testsuite/parseko/conditional.stp: ... here.
Wenji Huang [Wed, 13 Jan 2010 03:27:48 +0000 (11:27 +0800)]
PR10493: autoconf for cpu_khz
* buildrun.cxx (output_cpu_khz): New function to check cpu_khz.
(compile_pass): Invoke function output_cpu_khz.
* runtime/time.c : Use STAPCONF_CPU_KHZ.