In commits e772a6e and 9891c54, we improved the way query_callee() and
query_label() add intermediate probes to the derivation chain by playing
with the dwarf_query. This technique will be required many times in
other places that we will need to fix up.
Therefore, we create two new dwarf_query helper functions. The
mount_well_formed_probe_point() function simply sets the current
base_loc and base_probe of the dwarf_query object to a new one, which is
denoted well-formed.
At first, this new location is simply a copy of the previous location,
with the exception of a fully resolved process/module path. Then,
depending on the probe point type, specific functors are replaced by
their final/non-globby versions to create a truly well-formed probe
point.
More helper functions to edit the functors will be added in the next
patch.
The unmount_well_formed_probe_point() refocuses the dwarf_query to the
previous base_loc/base_probe so that further probe points can be
derived.
Jonathan Lebon [Wed, 14 May 2014 14:31:07 +0000 (10:31 -0400)]
sdt_query: set well-formed intermediate probe
The specific_loc intermediate probe created in
sdt_query::convert_location() is already well-formed. We mark it as such
so that listings will use this probe.
Jonathan Lebon [Tue, 13 May 2014 20:18:43 +0000 (16:18 -0400)]
simplify derived_probe::script_location()
Rather than relying on yucky heuristics, we go the explicit way. The
script_location() function now relies on the new probe_point member
'well_formed', which is true if the probe point represents the 'final'
script-level expression, after wildcard expansion.
Since only each individual probe builder knows what constitutes a
well-formed probe point, it will be up to those to set the 'well_formed'
flag as needed. If the probe point that we want to list is also the
final one, which is the case for many simpler probe points, then no
further work is needed. The following patches modify the appropriate
builders to do just this.
David Smith [Wed, 21 May 2014 19:09:41 +0000 (14:09 -0500)]
Fix BZ16960 by handling !CONFIG_USER_NS better.
* buildrun.cxx (compile_pass): Convert the from_kuid_munged() test to a
compile test, instead of an export test.
* runtime/linux/runtime.h: Restore original CONFIG_USER_NS support.
* runtime/linux/autoconf-from_kuid_munged.c: New autoconf test.
Frank Ch. Eigler [Wed, 21 May 2014 17:43:48 +0000 (13:43 -0400)]
linux runtime: switch to vmalloc for context[] element allocation
The new eventcount.stp changes can result in relatively large context
structures (33712 bytes each on f19/x86-64), which the stp_kmalloc
widget can sometimes fail to allocate. Switching to the numa-aware
vmalloc front-end lets these allocations succeed.
Frank Ch. Eigler [Sat, 17 May 2014 20:15:01 +0000 (16:15 -0400)]
linux/runtime.h: more CONFIG_USER_NS fallout
Partially unrolling commit 7d35a948401, because on modern kernels
(3.14+), the from_k?id_munged functions are defined as inlines, and
should be used regardless of CONFIG_USER_NS etc. The buildrun.cxx
exportedness test for from_kuid_munged would fail, triggering our
runtime to use a do-nothing macro instead.
Until a more programmatic way is found for those unidentified older
kernels that have CONFIG_USER_NS but no from_k?id_munged inlines,
for now a user will have to work around the build problem with
Jonathan Lebon [Mon, 12 May 2014 13:50:20 +0000 (09:50 -0400)]
sdt_varname.exp: small tweaks
1. Only run testcase if installtest
2. Uncomment the (mistakenly commented out) code that cleans up the
testing directory upon exit
3. Enable -fPIC when compiling library, which can yield different forms
of operands, thus improving the testing range
Jonathan Lebon [Fri, 9 May 2014 19:57:28 +0000 (15:57 -0400)]
Merge branch 'jlebon/pr13296'
This merge gives SystemTap the ability to decode SDT operands that refer
to symbols. There are also a few code cleanups, such as:
- Removal of SDT probing code that supports a hypothetical kernel
mode.
- Removal of old unused symbol table code for reading in symbols by
reading output from nm or from a file.
- Major refactoring of the sdt_uprobe_var_expanding_visitor::
visit_target_symbo_arg() function to make it easier to understand
the overall structure.
- Strengthening of sections/note entry checks before parsing probe
information.
Jonathan Lebon [Thu, 1 May 2014 15:59:15 +0000 (11:59 -0400)]
PR13296: allow SDT operands using VARNAME
We may encounter SDT operands of the form [OFF+]VARNAME[+OFF][(REG)]
which refers to the address of a object in the symtab. On x86_64, the
REG can be '%rip' to denote RIP-relative addressing.
To do this, we also pass the current dwflpp object to
sdt_uprobe_var_expanding_visitor, which then tries symbol resolution
using the symbol table if it meets upon such an SDT operand.
Jonathan Lebon [Thu, 1 May 2014 15:18:22 +0000 (11:18 -0400)]
symbol_table: remove read_* methods
These methods of retrieving symbols haven't been in use since 2008 (at
least according to the date of the comment mentioning its abandonment).
Rather than having it slowly rot away, let's remove it. Git will
remember it for us if we ever need it back.
Jonathan Lebon [Wed, 23 Apr 2014 15:45:12 +0000 (11:45 -0400)]
setup_note_probe_entry(): strengthen note checks
In dwflpp::iterate_over_notes(), we call back to
sdt_query::setup_note_probe_entry() for every note entry found,
regardless of section name or note name, which is fine.
However, on the callback side in setup_note_probe_entry(), we never
actually check that the section name or note name is correct; we only
check that the note entry type was what we expected.
This means that it could have been possible for setup_note_probe_entry()
to try to blindly parse data from a note entry which was not even a
stapsdt note, which could be dangerous.
This patch adds explicit checks that the section name and the note name
are what we expect.
Jonathan Lebon [Thu, 8 May 2014 19:16:36 +0000 (15:16 -0400)]
callee.exp: simplify shlib testing by using -rpath
We previously started stap separately from the target process because we
needed to set the LD_LIBRARY_PATH variable for it to run properly.
However, if we use the linker option -rpath to add the current directory
to the library path (as is done also in unprivileged_myproc.exp), this
is no longer necessary, thus greatly simplifying the testcase.
William Cohen [Tue, 6 May 2014 20:01:54 +0000 (16:01 -0400)]
Flip condition so proper default picked for STAP_NOP in testsuite/sys/sdt.h
A number of the uprobes code failed to build on aarch64 because the
define for STAP_NOP would default to the unusual "nop 0". The test
has been flipped around so the default is usual "nop" if there is
not something explict.
David Smith [Mon, 5 May 2014 21:25:25 +0000 (16:25 -0500)]
Fix more compile error when we don't have a dwarf unwinder.
* runtime/linux/runtime.h: Fix compilation on systems without
STP_USE_DWARF_UNWINDER defined.
* runtime/unwind/unwind.h: For systems without STP_USE_DWARF_UNWINDER
defined, just define a dummy unwind_context structure along with the
real unwind_cache structure.
David Smith [Mon, 5 May 2014 20:46:40 +0000 (15:46 -0500)]
Fix compile error when we don't have a dwarf unwinder in _stp_tack_kernel_print
* runtime/stack.c (_stp_stack_kernel_print): Use 'c->kregs' instead of
nonexistent 'regs' variable. This code is only compiled when
STP_USE_DWARF_UNWINDER isn't defined.
beginnner's guide configury: compatibility with older publican
Older publican doesn't support the --pdftool=fop option. It's too
much hassle to autoautoconf this (considering the existing fop-related
conditionals at the top level configure.ac), so instead here we try
publican with and then without the --pdftool=fop option.
Stan Cox [Mon, 5 May 2014 14:24:20 +0000 (10:24 -0400)]
Add pyparsing to dtrace
* dtrace.in: pylint cleanups.
(_HeaderCreator): Moved from _provider.
(_PypProvider): New. The pyparsing parser.
(_ReProvider): Moved from _provider. The regexp parser.
(main): Add pyparsing awareness.
Jonathan Lebon [Fri, 2 May 2014 14:19:06 +0000 (10:19 -0400)]
PR16894: new wordexp.exp to check -c COMMAND handling
This simple testcase checks that invalid -c COMMANDs for unspecified
process probes are properly handled (e.g. prior to commit eb94071, we
segfaulted).
Jonathan Lebon [Fri, 2 May 2014 13:43:07 +0000 (09:43 -0400)]
PR16894: give better errors re. -c commands
This patch allows SystemTap to make the distinction when reporting an
error between no -c command given, and a given but invalid -c command.
- man/stapprobes.3stap: introduce 'unspecified' verbiage and clear up
restrictions on unspecified process probes
- session.cxx: cmd_file() now throws errors upon wordexp() failures
- tapsets.cxx: (1) handle possibility of error from cmd_file() and chain
with own error if it occurs
(2) separately handle no -c command / empty file
(3) introduce 'unspecified' verbiage in error messages
and point to [man stapprobes]
- tapset-perfmon.cxx: ditto
Jonathan Lebon [Tue, 29 Apr 2014 18:32:48 +0000 (14:32 -0400)]
pyexample.stp: split into py2example.stp and py3example.stp
In order to be compatible on systems with only python2 installed (or
only python3 installed), we split the pyexample.stp script into two
versions.
We also add a test_support line in the meta files so that check.exp
marks them as untested if either/both python versions are not present.
In the tapsets, we make py2/3 aliases that the scripts then use, but
also create general ones that refer to both the 2 and 3 variants.
The python3 version requires -g --suppress-time-limits, otherwise it's
very likely that a 'overhead exceeded' ERROR.
- py2example.stp: python 2 version of the script
- py2example.meta: meta file for python 2 version, with test_support
check for python 2 specific SDT markers
- py3example.stp: python 3 version of the script
- py3example.meta: meta file for python 3 version, with test_support
check for python 3 specific SDT markers
- tapset/python2.stp: make python2 specific aliases and alias the
general ones to that
- tapset/python3.stp: make python3 specific aliases and alias the
general ones to that
Lukas Berk [Tue, 29 Apr 2014 20:17:36 +0000 (16:17 -0400)]
Fix typo for suppress-time-limits in runtime headers
*man/stap.1 - update man page to properly list macro's
and polarity of statement
*runtime/common_probe_context.h - fix STAP_SUPPRESS_TIME_LIMITS_ENABLE typo
*runtime/runtime_defines.h - ditto
David Smith [Tue, 29 Apr 2014 15:54:27 +0000 (10:54 -0500)]
PR16716 partial fix: Fix types in syscall.{dup,dup2,dup3}.
* tapset/linux/syscalls.stp: Fixed types in syscall.{dup,dup2,dup3}.
* tapset/linux/aux_syscalls.stp (_dup3_flag_str): Just use the open mode
flags list.
* testsuite/systemtap.syscall/dup.c: Add more tests.
Jonathan Lebon [Thu, 24 Apr 2014 16:53:06 +0000 (12:53 -0400)]
new helper script scripts/update-copyrights
This script looks at all the tracked files in the tree that are
copyrighted by <company> and updates the copyright year if they've been
modified this year by a user at <domain>.
PR16406: fix build-id false mismatch for userspace-program vs. kernel-module
The translate.cxx-emitted _stp_module array has two name fields, .name
and .path, which were ambiguous as to whether each was a kernel module
or a userspace executable. The .name string was just the basename,
and it was used in the near-startup-time _stp_module_check(). If the
userspace program matched a kernel module, bangorama (a false build-id
mismatch error at startup) .. unless --all-modules was given, in
which case the kernel modules won the duplication race.
The correction has a couple of parts. First, the _stp_module .name is
made the same as the fully-/-qualified .path for userspace programs.
Second, _stp_module_check checks all kernel+module bits it knows
about, not just the first one. Hand-tested with a variety of runs,
and with the *myproc.exp test, which is now forced to try to conflict.
* translate.cxx (dump_unwindsym_ctx): Make userspace _stp_module->name's
fully-/-qualified.
* runtime/sym.c (_stp_module_check): Check all and only kernel-space
build-ids. Filter by _stp_module->name.
(stp_kmodule_check, stp_usermodule_check): WARN_ON wrong-polarity
incoming module/path name.
* testsuite/.../unprivileged_myproc.exp: Run 'modprobe loop'
Jonathan Lebon [Mon, 28 Apr 2014 21:00:39 +0000 (17:00 -0400)]
unprivileged_myproc.exp: only KFAIL .callee(string)
This is a followup to the followup commit 9d4241d. The .callees and
.callees(number) probes will always work because they will match ibar().
Only the .callee(string), which is turned to .callee("tbar"), should be
KFAILed, since it will definitely fail for GCC < 4.7.
Jonathan Lebon [Mon, 28 Apr 2014 20:24:32 +0000 (16:24 -0400)]
unprivileged_myproc.exp: adjust loop.c
The process("./loop").function("ibar").inline probe was failing in this
test because of a bug in GCC (RHBZ1092144). In a nutshell, GCC unrolls
the loop once, resulting in ibar() being called twice: once outside the
loop and once inside. However, only the former gets a corresponding
inlined_subroutine DIE. As a result, the SystemTap probe only fires once
at startup rather than at every iteration.
This patch takes out the if-expression in the loop so that GCC doesn't
need to do any unrolling and we end up with two inlined_subroutine DIEs.