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.
Stan Cox [Tue, 12 Jan 2010 20:09:55 +0000 (15:09 -0500)]
Add attach to live process tests.
* sdt_misc.exp (sdt_misc.c): New funcs loop_check, int_handler, alrm_handler.
(sdt_misc.sdt): Add timer.ms
(test attach to a running process): New.
(test attach to a running process with .so markers): New.
Stan Cox [Mon, 11 Jan 2010 02:43:17 +0000 (21:43 -0500)]
Pull set of semaphore into its own function.
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls): Move
sdt_sem_address from standalone to stap_uprobes. Remove sdt_sem_tid.
In emitted function stap_uprobe_change_plus distinguish VM_EXEC/VM_WRITE
cases, use sdt_sem_address member, move setting of semaphores to new
emitted function stap_uprobe_change_semaphore_plus.
(stap_uprobe_process_found): Call stap_uprobe_change_semaphore_plus.
(stap_uprobe_mmap_found): Likewise.
* stap-postgres.stp (postgresrelease): New. Sync to current upstream version.
* stap-tcl.sh: Check if wget failed.
* stap-tcl.stp: Check for skipped probes.
* xulrunner.exp: Check if wget failed.
* tapsets.cxx (emit_module_decls): #undef TRACE_INCLUDE_FILE
in front of each #include'd trace/event header, to prevent
macro redefinition.
(init_dw): Respect pending_interrupts in traceprobe module
compilation loop.
David Smith [Fri, 8 Jan 2010 19:26:47 +0000 (13:26 -0600)]
Fixed PR 11148 by reworking transport directory locks.
* runtime/transport/transport.c (_stp_get_root_dir): No longer
locks/unlocks the transport directory.
(_stp_remove_root_dir): Ditto.
(_stp_transport_fs_init): Locks and unlocks the transport directory.
Ensures that the root directory can't be deleted between calling
_stp_get_root_dir() and creating the module dir.
(_stp_transport_fs_close): Locks and unlocks the transport directory.
Mark Wielaard [Thu, 7 Jan 2010 16:54:28 +0000 (17:54 +0100)]
Fix multi-piece constant failure in vta-test.exp on 32bit systems.
Commit 73b5e9 "Make sure loc2c declare_noncontig_union for different locs
don't overlap", wasn't complete. It only took into account having a piece
becuase of a noncontiguous loc and a constant loc together. But pieces can
be nested deeper (newer gcc outputs multiple constant locations for one
piece on 32bit systems). This patch keeps track of the piece declaration
depth. Another approach could have been to have each sub-piece in its own
local scope, but keeping track of the depth and naming the temporary unions
distinct fitted the current code better. It currently only supports a depth
of 10. An error will be emitted if a location construct needs more than 10
pieces to be assembled.
* loc2c.c (declare_noncontig_union): Take depth argument. Always use the
same name for the union (u_pieces<depth>).
(translate_base_fetch): Take depth argument. Use it to calculate union
names.
(translate_base_store): Likewise.
(c_translate_fetch): Pass in depth zero.
(c_translate_store): Likewise.
(c_translate_pointer): Likewise.
(c_translate_pointer_store): Likewise.
Mark Wielaard [Wed, 6 Jan 2010 15:24:56 +0000 (16:24 +0100)]
Fix get_cfa_ops failure on shared libraries.
The fix for PR10923 (fafeaf) wasn't completely correct. All cfa lookups
need to be done through the relative pc (without bias) of the module we
are looking in.
* dwflpp.cxx (translate_location): Call get_cfa_ops with relative pc.
Tim Moore [Tue, 5 Jan 2010 14:18:57 +0000 (15:18 +0100)]
bz6436 backtraces from uprobes
This implements proper unwinding from uprobes in the presence of
uretprobe trampolines.
* runtime/stack.c (_stp_stack_print): Rework for uprobe context case
and refactor a bit.
* runtime/uprobes2/uprobes.h (GET_PC_URETPROBE_NONE): new constant
* runtime/uprobes2/uprobes.c (uprobe_get_pc): Support translating the
trampoline function from uprobe context in addition to uretprobe
context.
* runtime/uprobes/uprobes.h (GET_PC_URETPROBE_NONE): ditto
* runtime/uprobes/uprobes.c (uprobe_get_pc): ditto
* tapsets.cxx (uprobe_derived_probe_group::emit_module_decls):
Initialize ri in context to GET_PC_URETPROBE_NONE in generated
enter_uprobe_probe.
* testsuite/systemtap.context/fib.stp: Add an option to do a backtrace
on function entry.
* testsuite/systemtap.context/fib.exp: Test backtrace in function
entry (uprobe) probes.
Mark Wielaard [Tue, 5 Jan 2010 09:29:27 +0000 (10:29 +0100)]
Make publican invocation make -j safe.
publican isn't make -j safe. So cheat a little, always create pdf and html
at the same time, then make html depend on pdf build for copying.
* doc/beginners/Makefile.am ($(SBG).pdf): Also generate html version.
($(SBG).html): Depend on pdf version, then copy.
* doc/beginners/Makefile.in: Regenerated.