Jonathan Lebon [Thu, 14 May 2015 14:29:50 +0000 (10:29 -0400)]
make from_glob a per-component field rather than per-pp
The original need for from_glob in probe_point was to distinguish
"specified" probe points from those that were still generic/globby. E.g.
so that we know to make function suggestions for
process("/usr/bin/ls").function("bad_func") but not yet for
process("/usr/bin/l*").function("bad_func").
The issue however is that there is no distinction between which
component is from a globby one. E.g. if we have
process("/usr/bin/l*").library("libc").function("bad_func"), which
becomes process("/usr/bin/ls").library("libc").function("bad_func"), we
won't know while resolving the library whether from_glob is true because
the process was globby or because the library was globby.
Thus, the 'from_globbiness' is a property of the component, not the
whole probe point. In this commit, we make from_glob instead a member of
probe_point::component. We then add a from_globby_comp() function which
can be used to determine if a specific component was derived from a
globby one.
Martin Cermak [Wed, 13 May 2015 15:06:34 +0000 (17:06 +0200)]
PR18398: Tapset support for {get,set}_thread_area syscalls
* tapset/linux/i386/aux_syscalls.stp: New function _struct_user_desc_u()
* tapset/linux/i386/nd_syscalls.stp: Decode struct user_desc
* tapset/linux/i386/syscalls.stp: Ditto
* tapset/linux/x86_64/aux_syscalls.stp: New function _struct_user_desc_u()
* tapset/linux/x86_64/nd_syscalls.stp: New probes nd_syscall.{get,set}_thread_area
* tapset/linux/x86_64/syscalls.stp: New probes syscall.{get,set}_thread_area
* testsuite/buildok/nd_syscalls-arch-detailed.stp: New subtests
* testsuite/buildok/syscalls-arch-detailed.stp: New subtests
* testsuite/systemtap.syscall/thread_area.c: New testcase
Martin Cermak [Tue, 28 Apr 2015 16:23:24 +0000 (18:23 +0200)]
PR18343: New tapset handling the clock_adjtime syscall
* tapset/linux/nd_syscalls.stp: New nd_syscall.clock_adjtime
* tapset/linux/syscalls.stp: New syscall.clock_adjtime
* testsuite/buildok/nd_syscalls-detailed.stp: Test script level vars
* testsuite/buildok/syscalls-detailed.stp: Likewise
* testsuite/systemtap.syscall/clock.c: Syscall test coverage
Martin Cermak [Tue, 28 Apr 2015 04:45:02 +0000 (06:45 +0200)]
PR18337: Test coverage improvements, tapset extension.
* tapset/linux/aux_syscalls.stp: New auxiliary function _kexec_flags_str()
* tapset/linux/nd_syscalls.stp: Fix types and nesting for kexec_load
* tapset/linux/syscalls.stp: Likewise
* testsuite/buildok/nd_syscalls-detailed.stp: Test the flags_str variable
* testsuite/buildok/syscalls-detailed.stp: Likewise
* testsuite/systemtap.syscall/kexec_load.c: New testcase
* testsuite/systemtap.syscall/set_tid_address.c: New testcase
David Smith [Mon, 27 Apr 2015 18:21:50 +0000 (13:21 -0500)]
Fix PR17986 by updating the unprivileged_probes.exp test case.
* testsuite/systemtap.unprivileged/unprivileged_probes.exp: Run the loop
executable in the background so that all 'process(number)' probes get a
valid pid.
* testsuite/systemtap.unprivileged/foo.c: Deleted unused file.
* testsuite/systemtap.unprivileged/libfoo.c: Ditto.
Mark Wielaard [Fri, 24 Apr 2015 17:59:32 +0000 (19:59 +0200)]
Filter out descriptor/SHN_UNDEF symbols in symbol_table::lookup_symbol.
With newer elfutils (>= 0.158) function descriptor symbols get resolved
to their actual function entry address. With older elfutils we mark such
symbols as descriptor through reject_section (because their address will
match the .opd). Filter these symbols out in symbol_table::lookup_symbol
and symbol_table::lookup_symbol_address. None of the callers want these
SHN_UNDEF/descriptor symbol (addresses).
This solves another instance of Multiple 'sys_ni_syscall' symbols found
warning on ppc64[be] with older elfutils.
Inspired by wcohen's speculate.stp tapset/testcase and cibegttd@irc's
needs, this script prints a statement-execution trace for a given
function, but only for those runs of the function that ended up with a
(configurable) post-return condition. It turns out to be a neat
multipurpose widget, for random-sampled function tracing as well as
failure analysis.
Previous code had imperfect heuristics about cutting apart parts of
erroneous source lines, with a colorized token in the middle. It
could occur that the token was synthetic, or cmd-line $/@ based,
in which case the srcline-cutting arithmetic could go off-end and
cause a basic_string::substr: exception. New code dabbles less in
heuristics and confirms that the token content actually matches
the srcline content. In case of a mismatch, the original srcline
around the token's location is transcribed verbatim (with ellipses).
Mark Wielaard [Thu, 23 Apr 2015 13:59:49 +0000 (15:59 +0200)]
ppc64le doesn't have function descriptors. Remove __powerpc__ in tapsets.cxx.
Only process the opd section and do function descriptor mangling when
the target is ppc64 ELFv1 ABI. Also filter out any duplicate func_infos.
When seeing a symbol with a name starting with '.' we assume it is a
regular function pointer and not a pointer to a function descriptor and
mangle its name. That might create duplicates if there is also a function
descriptor with that name (the address will already have been resolved to
the same address).
tapsets.cxx: fix symbol/address lookup returned-data to sets passed by value
The symbol_table lookup_symbol[_address] functions are safer if they
return their result-sets by value rather than by pointer. The latter
in specific should be a set rather than a list, to properly eliminate
duplicates.
Martin Cermak [Wed, 22 Apr 2015 17:43:02 +0000 (19:43 +0200)]
PR18293: Test coverage improvements, tapset extension.
* tapset/linux/aux_syscalls.stp: Add auxiliary functions for times and sysinfo.
* tapset/linux/nd_syscalls2.stp: Extend argstr for sysinfo and times.
* tapset/linux/syscalls2.stp: Likewise.
* testsuite/buildok/nd_syscalls2-detailed.stp: New convenience var for times syscall.
* testsuite/buildok/syscalls2-detailed.stp: Likewise for nd_syscall.times.
* testsuite/systemtap.syscall/clock.c: Addo coverage for stime syscall.
* testsuite/systemtap.syscall/syncfs.c: Extend and fix the testcase.
* testsuite/systemtap.syscall/sysctl.c: New testcase.
* testsuite/systemtap.syscall/sysinfo.c: Likewise.
* testsuite/systemtap.syscall/times.c: Likewise.
* testsuite/systemtap.syscall/unshare.c: Likewise.
PPC64 ELF ABI v2 has a Global entry point and a local entry point
for the functions. We need the Local entry point in order to probe
these functions. However, the DIE for these functions in debuginfo
return the function.entrypc which is same as the global entry point.
The local entry point is not encoded in the debuginfo of the ELFs. The
offset to local entry point is however encoded in the st_other field
of these symbols in the symbol table.
We need to use this field to adjust the sym.st_value to actually point
to the local entry point instead of the global entry point.
This patch is in relation to this bug :
https://sourceware.org/bugzilla/show_bug.cgi?id=17638
So, while adding symbols to the sym_table, we add an offset of
PPC64_LOCAL_ENTRY_OFFSET(sym.st_other) to st_value.
And when the function address is queried in query_dwarf_func(), we give
priority to the cached sym_table, where we can retrieve the adjusted
entry address of the function. If we don't get any address from the
symbol table, then we proceed to get from the debuginfo.
Macro definition PPC64_LOCAL_ENTRY_OFFSET has been picked up from glibc.
It won't be defined if we are building systemtap on a machine having
older elf.h and hence, won't recognize PPC64_LOCAL_ENTRY_OFFSET.
Test dwarfless probes on multiple static functions
This patch checks how many symbols were resolved instead of probing on
them which won't require us to go till pass 5. It runs the .stp script
till pass 2. This test can be run with:
make check RUNTESTFLAGS=multisym.exp
systemtap/tapsets.cxx: Fix dwarfless probes on multiple static functions
With multiple static functions with same names in an ELF and in absence
of dwarf, if we probe on one of the functions, then systemtap places
probe only on one static function ignoring the rest. This is because the
mapping between the symbol names and their func_info is a simple map
which doesn't allow insertion of another symbol with the same name.
This patch fixes this issue by changing this map to a multimap which
allows duplicate entries for the same symbol name. lookup_symbol code
will return a set of func_info * instead of a single descriptor for a
function name.
We also need to fix other areas in the code where lookup_symbol() and
lookup_symbol_address() are being called so as to look for a set of
func_info's and a list of Dwarf_Addr's respectively, instead of a single
descriptor.
David Smith [Mon, 20 Apr 2015 21:33:55 +0000 (16:33 -0500)]
Fix PR18264 by adding support for the {name_to,open_by}_handle_at syscalls.
* tapset/linux/syscalls2.stp: Add new 'name_to_handle_at' and
'open_by_handle_at' probes.
* tapset/linux/nd_syscalls2.stp: Ditto.
* testsuite/buildok/syscalls2-detailed.stp: Add new tests.
* testsuite/systemtap.syscall/handle_at.c: New test case.
David Smith [Mon, 20 Apr 2015 21:28:04 +0000 (16:28 -0500)]
Fix PR18284 by improving support/testing for some rt_* syscalls.
* tapset/linux/syscalls2.stp (rt_sigqueueinfo): Import argstr formatting
by decoding siginfo structure.
(rt_sigsuspend): Add argstr formatting of new 'set_uaddr' and
'sigsetsize' convenience variables.
(rt_sigtimedwait): Add s390x fix and decode sigset, siginfo, and
timespec structures in argstr.
(rt_tgsigqueueinfo): New probe.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/aux_syscalls.stp (_stp_siginfo_u): New function.
(_stp_compat_siginfo_u): Ditto.
* runtime/linux/compat_siginfo.h: New file.
* testsuite/buildok/syscalls2-detailed.stp: Test new syscall probe
features.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* testsuite/buildok/aux-syscalls-embedded.stp: Add tests for new
functions.
* testsuite/systemtap.syscall/coverage.tcl: Add rt_sigreturn as an
untestable syscall.
* testsuite/systemtap.syscall/rt_signal.c: Improve testing and add testing
for rt_sigsuspend() and rt_tgsigqueueinfo().
David Smith [Tue, 14 Apr 2015 15:30:13 +0000 (10:30 -0500)]
Fixed PR18262 by adding support for the sync_file_range/syncfs syscalls.
* tapset/linux/syscalls2.stp: Add support for 'sync_file_range' and
'syncfs'.
* tapset/linux/nd_syscalls2.stp: Ditto.
* tapset/linux/aux_syscalls.stp (_sync_file_range_flags_str): New function.
* tapset/arm/registers.stp (_stp_arg): Allow argument 7 to be fetched.
* testsuite/systemtap.syscall/sync_file_range.c: New test case.
* testsuite/systemtap.syscall/syncfs.c: Ditto.
* testsuite/buildok/syscalls2-detailed.stp: Added build test cases for
'sync_file_range' and 'syncfs'.
* testsuite/buildok/nd_syscalls2-detailed.stp: Ditto.
* testsuite/buildok/aux_syscalls-embedded.stp: Added build test case for
_sync_file_range_flags_str().
RHBZ1121363: make dracut module directory configurable
The place where dracut loads modules for the "service systemtap onboot ..."
facility is fixed, but we want its subdirectory to be configurable,
so that different stap installations can avoid stepping on each other.
So now "configure --with-dracutstap=DRACUT_D/MODULEDIR" is available.
David Smith [Fri, 10 Apr 2015 16:06:09 +0000 (11:06 -0500)]
Fix PR13481 by handling arguments passed on the arm stack.
* tapset/arm/registers.stp (_stp_get_stack_nth): New function to get
arguments from the stack.
(_stp_arg): Add support for getting arguments 5 and 6.
(longlong_arg): Adjust argument numbers when needed.
* tapset/linux/nd_syscalls2.stp (nd_syscall.readahead): Add fix for arm.
Mark Wielaard [Fri, 10 Apr 2015 15:53:08 +0000 (17:53 +0200)]
Add fallback to line table and low_pc for function source file/line.
Some DWARF producers (golang) don't emit any decl_file/line/col information.
For function DIEs we can sometimes still retrieve that information based on
the low_pc address the debug line table. Add a new fallback function
dwflpp::pc_line that returns file/line/col information based on pc address
in the current CU.
Mark Wielaard [Fri, 10 Apr 2015 13:09:31 +0000 (15:09 +0200)]
Improve dwflpp::loc2c_error semantic error.
When the dwflpp::loc2c callback was called from loc2c.c code on failure
to translate a location to a C expression we would loose all context.
Keep track of the pc location and context DIE we are trying to translate
so we can add more details to the error message shown to the user.
Mark Wielaard [Thu, 9 Apr 2015 20:17:21 +0000 (22:17 +0200)]
PR17958 escape DWARF names that aren't C identifier strings.
Some language compilers (golang) might output DWARF names that are not
valid C identifier strings. Provide a escaped_indentifier_string ()
function to turn those into valid C identifier strings so the generated
C code compiles cleanly.
Mark Wielaard [Thu, 9 Apr 2015 14:51:56 +0000 (16:51 +0200)]
PR17959 Allow size-less pointer types.
golang might produce a DW_TAG_pointer_type without any size. Assume
the size of the pointer is equal to the address size of the DWARF CU
in that case. Otherwise we might try to create values of type uint0_t.
William Cohen [Thu, 9 Apr 2015 14:20:50 +0000 (10:20 -0400)]
Add a definition of _stp_syscall_get_nr for arm64
Commit 07cecda4dc to fix the syscall_get_nr for 32-bit arm exposed that
there wasn't a definition of _stp_syscall_get_nr for arm64. This adds
the needed definition for arm64.
Mark Wielaard [Thu, 9 Apr 2015 13:44:26 +0000 (15:44 +0200)]
PR17957 Allow "raw" DW_OP_call_frame_cfa in location expressions.
golang will produce DW_OP_call_frame_cfa; DW_OP_consts: 8; DW_OP_plus
location expressions instead of a simple DW_OP_fbreg 8. It will also not
set DW_AT_frame_base, so the frame base/call frame address isn't really
known.
Accept that pattern by signalling we need the frame base in loc2c.c
translate () if we see any DW_OP_call_frame_cfa and just push the
frame_base onto the expression stack. And in location_from_address ()
assume that if no DW_AT_frame_base is given it was implicitly defined
with an DW_OP_call_frame_cfa (so we'll use the CFA as calculated by the
CFI to define the frame base).
David Smith [Wed, 8 Apr 2015 17:01:10 +0000 (12:01 -0500)]
Fixed PR18213 by fixing getting the syscall number on arm kernels.
* runtime/syscall.h: For arm, use our own syscall_get_nr(), since the
kernel supplied one doesn't work well. Rename all uses of
syscall_get_nr() to _stp_syscall_get_nr().
* runtime/linux/task_finder.c: Rename all uses of syscall_get_nr() to
_stp_syscall_get_nr().
* runtime/linux/task_finder2.c: Ditto.
* tapset/linux/aux_syscalls.stp: Ditto.
* tapset/linux/utrace.stp: Ditto.
* stap-serverd.cxx (get_server_mok_fingerprints): Call stat() if readdir()
returns 'DT_UNKNOWN'. Certain filesystems like XFS don't implement
returning the file type.
* stap-serverd.cxx (mok_dir_valid_p): Call stat() if readdir() returns
'DT_UNKNOWN'. Certain filesystems like XFS don't implement returning the
file type.
David Smith [Wed, 1 Apr 2015 15:38:07 +0000 (10:38 -0500)]
Added several small syscall tapset/testsuite fixes.
* tapset/linux/syscalls.stp: Fixed syscall.execveat and added a fix for
arm in syscall.fadvise64.
* tapset/linux/nd_syscalls.stp: Added a fix for arm in
nd_syscall.fadvise64.
* tapset/linux/x86_64/syscalls.stp: Fixed syscall.compat_execve.
* testsuite/systemtap.syscall/getrlimit.c: Updated COVERAGE comment.
* testsuite/systemtap.syscall/syscall.exp: Minor test output
improvement.
* testsuite/systemtap.syscall/nd_syscall.exp: Ditto.
* testsuite/systemtap.syscall/uname.c: New testcase.
Lukas Berk [Mon, 30 Mar 2015 12:20:09 +0000 (08:20 -0400)]
Changed spin-rawhide git-description to match fedora package guidelines
Prerelease snapshots require a YYYYMMDDgit<hash> style release version according
to fedora package guidelines. Changing spin-rawhide to produce the same
As a tool to help diagnose suspected kernel kprobes/uprobes
problems, this script may be helpful to generate "perf probe ..."
command lines from a stap script or probe pattern.
Frank Ch. Eigler [Thu, 26 Mar 2015 20:21:06 +0000 (16:21 -0400)]
numerous small coverity fixes
A mixture of stuff noted for stap 2.7, like missing rc checks, c++ POD
member initialization, @perf() array checks. No actual bugs appear in
this batch, but it should make coverity happier in the future.
Frank Ch. Eigler [Thu, 26 Mar 2015 20:20:09 +0000 (16:20 -0400)]
testsuite: split additional_scripts.exp at installtest_p point
Some of the tests require stap -p5; segregate those at the bottom,
protected by [installtest_p], so the rest of the test still runs &
passes at "make check".
Abegail Jakop [Thu, 19 Mar 2015 15:36:15 +0000 (11:36 -0400)]
remove need for xvfb to generate beginners guide
using xvfb was for a workaround to an issue with publican mentioned
in BZ920216. since the beginners guide docs are generated using xmlto
instead of publican, no longer need the to check for xvfb
Abegail Jakop [Wed, 18 Mar 2015 13:49:00 +0000 (09:49 -0400)]
limit content in beginners guide to generic info
*.xml : remove content where the content is specific to either fedora or
rhel.
*html.xsl: include a title between the nav buttons at the top of the page
Abegail Jakop [Tue, 17 Mar 2015 16:31:02 +0000 (12:31 -0400)]
generate beginners guide with xmlto instead of publican
the beginners guide is generated when --enable-docs is specified and
xmlto is found.
configure.ac: remove publican specific variables and code chunks, since
the beginners guide docs were the last to use publican. create a new
variable to check if xmlto is available.
doc/beginners/Makefile.am: change the requirement from publican to
xmlto. replace the publican commands for generating the html and pdf
docs to xmlto commands.
systemtap.spec: remove publican requirement
Abegail Jakop [Tue, 17 Mar 2015 16:21:22 +0000 (12:21 -0400)]
add images, css and xsl files for beginners guide
*/Common_Content: contains images, css and a few xml files for
generating html and pdf files of the beginners guide using xmlto
*/xsl: contains stylesheets for generating html and pdf files of the
beginners guide using xmlto
David Smith [Fri, 20 Mar 2015 15:45:53 +0000 (10:45 -0500)]
Fix PR18143 by updating tapset/linux/target_set.stp.
* tapset/linux/target_set.stp: Since [nd_]syscall.fork got split into
the [nd_]syscall.{fork,vfork,clone} probes, update the tapset to handle
all 3 probes. Otherwise, we miss clone()/vfork() calls on systems that
don't support process.{begin,end}.
David Smith [Thu, 19 Mar 2015 21:24:33 +0000 (16:24 -0500)]
Adjust fix to PR18122 by displaying the number of environment variables.
* tapset/linux/aux_syscalls.stp (__count_envp): New function.
(__count_compat_envp): Ditto.
* tapset/linux/syscalls.stp: Changed execve, compat_execve, execveat, and
compat_execveat probes to use new __count_envp/__count_compat_envp
functions to display the number of environment variables (instead of
displaying the actual environment variables). Displaying the actual
environment variables can easily overflow MAXSTRINGLEN and doesn't match
what strace does.
* tapset/linux/nd_syscalls.stp: Ditto.
* tapset/linux/i386/nd_syscalls.stp: Ditto.
* tapset/linux/i386/syscalls.stp: Ditto.
* tapset/linux/ia64/nd_syscalls.stp: Ditto.
* tapset/linux/ia64/syscalls.stp: Ditto.
* tapset/linux/powerpc/nd_syscalls.stp: Ditto.
* tapset/linux/powerpc/syscalls.stp: Ditto.
* tapset/linux/s390/nd_syscalls.stp: Ditto.
* tapset/linux/s390/syscalls.stp: Ditto.
* tapset/linux/x86_64/nd_syscalls.stp: Ditto.
* tapset/linux/x86_64/syscalls.stp: Ditto.
* testsuite/buildok/aux_syscalls-embedded.stp: Added test for new functions.
* testsuite/systemtap.syscall/execve.c: Adjusted regexps for new output.
* testsuite/systemtap.syscall/execveat.c: Ditto.
David Smith [Thu, 19 Mar 2015 17:50:31 +0000 (12:50 -0500)]
Add more syscall testsuite test program fixes.
* testsuite/systemtap.syscall/accept4.c: Test on more systems.
* testsuite/systemtap.syscall/adjtimex.c: Be more forgiving with return
values.
* testsuite/systemtap.syscall/clone.c: Fix gcc 5 problems.
David Smith [Thu, 19 Mar 2015 17:20:20 +0000 (12:20 -0500)]
Fix PR18122 by fixing/updating [nd_]syscall.{execve,execveat}.
* NEWS: Mention deprecation of the 'fd' and 'fd_str' variables in the
[nd_]syscall.execveat probes.
* tapset/linux/syscalls.stp (syscall.execve): Add 'env_str' convenience
variable for the list of environment variables. For kernels < 3.7, move
execve tapset support to arch-specific tapset code so we can catch all
calls.
(syscall.compat_execve): Ditto.
(syscall.execveat): Add 'env_str' convenience variable for the list of
environment variables.
(syscall.compat_execveat): Ditto.
* tapset/linux/nd_syscalls.stp: Ditto.
* tapset/linux/aux_syscalls.stp (__get_argv): Improve formatting and
report the difference between an invalid address and a NULL.
(__get_compat_argv): Ditto.
(_adjtimex_return_str): Minor improvement.
* tapset/linux/i386/syscalls.stp: Added execve support for kernels < 3.7.
* tapset/linux/i386/nd_syscalls.stp: Ditto.
* tapset/linux/ia64/syscalls.stp: Ditto.
* tapset/linux/ia64/nd_syscalls.stp: Ditto.
* tapset/linux/powerpc/syscalls.stp: Ditto.
* tapset/linux/powerpc/nd_syscalls.stp: Ditto.
* tapset/linux/s390/syscalls.stp: Ditto.
* tapset/linux/s390/nd_syscalls.stp: Ditto.
* tapset/linux/x86_64/syscalls.stp: Ditto.
* tapset/linux/x86_64/nd_syscalls.stp: Ditto.
* testsuite/systemtap.syscall/syscall.exp: No longer use '--skip-badvars'
when compiling module.
* testsuite/systemtap.syscall/nd_syscall.exp: Ditto.
* testsuite/buildok/nd_syscalls-detailed.stp: Updated.
* testsuite/buildok/syscalls-detailed.stp: Ditto.
* testsuite/systemtap.syscall/execveat.c: Improved a bit.
* testsuite/systemtap.syscall/execve.c: New test case.