Mark Wielaard [Wed, 28 Sep 2011 11:18:18 +0000 (13:18 +0200)]
Introduce gfp_mask variants of _stp allocation functions.
* runtime/alloc.c: Add _stp_kmalloc_gfp(), _stp_kzalloc_gfp() and
_stp_kmalloc_node_gfp() which take a gfp_mask in case you really know
what you are doing.
* translate.cxx (emit_module_init): Use with GFP_KERNEL for context alloc.
* runtime/map.c: Use for init and new functions called at module_init time.
* runtime/stat.c: Likewise.
Mark Wielaard [Tue, 27 Sep 2011 14:21:15 +0000 (16:21 +0200)]
_stp_vma_match_vdso: Don't subtract build_id_len from notes_addr.
Older (pre-0.138) elfutils would erroneously return the address of the
build id note address with the length added. Newer ones never do this.
And we only support elfutils 0.142+ now anyway. Fixes vma_vdso.exp.
Mark Wielaard [Wed, 21 Sep 2011 10:38:24 +0000 (12:38 +0200)]
PR13210 vma/vdso tracking is broken testcase
Add a generic testcase to see if we can track the vma from which a syscall
was made. This might or might not come in through the vdso on the particular
(compat) arch, but should always at least be able to get the vma name.
Currently it fails some of the tests in different ways for different arches
and/or kernel versions.
Stan Cox [Tue, 20 Sep 2011 18:14:46 +0000 (14:14 -0400)]
Add process.plt test.
testsuite/systemtap.base/plt.exp: New test.
testsuite/systemtap.base/plt.c: New test case.
tapsets.cxx (base_query::base_query): .plt requires the elf symbol table.
Mark Wielaard [Tue, 20 Sep 2011 20:22:14 +0000 (22:22 +0200)]
Put struct unwind_frame_info in unwind.h and remove unused task field.
Remove the identical definitions of struct unwind_frame_info from
unwind/i386.h and unwind/x86_64.h and put it in unwind/unwind.h.
Also put struct unwind_context there to keep all struct definitions
together. Remove unused task field from struct unwind_frame_info.
Dave Brolley [Tue, 20 Sep 2011 16:56:42 +0000 (12:56 -0400)]
PR 13107: simplify compile-server testsuite
- Removed the use of a wrapper script to run stap using the server.
- Client/server tests now use the --use-server option as needed.
- testsuite/systemtap.server/server.exp is now reduced.
- no longer runs all of buildok tests
- now runs tests on server-specific functionality
- general client/server interoperability covered by existing tests.
With the previous code, it was possible for the delayedkill ./loop job
to be killed before the stap script watching for its end got really
ready. That could mean that the stap script starts, and waits, and
waits, and waits more, and waits, and waits, and waits, and waits, and
waits, and waits, and waits, and waits, and waits, and waits, and
waits, and waits, and waits yet more, and waits, and waits, and waits,
and waits, and waits, and waits, and waits, and waits, and waits, and
waits, and waits a bit longer, and waits, and waits, and waits, and
waits, and waits, and waits, and waits, and waits more , and waits,
and waits, and waits, and waits, and waits, and waits, and waits, and
waits, and keeps waiting, and waits, and waits, and waits, and waits,
and waits, and waits, and waits, and goes on waiting, and waits, and
waits a lot, and waits, and waits, and waits, and waits, and waits,
and waits, and waits, and waits for warts, and waits, and waits, and
waits, and waits, and waits, and waits, and waits, and waits, now
getting slightly impatient, and waits, and waits, and waits, and
waits, and waits, and waits, and waits, and waits, and waits, and
waits, and waits, and waits, and waits, and waits a lot more.
Since there is no robust synchronization in the test case, let's
increase the delayedkill interval to make the above wait less likely,
plus add a godot timeout probe that will abort the script before it
gets grey hairs, loses its teeth, and gets bombarded with funeral
pre-planning spam.
Mark Wielaard [Tue, 20 Sep 2011 09:48:28 +0000 (11:48 +0200)]
Introduce _stp_get_uregs and _STP_PROBE_STATE_FULL_UREGS flag.
No actual functionality change yet. _STP_PROBE_STATE_FULL_UREGS
is set for context probe_flags if full user register set is available
after calling _stp_get_uregs().
PR13200: skip prologue searching for *.function(ADDR).return probes
Prologue searching has to be suppressed for all kretprobes/uretprobes
address calculations, or else the *retprobes facility can overwrite
valid stack frame data instead of return addresses.
* tapsets.cxx (query_addr, query_func_info): Perform prologue analysis
but verbosely ignore results, for .return probes.
Mark Wielaard [Mon, 19 Sep 2011 13:42:19 +0000 (15:42 +0200)]
Remove arch specific _stp_probing_32bit_app() and _stp_get_regparm().
Both functions were doing more than necessary and didn't actually need
access to the current regs. _STP_PROBE_STATE_USER_MODE tells us whether
the current probe triggered in user mode. _stp_is_compat_task() tells
us whether the current task is a 32-on-64 process.
* runtime/compatdefs.h (_stp_is_compat_task): Defined also when CONFIG_COMPAT
is undefined (to always return false).
* runtime/loc2c-runtime.h: u_fetch_register() and u_store_register() are
only called from user space dwarf context. Only needs _stp_is_compat_task()
test.
* runtime/regs.c: Remove arch specific _stp_probing_32bit_app() and
_stp_get_regparm() functions.
* tapset/i386/registers.stp (_stp_arg): Check regparm directly.
* tapset/powerpc/registers.stp (probing_32bit_app): Use _stp_is_compat_task()
test.
* tapset/s390/registers.stp (probing_32bit_app): Likewise.
* tapset/x86_64/registers.stp (_stp_arg): Check regparm directly.
(probing_32bit_app): Use _stp_is_compat_task() test.
(regparm): Likewise.
Josh Stone [Fri, 16 Sep 2011 23:45:15 +0000 (16:45 -0700)]
PR12136: Test a @cast to type sdt::string
This test would previously fail to find std::string, as that type is not
at the top level of the CU in the debuginfo, but rather nested under the
DIE for the std namespace. It should now be found.
Note however that this test is currently failing for me due to an
apparently bad argument calculation. The @cast in the SDT probe looks
good, but from the function probe it's getting a bad pointer for $str.
It's OK on F15 i686, but not on F15 x86_64. I think this issue is
distinct from what I'm fixing, but it need further investigation...
Josh Stone [Fri, 16 Sep 2011 22:59:45 +0000 (15:59 -0700)]
Fill in @cast default module from SDT
If a @cast in SDT context does not have a specified source for type
info, then we should infer it as the SDT's module, as we do for normal
DWARF-based probes.
* tapsets.cxx (sdt_uprobe_var_expanding_visitor::visit_cast_op): If the
@cast module isn't already set, use the SDT module.
(sdt_kprobe_var_expanding_visitor::visit_cast_op): Ditto.
Josh Stone [Wed, 24 Aug 2011 23:21:38 +0000 (16:21 -0700)]
PR12136: Load nested types for C++ CUs
For C++ compile units only, check for nested type definitions within
namespaces, structures, and classes. This allows @cast to have access
to types like "std::string".
* dwflpp.cxx (dwflpp::global_alias_caching_callback): Take a flag
has_inner_types to indicate that we should recurse, and a prefix to
specify what we've already recursed into.
(dwflpp::iterate_over_globals): Check whether we're in C++, then do
the real work in the new iterate_over_types.
(dwflpp::iterate_over_types): Do the work that iterate_over_globals
used to handle, without assuming that we're starting in a top CU.
Josh Stone [Tue, 23 Aug 2011 23:59:16 +0000 (16:59 -0700)]
Improve scope splitting in function specs
We now take care to only split "::" separators that are outside of any
template specification. So "std::foo<std::bar>" becomes only two
components, "std" and "foo<std::bar>".
* util.cxx (tokenize_cxx): Split on "::" only outside of templates.
* tapsets.cxx (dwarf_query::parse_function_spec): Use tokenize_cxx.
The reported stuck process bug (whether it's in the kernel or
in stap), is apparently triggered by concurrent modprobes. Change
the testsuite to avoid this practice, to wallpaper over the problem
temporarily.
Stan Cox [Fri, 16 Sep 2011 15:31:39 +0000 (11:31 -0400)]
Add process.plt to probe plt entries.
* dwflpp.cxx (iterate_over_plt): New to callback through plt entries.
* dwflpp.h: Likewise.
* tapsets.cxx (TOK_PLT): New.
(base_query::query_plt_callback, query_plt): New methods.
(base_query): New members has_plt, has_statement, plt_val.
(base_query::base_query): Set new members.
(dwarf_query::query_module_symtab): Use raw address for plt entries.
(dwarf_query::add_probe_point): Don't reloc the plt entry address.
(query_module): Call iterate_over_plt.
(plt_expanding_visitor): New to expand $$name.
(dwarf_derived_probe::register_patterns): Add new probe tags.
Mark Wielaard [Fri, 16 Sep 2011 12:33:06 +0000 (14:33 +0200)]
Split kregs and uregs in probe context.
Keep track of kernel registers and user registers for a probe context
separately in anticipation of k/uregs "recovery". This patch simply
replaces the regs field of common_probe_context.h with a kregs and uregs
field, plus changes all over to use one or the other to store or fetch
the appropriate registers.
William Cohen [Thu, 15 Sep 2011 18:25:36 +0000 (14:25 -0400)]
PR13101 Networking tapsets should have structured comments
Fix up the language for the default filter functions for ipmib, linuxmib,
and tcpmib. Also make the functions return sane values regardless of
the value of the op parameter.
PR6503: verify build-ids of dynamically arriving modules
With the horrible module_sect_attr* hack, the .note.gnu.build-id data
may now be verified.
* runtime/sym.c (_stp_kmodule_check): New function.
* runtime/transport/symbols.c (_stp_module_notifier): Upon MODULE_STATE_COMING,
verify build-ids. Reject the module from further consideration upon a
mismatch.
PR6503: get at dynamic module section addresses via horrible hack (tm)
Since <linux/module.h> does not declare structs module_sect_attr[s],
let's declare it ourselves. We need to get at these, because
otherwise there is no way to get at the build-id section address.
* runtime/autoconf-module-sect-attrs.c: New (partial) autoconf file.
* buildrun.cxx (compile_pass): Build it.
* runtime/transport/symbols.c (_stp_module_notifier): Use our own
modern (2.6.19+) declaration of these structs to pass all section
names/addresses to _stp_kmodule_update_address.
Dave Brolley [Wed, 14 Sep 2011 20:21:01 +0000 (16:21 -0400)]
Systemtap compile-server and client do not require avahi.
Avahi is required for automatic detection and selection of compile-servers
but the client can still contact servers directly without avahi.
avahi-tools and avahi-devel are not required.
Updated stap-start-server, testsuite/lib/systemtap.exp and systemtap.spec
to reflect this. The specfile stills list avahi-client as a build
requirement for both the systemtap and systemtap-server packages.
Chris Meek [Wed, 14 Sep 2011 17:30:52 +0000 (13:30 -0400)]
PR13156: More verbose hash log output
Added descriptions for each item added to the script's hash in
the hash's log. Also, now it limits the length of each string
printed to the last 80 characters (except paths), to make it
more readable.
* runtime/transport/relay_v2.c (_stp_transport_data_fs_init):
In BULK_MODE, stop overestimating the number of pages we will
need: it's num_online_cpus rather than num_possible_cpus.
Chris Meek [Tue, 13 Sep 2011 17:48:50 +0000 (13:48 -0400)]
PR12221: Added Test Cases
Test:
1. Compiles a simple binary
2. Sets timestamp to a known value
3. Compiles a stap module probing this binary
4. Compiles a similar binary, same size, name, path etc
but different contents
5. Sets the timestamp to the same as the previous one
6. Compiles another stap module probing this new binary.
Results:
Before the build ID was added to the hash, this sequence
would cause stap to fetch the module from the cache, but
now, it will compile a new one, since the build IDs are
different.
Dave Brolley [Tue, 13 Sep 2011 15:07:11 +0000 (11:07 -0400)]
RHBZ 737095: Unable to start a systemtap server
- Don't use getlogin to obtain user name because it can fail.
- Establish server log before issuing any messages.
- Failure of avahi to advertise is now only a warning. Avahi is not
always available and the server can still be used directly.
* dwflpp.cxx (dwflpp::blacklisted_p): Skip blacklist_section
processing for modules, since we can (sometimes) probe their
.init / .exit sections now.
* runtime/staprun/staprun.c (send_relocation_modules): Hey, we
only said "sometimes". Preexisting modules lie in /sys/module/...
about having their init stuff still in memory. Skip those.
During the i18n conversion, we ended up with several instances of 0x%#
PRIx64 formatting directives, which duplicates the 0x. This patch
zaps those throughout.
Previously, guru mode override for the blacklist only applied to the
file/function blacklist. With this rework, all blacklists may be
bypassed in guru mode.
Mark Wielaard [Fri, 9 Sep 2011 21:28:00 +0000 (23:28 +0200)]
Revert "Remove CONFIG_UTRACE check in pass 2 (dwarfbuilder)."
This reverts commit 2fd2c46ca19c8d995d2376ab8ca1d3e62fb6f43e.
<jistone> tsk tsk, mjw is making a liar out of pass-2 / -l
The issue is that pass-2 does not just list the probes,
but also selects which optional probes might trigger.
Mark Wielaard [Fri, 9 Sep 2011 11:46:45 +0000 (13:46 +0200)]
Fix systemtap.examples/process/syscalltimes script and add test.
stap was a little too smart for the script, optimizing out unused
variables and producing WARNINGS/ERRORS for deleted variables.
Make all variable manipulation conditional on their actual usage,
add -w to surpress warnings, add a new option -c 'process' to run
during script invocation and add a meta testcase for the testsuite.
Mark Wielaard [Fri, 9 Sep 2011 07:05:09 +0000 (09:05 +0200)]
Remove CONFIG_UTRACE check in pass 2 (dwarfbuilder).
pass 4 (buildrun) already checks for CONFIG_UTRACE, so remove it from
pass 2 (dwarfbuilder) so scripts containing process() probes can at least
be semantically checked and inspected with stap -l on arches that don't
have utrace yet.
Mark Wielaard [Thu, 8 Sep 2011 15:22:25 +0000 (17:22 +0200)]
Remove commented out and outdated (confusing embedded C) example from SBG.
Just remove so there are no false positives while looking for dangerous
embedded C snippets. The actual example just includes the thread-times.stp
file which is fine.
Chris Meek [Thu, 8 Sep 2011 12:09:51 +0000 (08:09 -0400)]
PR12221: Added the build ids to the script's hash
hash.cxx
Added the build IDs from the session variables's build_ids
vector to the script's hash.
session.h
Added the build_ids vector to the session.
setupdwfl.cxx
Extracted the build IDs in setup_dwfl_kernel and
setup_dwfl_user and added them to the build_ids vector.
Also, rearranged the code for downloading the debuginfo
to facilitate this patch.
Mark Wielaard [Thu, 8 Sep 2011 11:57:21 +0000 (13:57 +0200)]
Rename CONTEXT regflags to probe_flags. Now simply indicates user mode.
Renamed common_probe_context.h regflags to probe_flags, rename constant
from _STP_REGS_USER_FLAG to _STP_PROBE_STATE_USER_MODE and use throughout
tapsets to check whether in user_mode() or not.
I believe this because three variables, arr_struct, primary_colors_var, incomplete_struct_type, has been changed to conditional defined in systemtap.base/sdt_types.c:
Dave Brolley [Tue, 6 Sep 2011 19:48:29 +0000 (15:48 -0400)]
PR11441 - unprivileged mode test suite enhancements.
- Created a script which identifies all embedded C code in our tapset
sources.
- Tests to ensure that calls to each function containing embedded C are
accepted/rejected for unprivileged users, as appropriate.
Mark Wielaard [Mon, 5 Sep 2011 21:37:11 +0000 (23:37 +0200)]
PR13112 (and PR13108) blacklist probing function from include/asm .h files.
dwflpp.cxx (build_blacklist): all include/asm .h blfile patterns might
need "full path" so prefix those with '.*'
Add new XFAIL semok.exp inb_blacklisted.stp testcase.
PR6503: introduce systemtap_module_refresh() entry point
This new function in the generated code is to get all active probe
point families to reevaluate applicability, to retry inserting probes
that may have failed during systemtap_module_init (e.g., due to
modules being offline), or disarm/remove probes that are no longer
applicable (e.g. due to modules having gone offline). The default
implementation is empty.
* runtime/transport/symbols.c (_stp_module_notifier): A hack worthy of
Alan Smithee himself, supply a disappointing subset of
module-section-address data tuples as modules come and go.
Frank Ch. Eigler [Wed, 31 Aug 2011 17:42:17 +0000 (13:42 -0400)]
PR6503: add module notifier
* runtime/transport/symbols.c (_stp_module_notifier): New function.
Do nothing.
* runtime/transport/transport.c (_stp_handle_start): Register it.
(_stp_cleanup_and_exit): Unregister it.