]> sourceware.org Git - systemtap.git/log
systemtap.git
11 years agoAdd a "-O" to the "-D_FORTIFY_SOURCE=2" setjump.exp test
William Cohen [Tue, 20 Nov 2012 19:26:33 +0000 (14:26 -0500)]
Add a "-O" to the "-D_FORTIFY_SOURCE=2" setjump.exp test

When building code with -D_FORTIFIY_SOURCE=2 need to turn on
optimizations.  Without the "-O" the compile of code triggers warning
that will cause the build to fail and some parts of the portion of the
test is untested.

11 years agoRun probefunc inline testcase with --compatible=1.8.
Mark Wielaard [Mon, 19 Nov 2012 20:43:40 +0000 (21:43 +0100)]
Run probefunc inline testcase with --compatible=1.8.

In the new implementation we will observe the name of the function where
this gets inlined, not the inlined function name itself. With the old
implementation of probefunc() it would get the name from the actual
probe string. Test the old behavior explicitly.

11 years agostapdyn: loadLibrary now returns BPatch_object
Josh Stone [Thu, 8 Nov 2012 01:07:15 +0000 (17:07 -0800)]
stapdyn: loadLibrary now returns BPatch_object

BPatch_addressSpace::loadLibrary changed its return value before Dyninst
8.0 final.  We wanted the BPatch_object anyway, so now we don't have to
get it indirectly through BPatch_module::getObject.

Also, bump the rpm spec to require the actual Dyninst 8.0.

11 years agoFix _stp_get_arg32_by_number() for RHEL5.
David Smith [Mon, 19 Nov 2012 20:08:43 +0000 (14:08 -0600)]
Fix _stp_get_arg32_by_number() for RHEL5.

* runtime/regs.c (_stp_get_arg32_by_number): Handle i386/x86_64
  differences better for systems without x86 register unification, like
  RHEL5.
 Please enter the commit message for your changes. Lines starting

11 years agoFix RHEL5 x86_64 register printing.
David Smith [Mon, 19 Nov 2012 19:21:02 +0000 (13:21 -0600)]
Fix RHEL5 x86_64 register printing.

* runtime/linux/regs.c (_stp_print_regs): Correctly print the 'flags'
  register on systems before x86 register unification, such as RHEL5.

11 years agotestsuite/systemtap.base/partial-class-type.exp: Explictly use g++ compiler.
Mark Wielaard [Sun, 18 Nov 2012 21:48:33 +0000 (22:48 +0100)]
testsuite/systemtap.base/partial-class-type.exp: Explictly use g++ compiler.

partial-class-type.cxx is a C++ program, compiling with plain gcc might
result in undefined reference to `__gxx_personality_v0'.

11 years agoprobefunc(): Use [u]addr() instead of [u]stack(0).
Mark Wielaard [Sun, 18 Nov 2012 21:29:49 +0000 (22:29 +0100)]
probefunc(): Use [u]addr() instead of [u]stack(0).

The result is the same, but the use of [u]stack(0) triggers the inclusion
of unwind tables (even though there is literally zero unwinding going on).

11 years agotestsuite/systemtap.base/utf_pretty.exp: Explictly use g++ compiler.
Mark Wielaard [Sun, 18 Nov 2012 20:04:32 +0000 (21:04 +0100)]
testsuite/systemtap.base/utf_pretty.exp: Explictly use g++ compiler.

utf_pretty.cxx is a C++ program, compiling with plain gcc might result in
undefined reference to `__gxx_personality_v0'.

11 years agoPR10272 Warn if we will be unable to generate user backtrace for 32-on-64.
Mark Wielaard [Sat, 17 Nov 2012 21:34:04 +0000 (22:34 +0100)]
PR10272 Warn if we will be unable to generate user backtrace for 32-on-64.

Deduce the kernel ELF class from the kernel normalized machine architecture
and warn if it is different from the module ELF class (except for 32-bit
vdso). Don't generate unwind tables for "wrong class" modules.

11 years agoMark pt_user_mode.exp as untested if we're not root.
David Smith [Thu, 15 Nov 2012 22:37:05 +0000 (16:37 -0600)]
Mark pt_user_mode.exp as untested if we're not root.

* testsuite/systemtap.base/pt_user_mode.exp: Mark as "untested" if we're
  not root (since perf probes require root).

11 years agoUpdate the ptrace.exp test to work on RHEL6.
David Smith [Thu, 15 Nov 2012 22:10:02 +0000 (16:10 -0600)]
Update the ptrace.exp test to work on RHEL6.

* testsuite/systemtap.base/ptrace.exp: Handle more versions of strace
  output. Require uprobes, since the test scripts use uprobes.

11 years agoTweak the probe_by_pid.exp testcase to avoid zombie processes.
David Smith [Thu, 15 Nov 2012 20:25:08 +0000 (14:25 -0600)]
Tweak the probe_by_pid.exp testcase to avoid zombie processes.

11 years agoMake debugtypes.exp "untested" if we've got an older gcc.
David Smith [Wed, 14 Nov 2012 22:53:03 +0000 (16:53 -0600)]
Make debugtypes.exp "untested" if we've got an older gcc.

* testsuite/systemtap.pass1-4/debugtypes.exp: Mark as 'untested' if the
  system's gcc doesn't support the '-gdwarf-4 -fdebug-types-section'
  options.

11 years agoFix PR14842 by removing old "--kelf" and "--ignore-dwarf" options.
David Smith [Wed, 14 Nov 2012 21:13:00 +0000 (15:13 -0600)]
Fix PR14842 by removing old "--kelf" and "--ignore-dwarf" options.

* cmdline.cxx: Remove "--kelf" and "--ignore-dwarf" options.
* cmdline.h: Ditto.
* hash.cxx (find_script_hash): Ditto.
* session.cxx: Ditto.
* session.h: Ditto.
* stap.1: Ditto.
* initscript/systemtap.in: Ditto.
* po/en.po: Ditto.
* po/fr.po: Ditto.
* po/pl.po: Ditto.
* po/systemtap.pot: Ditto.
* testsuite/semok/nodwf04.stp: Removed test for --kelf/--ignore-dwarf.
* testsuite/semok/nodwf05.stp: Ditto.
* testsuite/semok/nodwf06.stp: Ditto.
* testsuite/semok/nodwf07.stp: Ditto.
* testsuite/systemtap.context/num_args.tcl: Removed test pass for "--kelf
  --ignore-dwarf".

11 years agoFix PR14820 by removing old "--kmap" and "--ignore-vmlinx" options.
David Smith [Tue, 13 Nov 2012 21:59:07 +0000 (15:59 -0600)]
Fix PR14820 by removing old "--kmap" and "--ignore-vmlinx" options.

* cmdline.cxx: Removed "--kmap" and "--ignore-vmlinux" option support.
* cmdline.h: Ditto.
* hash.cxx (find_script_hash): Ditto.
* session.cxx: Ditto.
* session.h: Ditto.
* stap.1: Ditto.
* tapsets.cxx: Ditto.
* initscript/systemtap.in: Ditto.
* po/systemtap.pot: Ditto.
* testsuite/semok/nodwf01.stp: Removed test for --kmap/--ignore-vmlinux.
* testsuite/semok/nodwf02.stp: Ditto.
* testsuite/semok/nodwf03.stp: Ditto.

12 years agoRemove manual pointer casts from map-gen and pmap-gen
Josh Stone [Wed, 7 Nov 2012 21:46:37 +0000 (13:46 -0800)]
Remove manual pointer casts from map-gen and pmap-gen

There were a lot of manual conversions from generic map_node* to the
KEYSYM variants (which had a duplicate of map_node at their heads).

Now there's a genuine map_node in each KEYSYM node, and we use the
trustworthy container_of and hlist_for_each_entry to go back and forth.

12 years agostapdyn: Workaround for an i686 Dyninst bug in argument passing
Josh Stone [Wed, 7 Nov 2012 19:41:16 +0000 (11:41 -0800)]
stapdyn: Workaround for an i686 Dyninst bug in argument passing

Dyninst appears to be filling only 32-bits for the index to
enter_dyninst_uprobe_regs, which makes the following arguments shift
badly too.  This is reported upstream, but we can detect and work around
it ourselves too.

12 years agostapdyn: Add tapset function print_regs
Josh Stone [Tue, 6 Nov 2012 22:07:36 +0000 (14:07 -0800)]
stapdyn: Add tapset function print_regs

The underlying _stp_print_regs is more limited than the kernel version,
as some registers are not available, but this is still useful to see all
the information available to the probe.

Note: this makes it obvious that i686 actually doesn't have register
values right now.  Dyninst has documented that only POWER and AMD64
implement getRegisters, unfortunately.  This might be expanded by them
in a future release.

* runtime/regs.c: Split into linux/ and dyninst/ versions.
* tapset/context.stp (print_regs): Moved from linux/; now it's generic.
* stapdyn/mutatee.cxx (get_dwarf_registers): Add verbose logging, which
  also shows that i686 doesn't have registers. :(

12 years agoInclude --runtime=dyninst in error message for unprivileged user
Lukas Berk [Wed, 7 Nov 2012 18:38:24 +0000 (13:38 -0500)]
Include --runtime=dyninst in error message for unprivileged user

* session.cxx : mention that --runtime=dyninst may be used in the case
 of an unprivileged user, when trying to probe userspace

12 years agostapdyn: Add support for return probes
Josh Stone [Tue, 6 Nov 2012 00:21:50 +0000 (16:21 -0800)]
stapdyn: Add support for return probes

Each address is converted to the BPatch_locExit of the function which
contains it.  Even $return is working fine from here!

* runtime/dyninst/uprobes.c (stp_dyninst_probe_flags): New, return the
  flags describing this probe, notably STAPDYN_PROBE_FLAG_RETURN.
* stapdyn/dynprobe.cxx (find_dynprobes): Read the flags from the module.
  (dynprobe_location::dynprobe_location): Parse return_p from the flags.
* stapdyn/mutatee.cxx (mutatee::instrument_dynprobe_target): For probes
  with return_p set, transform into BPatch_locExit points.
* tapsets.cxx (dwarf_builder::build): Let stapdyn return probes through.
  (uprobe_derived_probe_group::emit_module_dyninst_decls): Emit
  .flags=STAPDYN_PROBE_FLAG_RETURN for return probes.

12 years agostapdyn: Reduce LDADD to only those directly used
Josh Stone [Mon, 5 Nov 2012 21:58:44 +0000 (13:58 -0800)]
stapdyn: Reduce LDADD to only those directly used

The only part of Dyninst that we actually use and need to link is
libdyninstAPI.  The rest of those libraries I had in dyninst_LIBS were
those needed indirectly by that one.  But trying to enumerate someone
else's dependencies is a recipe for failure -- e.g. it was already
broken by not including the new libdynElf too.

The reason I had this was to allow successful linking when using
--with-dyninst=/not/a/lib/searched/path without requiring also to set
LD_LIBRARY_PATH.  Since the enumeration is prone to break, and you'd
have to set LD_LIBRARY_PATH anyway to be able to run, I've decided it's
not worth trying to be fancy here.

12 years agoconfigure: treat any positive --with-dyninst as a hard req
Josh Stone [Mon, 5 Nov 2012 21:50:13 +0000 (13:50 -0800)]
configure: treat any positive --with-dyninst as a hard req

If the user gave --with-dyninst[=yes] or --with-dyninst=/path, treat a
failure in that feature test as a hard error.  If the user left dyninst
implicit, then don't make it an error.  And of course if the user gave
--without-dyninst, then don't test it at all.

12 years agoUse the new kernel_functions to query inode-uretprobes
Josh Stone [Mon, 5 Nov 2012 20:42:52 +0000 (12:42 -0800)]
Use the new kernel_functions to query inode-uretprobes

This gives a clean way to determine if this is a kernel with the new
uretprobe_register function yet.

12 years agoAdd System.map kernel functions to systemtap_session
Josh Stone [Mon, 5 Nov 2012 20:20:46 +0000 (12:20 -0800)]
Add System.map kernel functions to systemtap_session

The code to parse System.map was already in place for kprobe.function
validation; now it's generalized and the result made available in
systemtap_session::kernel_functions.

12 years agoMove parse_kernel_config/exports into systemtap_session
Josh Stone [Mon, 5 Nov 2012 20:14:05 +0000 (12:14 -0800)]
Move parse_kernel_config/exports into systemtap_session

These are operating on the session, with purely session-internal data,
so they might as well be member functions.

12 years agoPrototype support for inode-uretprobes
Josh Stone [Fri, 2 Nov 2012 23:23:43 +0000 (16:23 -0700)]
Prototype support for inode-uretprobes

Anton Arapov sent a test kernel build with new support for uretprobes,
and this patch adds stap support.  I've confirmed that it works on
x86_64, but i686 is crashing the target processes with SIGSEGV.

We need to find a dynamic (pass-2) way to detect the presence of
uretprobes in the kernel.  For now, I've just hacked it enabled, and it
will fail registration at runtime.

* buildrun.cxx (compile_pass): Autoconf uretprobes and its exports.
* runtime/linux/autoconf-inode-uretprobes.c: New, check for uretprobes.
* runtime/linux/runtime.h: Add function pointers for uretprobes.
* runtime/transport/transport.c (_stp_transport_init): Set the uretprobe
  function pointers if not exported.  (Anton's kernel does have exports,
  but we're prepared in case upstream doesn't accept those.)
* runtime/linux/uprobes-inode.c (stapiu_consumer): Let this double as
  either a uprobe_consumer or a uretprobe_consumer, chosen by return_p.
  (stapiu_probe_handler): Add a new generic function signature.
  (stapiu_uprobe_handler, stapiu_uretprobe_handler): New specific
  callbacks that mux into stapiu_probe_handler.
  (stapiu_register, stapiu_unregister): New functions to perform the
  appropriate kind of registration for a probe.
* tapsets.cxx (dwarf_builder::build): Hack the uretprobes check.
  (uprobe_derived_probe_group::emit_module_inode_decls): Use the new
  signature for the probe handler, and emit .return_p.

12 years ago spin-rawhide date command and correct ^Source regex
Lukas Berk [Mon, 5 Nov 2012 18:43:04 +0000 (13:43 -0500)]
 spin-rawhide date command and correct ^Source regex

* scripts/spin-rawhide : adjust date to use +"%a..." syntax instead
 of cutting fields and remove backslash before ^Source sed regex

12 years agoPR14707: Pass -x from stap to stapdyn
Josh Stone [Sat, 3 Nov 2012 16:48:53 +0000 (09:48 -0700)]
PR14707: Pass -x from stap to stapdyn

Commit 18e3d52a added -x to stapdyn, and I tested that it worked
directly, but I forgot to make stap pass its option along.  D'oh!

* buildrun.cxx (make_dyninst_run_command): Add -x s.target_pid.

12 years agoMerge branch 'master' of ssh://sourceware.org/git/systemtap
Lukas Berk [Fri, 2 Nov 2012 01:54:01 +0000 (21:54 -0400)]
Merge branch 'master' of ssh://sourceware.org/git/systemtap

12 years agoInclude stapgames in the testsuite
Masami Hiramatsu [Fri, 2 Nov 2012 01:41:55 +0000 (21:41 -0400)]
Include stapgames in the testsuite

New systemtap.examples/stapgames directory added with the supporting
tapsets located in the 'tapset' subdirectory.  All tests run with -p4
specified.

* testsuite/systemtap.examples/stapgames/block.meta : block meta data
* testsuite/systemtap.examples/stapgames/block.stp : break a ceiling of
  blocks
* testsuite/systemtap.examples/stapgames/eater.meta : eater meta data
* testsuite/systemtap.examples/stapgames/eater.stp : eat the .'s before
  being eaten
* testsuite/systemtap.examples/stapgames/lifegame.meta : life meta data
* testsuite/systemtap.examples/stapgames/lifegame.stp : watch a
  'lifeform' morph and evolve
* testsuite/systemtap.examples/stapgames/pingpong.meta : ping pong meta
  data
* testsuite/systemtap.examples/stapgames/pingpong.stp : cursor bounces
  around terminal reflecting off edges
* testsuite/systemtap.examples/stapgames/tapset/audio.stp : audio
  functionality
* testsuite/systemtap.examples/stapgames/tapset/cursor.stp : cursor
  functionality and tracking
* testsuite/systemtap.examples/stapgames/tapset/game.stp : seed values
* testsuite/systemtap.examples/stapgames/tapset/gmtty.stp : tty functionality
* testsuite/systemtap.examples/stapgames/tapset/input.stp : controlling
  game input

12 years agoPR14794: Only error if '--with-dyninst' can't find dyninst.
David Smith [Thu, 1 Nov 2012 20:48:22 +0000 (15:48 -0500)]
PR14794: Only error if '--with-dyninst' can't find dyninst.

* configure.ac: Only error when dyninst can't be found and '--with-dyninst'
  was specified.
* configure (ac_compiler_gnu): Regenerated.

12 years agoPR14794: enable --with-dyninst by default, if libraries/headers exist
Frank Ch. Eigler [Thu, 1 Nov 2012 01:27:50 +0000 (21:27 -0400)]
PR14794: enable --with-dyninst by default, if libraries/headers exist

* configure.ac (--with-dyninst): Search for headers/libraries, unless
  --without-dyninst.

12 years agoreleng: improve 'make gcov'
Frank Ch. Eigler [Wed, 31 Oct 2012 17:34:23 +0000 (13:34 -0400)]
releng: improve 'make gcov'

* Makefile.am (gcov): Rewrite to compile all the stap tools with the proper
  *FLAGS.  Iterate to run gcov in $SUBDIRS.
  (lcov): Zap.

12 years ago(PR14574 partial fix) Make several systemtap.printf/*.exp tests use dyninst.
David Smith [Wed, 31 Oct 2012 15:51:55 +0000 (10:51 -0500)]
(PR14574 partial fix) Make several systemtap.printf/*.exp tests use dyninst.

* testsuite/lib/stap_run_binary.exp (stap_run_binary): Added optional
  argument support.
* testsuite/systemtap.printf/basic1.exp: Added dyninst support.
* testsuite/systemtap.printf/basic2.exp: Ditto.
* testsuite/systemtap.printf/basic3.exp: Ditto.
* testsuite/systemtap.printf/basic4.exp: Ditto.
* testsuite/systemtap.printf/basic5.exp: Ditto.
* testsuite/systemtap.printf/basic6.exp: Ditto.
* testsuite/systemtap.printf/bin1.exp: Ditto.
* testsuite/systemtap.printf/bin2.exp: Ditto.
* testsuite/systemtap.printf/bin3.exp: Ditto.
* testsuite/systemtap.printf/bin4.exp: Ditto.
* testsuite/systemtap.printf/bin5.exp: Ditto.
* testsuite/systemtap.printf/bin6.exp: Ditto.
* testsuite/systemtap.printf/char1.exp: Ditto.
* testsuite/systemtap.printf/char2.exp: Ditto.
* testsuite/systemtap.printf/int1.exp: Ditto.
* testsuite/systemtap.printf/memory1.exp: Ditto.
* testsuite/systemtap.printf/oct.exp: Ditto.
* testsuite/systemtap.printf/pretty-bits.exp: Ditto.
* testsuite/systemtap.printf/pretty-char.exp: Ditto.
* testsuite/systemtap.printf/print.exp: Ditto.
* testsuite/systemtap.printf/print_char.exp: Ditto.
* testsuite/systemtap.printf/printd.exp: Ditto.
* testsuite/systemtap.printf/println.exp: Ditto.
* testsuite/systemtap.printf/ptr-1.2.exp: Ditto.
* testsuite/systemtap.printf/ptr-1.3.exp: Ditto.
* testsuite/systemtap.printf/string1.exp: Ditto.
* testsuite/systemtap.printf/string2.exp: Ditto.

12 years ago(PR14571 partial fix) Improve dyninst multithreading.
David Smith [Wed, 31 Oct 2012 15:45:41 +0000 (10:45 -0500)]
(PR14571 partial fix) Improve dyninst multithreading.

* translate.cxx (c_unparser::emit_common_header): Don't declare contexts,
  let the runtime handle it.
  (c_unparser::emit_module_init): Instead of allocating/freeing contexts
  directly, call the runtime functions
  _stp_runtime_contexts_alloc()/_stp_runtime_contexts/free().
  (c_unparser::emit_module_exit): Instead of waiting on contexts directly,
  call the runtime function _stp_runtime_context_wait().
* tapsets.cxx (common_probe_entryfn_prologue): Updated with new method of
  getting context in probe prologues. For dyninst, handle a NULL context.
  (common_probe_entryfn_epilogue): Call _stp_runtime_entryfn_put_context()
  in probe epilogue.
* runtime/dyninst/runtime_context.h: New file.
* runtime/linux/runtime_context.h: Ditto.
* runtime/common_probe_context.h: Added dyninst fields.
* runtime/dyninst/map_runtime.h: Make map locking optional.
* runtime/dyninst/print.c (_stp_print_init): Added multithreading support.
* runtime/dyninst/runtime.h: Remove the stapdyn_big_dumb_lock.
  (stp_dyninst_session_init): Call _stp_runtime_contexts_init() and
  _stp_print_init().
  (stp_dyninst_session_exit): Call _stp_print_cleanup().
* runtime/dyninst/stat_runtime.h: Make stat locking optional.
* runtime/stat.h: Ditto.
* runtime/linux/map_runtime.h (_stp_map_for_each_cpu): Remove unneeded macro.
* runtime/linux/runtime.h: Removed unused macros.
* runtime/linux/stat_runtime.h (_stp_stat_initialize_locks): Switched back
  to standard lkm macros.
* runtime/map-stat.c: Ditto.
* runtime/map.c: Ditto.
* runtime/pmap-gen.c: Ditto.
* runtime/stat.c: Ditto.
* runtime/map.h: Make locking optional.
* runtime/runtime.h: Added forward declarations for runtime_context.h.
* runtime/runtime_context.h: Include the correct runtime's
  runtime_context.h.
* runtime/vsprintf.c: Update method of getting context.

12 years agoAllow spin-rawhide to be run from any directory
Lukas Berk [Wed, 31 Oct 2012 14:41:47 +0000 (10:41 -0400)]
Allow spin-rawhide to be run from any directory

* scripts/spin-rawhide: replace HASH suffix with mktemp function
reposition constant/variable definitions to draw
  from newly cloned systemtap.git vs pwd
make STAP_MAJOR_VERSION grep more specific
make Source grep more specific

12 years agoPR14707: Support stapdyn -x PID
Josh Stone [Tue, 30 Oct 2012 22:28:41 +0000 (15:28 -0700)]
PR14707: Support stapdyn -x PID

* stapdyn/stapdyn.cxx (main): Parse -x and use attach_process for it.
* stapdyn/mutator.cxx (mutator::attach_process): Implement it.

12 years agoPR14665: Start handling signals in stapdyn
Josh Stone [Tue, 30 Oct 2012 22:03:38 +0000 (15:03 -0700)]
PR14665: Start handling signals in stapdyn

This works somewhat to receives signals and kill the target process, but
sometimes it hangs.  I think it may work better when the notification FD
is resolved.

12 years agostapdyn: Detach the process in the mutatee dtor
Josh Stone [Tue, 30 Oct 2012 20:06:53 +0000 (13:06 -0700)]
stapdyn: Detach the process in the mutatee dtor

This doesn't really matter for now, since we're only tracking a single
process that we created, but we'll need if for -x attaching.

12 years agostapdyn: Sketch out support for polling on Dyninst
Josh Stone [Tue, 30 Oct 2012 19:14:53 +0000 (12:14 -0700)]
stapdyn: Sketch out support for polling on Dyninst

By polling instead of waitForStatusChange, we can let signals break us
out of the run loop too.  However, the notification FD currently appears
broken in Dyninst, so this is "#if 0" for now.

* util.cxx (ppoll): Move the fallback ppoll() to a general location.
* remote.cxx (ppoll): Moved ppoll() from here.
* stapdyn/mutator.cxx: Add the #if 0 stub of notification FD support.

12 years agoAdded small fix for testsuite/systemtap.base/hash_add_buildid.exp.
David Smith [Tue, 30 Oct 2012 14:54:53 +0000 (09:54 -0500)]
Added small fix for testsuite/systemtap.base/hash_add_buildid.exp.

* testsuite/systemtap.base/hash_add_buildid.exp: Wait for eu-readelf to
  finish to avoid a zombie process.

12 years ago(PR14574 partial) Add dyninst to the systemtap.exelib/pthreadprobes.exp test.
David Smith [Tue, 30 Oct 2012 14:52:32 +0000 (09:52 -0500)]
(PR14574 partial) Add dyninst to the systemtap.exelib/pthreadprobes.exp test.

* testsuite/systemtap.exelib/pthreadprobes.exp: Add dyninst testing.

12 years agostapdyn: Add some support for removing instrumentation
Josh Stone [Tue, 30 Oct 2012 02:06:30 +0000 (19:06 -0700)]
stapdyn: Add some support for removing instrumentation

We'll need this for signal-handling cleanup, and for detaching from
-x PID target processes.

* stapdyn/mutatee.h (mutatee::snippets): New vector for all the handles
  to code that we've added with Dyninst insertSnippet.
* stapdyn/mutatee.cxx (mutatee::instrument_dynprobe_target): Save the
  insertSnippet handle in snippets.
  (mutatee::remove_instrumentation): New, remove all the snippets.
  (mutatee::unload_stap_dso): New placeholder for unloading our module
  from the target process.  Dyninst can't do this yet...
  (mutatee::~mutatee): Call remove_instrumentation and unload_stap_dso.

12 years agostapdyn: Manage mutatee lifetimes better
Josh Stone [Tue, 30 Oct 2012 01:58:58 +0000 (18:58 -0700)]
stapdyn: Manage mutatee lifetimes better

It will be more convenient to manage mutatee resources if there's one
clear owner of the process, so stop allowing implicit copies.

* stapdyn/mutatee.h (mutatee::mutatee): Don't implement copy ctors.
* stapdyn/mutator.h (mutator::mutatees): Use shared_ptr for this list.
* stapdyn/mutator.cxx (mutator::create_process): Save a shared_ptr.
  (mutator::run): Use pointer indirection for mutatees.
  (mutator::dynamic_library_callback): Ditto.

12 years agostapdyn: Manage mutator lifetime better
Josh Stone [Tue, 30 Oct 2012 01:53:59 +0000 (18:53 -0700)]
stapdyn: Manage mutator lifetime better

We need to have a global record of mutators in order for dyninst
callbacks to work, since they have no context attached.  But rather than
some singleton factory style, just keep a global list of all mutators
we've seen.

* stapdyn/mutator.cxx (g_mutators): New vector for all mutators.
  (g_dynamic_library_callback): Iterate callbacks for all g_mutators.
  (mutator::dynamic_library_callback): Do the individual work.
  (mutator::mutator): Add this to g_mutators.
  (mutator::~mutator): Remove this from g_mutators.
  (mutator::create, mutator::g_mutator): Removed.
* stapdyn/stapdyn.cxx (main): Use mutator new and auto_ptr delete.

12 years agostapdyn: Remove the 8-arg register workaround
Josh Stone [Tue, 30 Oct 2012 01:03:20 +0000 (18:03 -0700)]
stapdyn: Remove the 8-arg register workaround

This was only to work around an assertion failure in Dyninst, which has
been fixed by their commit f307d8e1c5d7bd6a20dc105c3e233b788f57d33b.

12 years agotestsuite: for pretty-* test cases, use fixed /tmp/ file names
Frank Ch. Eigler [Mon, 29 Oct 2012 14:36:59 +0000 (10:36 -0400)]
testsuite: for pretty-* test cases, use fixed /tmp/ file names

... so that systemtap.sum files from run to run contain the same string

12 years agotestsuite: for stapsh-unix.stp test case, use fixed path name for tmp socket
Frank Ch. Eigler [Mon, 29 Oct 2012 14:22:22 +0000 (10:22 -0400)]
testsuite: for stapsh-unix.stp test case, use fixed path name for tmp socket

... so that systemtap.sum files from run to run contain the same string

12 years agoPR14774: fix multiply-wildcarded statement probes
Daniel Tschan [Mon, 29 Oct 2012 14:12:20 +0000 (10:12 -0400)]
PR14774: fix multiply-wildcarded statement probes

* dwflpp.cxx (iterate_over_srcfile_lines): Fix handling of case where
  both function name and line number subfields are wildcards.

12 years agotestsuite: make stap_run[23] more verbose when failing
Frank Ch. Eigler [Mon, 29 Oct 2012 02:39:36 +0000 (22:39 -0400)]
testsuite: make stap_run[23] more verbose when failing

If a stap_run[23] test case fails, in that the actual output varies
from the expected output, all remaining actual output lines were
neither compared nor reported in systemtap.log.

* testsuite/lib/stap_run2.exp (stap_run3): In case of a line mismatch,
  report any remaining actual lines.

12 years agoPR14781: use kmem_cache_create with unique name
Frank Ch. Eigler [Mon, 29 Oct 2012 00:53:11 +0000 (20:53 -0400)]
PR14781: use kmem_cache_create with unique name

* runtime/stp_utrace.c (utrace_init): Instead of using the KMEM_CACHE macro,
  invoke kmem_cache_create directly, with cache names that are going to be
  unique across concurrent systemtap sessions.

12 years agoPR14781 part 1: don't panic
Frank Ch. Eigler [Mon, 29 Oct 2012 00:16:55 +0000 (20:16 -0400)]
PR14781 part 1: don't panic

* runtime/stp_utrace.stp (utrace_init): Don't SLAB_PANIC on duplicate
  kmem_cache names, as is sadly likely for concurrent inode-uprobes
  scripts running on CONFIG_DEBUG_VM kernels.
* runtime/linux/task_finder2.c (stap_start_task_finder): Deign to check
  the utrace_init return code, and fail with a touch of grey grace.

12 years agoUpdated locking comments in _stp_stat_get().
David Smith [Wed, 24 Oct 2012 18:02:50 +0000 (13:02 -0500)]
Updated locking comments in _stp_stat_get().

12 years agoAdd spin-rawhide script for automated rawhide releases
Lukas Berk [Wed, 24 Oct 2012 16:08:22 +0000 (12:08 -0400)]
Add spin-rawhide script for automated rawhide releases

* scripts/spin-rawhide: freshly clones systemtap.git and fedpkg git
  repositories, update the .spec file accordingly and submit new build to
  bodhi

12 years agoLog the command being executed in testsuite/lib/stap_run_exact.exp.
David Smith [Tue, 23 Oct 2012 21:29:26 +0000 (16:29 -0500)]
Log the command being executed in testsuite/lib/stap_run_exact.exp.

12 years ago(PR14571 partial fix) Rework dyninst stat/map data storage.
David Smith [Tue, 23 Oct 2012 21:21:10 +0000 (16:21 -0500)]
(PR14571 partial fix) Rework dyninst stat/map data storage.

* runtime/map.c: Switched from TLS to just an array of map data for
  dyninst mode. Pushed most of the kernel vs. dyninst code down to
  runtime/{linux,dyninst}/map_runtime.h.
* runtime/map-stat.c (_stp_map_new_hstat_log): Ditto.
* runtime/map.h: Ditto.
* runtime/pmap-gen.c: Ditto.
* runtime/stat.c (_stp_stat_add): Switched from TLS to just an array of
  stat data for dyninst mode. Pushed most of the kernel vs. dyninst code
  down to runtime/{linux,dyninst}/stat_runtime.h.
* runtime/stat-common.c: Ditto.
* runtime/stat.h: Ditto.
* runtime/dyninst/map_runtime.h: New file.
* runtime/dyninst/stat_runtime.h: New file.
* runtime/linux/map_runtime.h: New file.
* runtime/linux/stat_runtime.h: New file.
* runtime/dyninst/tls_data.c: Deleted file.

12 years agoruntime: fix timers for old kernels
Josh Stone [Mon, 22 Oct 2012 23:35:19 +0000 (16:35 -0700)]
runtime: fix timers for old kernels

This is a regression from commit 2b5ecaf, which split the hrtimer code
into the runtime.  The kernel portion needs to vary the return type of
the callback function for old kernels, using int instead of the enum.
This patch defines hrtimer_return_t to abstract the difference.

12 years agotapset: Add the macro @choose_defined and use it
Josh Stone [Mon, 22 Oct 2012 20:55:49 +0000 (13:55 -0700)]
tapset: Add the macro @choose_defined and use it

This returns the first parameter if it's @defined, otherwise it returns
the second parameter, replacing the common @defined(x)?x:y pattern.

I only updated the tapsets to use this, as I feel that's where we should
show off good code practice.  There are opportunities in the testsuite
that could use it too, but it's not necessary, and probably better to
leave existing tests undisturbed when possible.

12 years agoNEWS: retroactively note previous probefunc() is available as --compatible=1.8
Frank Ch. Eigler [Mon, 22 Oct 2012 13:22:13 +0000 (09:22 -0400)]
NEWS: retroactively note previous probefunc() is available as --compatible=1.8

12 years agofix i18n whitespace nit
Frank Ch. Eigler [Mon, 22 Oct 2012 13:12:52 +0000 (09:12 -0400)]
fix i18n whitespace nit

* main.cxx (passes_0_4): Drop extra space inside " foo " in listings
  of files parsed within tapset directories.

12 years agoAdjust buildok/xtime.stp for kernel commit 1e75f.
Mark Wielaard [Sun, 21 Oct 2012 23:37:51 +0000 (01:37 +0200)]
Adjust buildok/xtime.stp for kernel commit 1e75f.

time: Condense timekeeper.xtime into xtime_sec.

12 years agoPR14742 - more complete dwz / DW_TAG_partial_unit support
Mark Wielaard [Sun, 21 Oct 2012 23:00:40 +0000 (01:00 +0200)]
PR14742 - more complete dwz / DW_TAG_partial_unit support

Don't use DW_TAG_partial_units directly in dwflpp::iterate_over_cus
and dwarf_var_expanding_visitor::getcuscope. Descent into imported_units
in has_only_decl_members, dwflpp::iterate_over_globals,
dwflpp::iterate_over_types, dwflpp::iterate_over_labels
dwflpp::inner_die_containing_pc, dwflpp::print_locals,
dwflpp::print_members, dwflpp::find_struct_member and
dwarf_pretty_print::recurse_struct_members.

12 years agoPR14745: note possibility of probe registration failure for timer.profile
Frank Ch. Eigler [Sun, 21 Oct 2012 01:53:57 +0000 (21:53 -0400)]
PR14745: note possibility of probe registration failure for timer.profile

12 years agoAdded a bug fix in _stp_stat_init()'s error handling code.
David Smith [Fri, 19 Oct 2012 19:21:11 +0000 (14:21 -0500)]
Added a bug fix in _stp_stat_init()'s error handling code.

* runtime/stat.c (_stp_stat_init): Be sure to free memory allocated with
  _stp_alloc_percpu() with _stp_free_percpu() - not _stp_kfree().

12 years agosamples: add baby-ltrace example for .plt probes
Frank Ch. Eigler [Thu, 18 Oct 2012 02:13:53 +0000 (22:13 -0400)]
samples: add baby-ltrace example for .plt probes

12 years agodocumentation: elaborate slightly on .plt probes
Frank Ch. Eigler [Wed, 17 Oct 2012 21:46:33 +0000 (17:46 -0400)]
documentation: elaborate slightly on .plt probes

12 years agoFix .exported typo in stapprobes manpage.
Stan Cox [Wed, 17 Oct 2012 15:36:00 +0000 (11:36 -0400)]
Fix .exported typo in stapprobes manpage.

12 years agoFixed PR14735 by adding timing ('-t') mode support for dyninst.
David Smith [Wed, 17 Oct 2012 14:52:13 +0000 (09:52 -0500)]
Fixed PR14735 by adding timing ('-t') mode support for dyninst.

* tapsets.cxx (common_probe_entryfn_prologue): Added dyninst support for
  timing ("-t") mode. Disable overload processing for dyninst mode.
  (common_probe_entryfn_epilogue): Change funcion signature. Add dyninst
  support for timing ("-t") mode. Disable overload processing for dyninst
  mode.
  (dwarf_derived_probe_group::emit_module_decls): Update
  common_probe_entryfn_epilogue() call.
  (uprobe_derived_probe_group::emit_module_utrace_decls): Ditto.
  (kprobe_derived_probe_group::emit_module_decls): Ditto.
  (hwbkpt_derived_probe_group::emit_module_decls): Ditto.
  (tracepoint_derived_probe_group::emit_module_decls): Ditto.
* tapset-been.cxx (be_derived_probe_group::emit_module_decls): Ditto.
* tapset-itrace.cxx (itrace_derived_probe_group::emit_module_decls):
  Ditto.
* tapset-mark.cxx (mark_derived_probe_group::emit_module_decls): Ditto.
* tapset-netfilter.cxx (netfilter_derived_probe_group::emit_module_decls):
  Ditto.
* tapset-perfmon.cxx (perf_derived_probe_group::emit_module_decls): Ditto.
* tapset-procfs.cxx (procfs_derived_probe_group::emit_module_decls): Ditto.
* tapset-timers.cxx (timer_derived_probe_group::emit_module_decls): Ditto.
  (hrtimer_derived_probe_group::emit_module_decls): Ditto.
  (profile_derived_probe_group::emit_module_decls): Ditto.
* tapset-utrace.cxx (utrace_derived_probe_group::emit_module_decls): Ditto.
* runtime/dyninst/runtime.h: Added NSEC_PER_SEC and _stp_timespec_sub
  macros. Always include stat.c, as runtime/linux/runtime.h does.

12 years agostapdyn: Big refactoring
Josh Stone [Tue, 16 Oct 2012 23:11:07 +0000 (16:11 -0700)]
stapdyn: Big refactoring

The main additions are the "mutator" class working with the overall
session, and the "mutatee" class working with the individual targets.
This is a bit of code churn, with no functional change, but it should
make it easier to keep track of our current state and add new features.

12 years agoPR14731: fix PR12022 regression for synthetic foreach()
Frank Ch. Eigler [Tue, 16 Oct 2012 18:43:52 +0000 (14:43 -0400)]
PR14731: fix PR12022 regression for synthetic foreach()

* elaborate.cxx (add_global_var_display): For foreach_loop created
  for otherwise-unused global, initialize sort_aggr => sc_none, the
  same way the parser would.

12 years agodocumentation: mention non-semaphore mode for dtrace(1) headers
Frank Ch. Eigler [Tue, 16 Oct 2012 15:12:52 +0000 (11:12 -0400)]
documentation: mention non-semaphore mode for dtrace(1) headers

12 years agoFixed PR14701 by adding dyninst timer probe support.
David Smith [Mon, 15 Oct 2012 21:28:28 +0000 (16:28 -0500)]
Fixed PR14701 by adding dyninst timer probe support.

* tapset-timers.cxx (hrtimer_derived_probe_group::emit_interval): Removed
  function.
  (hrtimer_derived_probe_group::emit_module_decls): Pushed some code down
  to the runtime and added dyninst support.
  (hrtimer_derived_probe_group::emit_module_init): Ditto.
  (hrtimer_derived_probe_group::emit_module_exit): Ditto.
  (timer_builder::build): Throw semantic errors if 'timer.jiffies' or
  'timer.profile' probes are used in dyninst mode.
  (register_tapset_timers): Add fake privilege for 'timer.profile' probes
  when in dyninst mode (so we get a semantic error, not a privilege error).
* buildrun.cxx (compile_dyninst): Added '-lrt' for timer functions.
* testsuite/systemtap.pass1-4/buildok-dyninst.exp: Move some tests to the
  kfail list.
* runtime/timer.c: New file.
* runtime/dyninst/timer.c: Ditto.
* runtime/linux/timer.c: Ditto.

12 years agoPR14712: Correct the bug number in a comment
Josh Stone [Mon, 15 Oct 2012 17:46:05 +0000 (10:46 -0700)]
PR14712: Correct the bug number in a comment

I mixed this up in the log too; commits 529c7eae and 3df148cb
are really for PR14712, not PR14172.

12 years agotestsuite: chmod a+x some semok testcases
Frank Ch. Eigler [Sat, 13 Oct 2012 16:30:29 +0000 (12:30 -0400)]
testsuite: chmod a+x some semok testcases

12 years agoPR12022 test cases for foreach (... @aggr ...) sorting
Frank Ch. Eigler [Sat, 13 Oct 2012 16:33:06 +0000 (12:33 -0400)]
PR12022 test cases for foreach (... @aggr ...) sorting

12 years agoPR12022: lightly document new foreach (@aggr) sorting option
Frank Ch. Eigler [Sat, 13 Oct 2012 16:22:56 +0000 (12:22 -0400)]
PR12022: lightly document new foreach (@aggr) sorting option

12 years agoPR12022: support foreach sorting by user-selected aggregate operator
Frank Ch. Eigler [Sat, 13 Oct 2012 16:13:35 +0000 (12:13 -0400)]
PR12022: support foreach sorting by user-selected aggregate operator

The syntax goes:

    foreach ([x,y] in array @avg -)  { }

inserting the desired sorting aggregator between the array name and
the +/- The runtime has been ready for this for a long time (see the
runtime/map.c SORT_* macros), finally time for the translator to let
users enjoy it.

* staptree.h (stat_component_type): Add sc_none possibility.
  (foreach_loop): Add sort_aggr field.
* parse.cxx (parse_foreach_loop): Parse optional statistics @ops.
* staptree.cxx (stat_op::print): Reject sc_none.
  (foreach_loop::print): Print statistics @ops.
* elaborate.cxx (typeresolution_info::visit_foreach_loop): Mark
  invalid @op sorting on non-statistics arrays.
* translate.cxx (c_unparser::visit_foreach_loop): Map sort_aggr
  to runtime SORT_* value, emitted as strings.
  (c_unparser::visit_stat_op): Reject sc_none.

12 years agoman pages: elaborate more on probe syntax/semantics in stapprobes.3stap
Frank Ch. Eigler [Sat, 13 Oct 2012 14:48:30 +0000 (10:48 -0400)]
man pages: elaborate more on probe syntax/semantics in stapprobes.3stap

12 years agostap.1 man page: take probe point syntax details back out
Frank Ch. Eigler [Sat, 13 Oct 2012 14:32:34 +0000 (10:32 -0400)]
stap.1 man page: take probe point syntax details back out

Seeing that stapprobes.3stap is fine, replace with a better cross-reference.

12 years agostap.1: mention a little about the probe point !/? operators
Frank Ch. Eigler [Sat, 13 Oct 2012 03:40:28 +0000 (23:40 -0400)]
stap.1: mention a little about the probe point !/? operators

... even though they're listed in stapprobes.3stap also.

12 years agolangref: add a sentence identifying the 'any' meaning of probe-point lists
Frank Ch. Eigler [Sat, 13 Oct 2012 03:27:01 +0000 (23:27 -0400)]
langref: add a sentence identifying the 'any' meaning of probe-point lists

12 years agoPR14172: Fix the include order so vma tracking works
Josh Stone [Sat, 13 Oct 2012 00:16:07 +0000 (17:16 -0700)]
PR14172: Fix the include order so vma tracking works

In commit 529c7eae, by moving the sym.c include, I broke the order
between #define HAVE_TASK_FINDER and the #ifdef in vma.c.

Reported-by: Yichun Zhang <agentzh@gmail.com>
12 years agoPR14172: Fix for kernels without VM_EXECUTABLE
Josh Stone [Fri, 12 Oct 2012 21:45:55 +0000 (14:45 -0700)]
PR14172: Fix for kernels without VM_EXECUTABLE

We were using VM_EXECUTABLE in two ways:

1) In task_finder for locating the process executable among all the
vmas.  Since around 2.6.26 there is also mm->exe_file, which will serve
this purpose just fine.

2) In uprobes to avoid relocation offset for semaphores in ET_EXEC
files.  This is actually incorrect, but harmless, because the callback
path for ET_EXEC targets already sets relocation=offset=0 anyway.  So we
can just remove the special case for VM_EXECUTABLE altogether.

* runtime/task_finder_vma.c (stap_find_exe_file): New, locate the
  process executable either by VM_EXECUTABLE or mm->exe_file.
* runtime/linux/task_finder.c (__stp_get_mm_path): Use stap_find_exe_file.
* runtime/linux/task_finder2.c (__stp_get_mm_path): Ditto.
* runtime/linux/uprobes-common.c (stap_uprobe_change_plus): Don't
  special case for VM_EXECUTABLE (and add a comment why).
* runtime/linux/uprobes-inode.c (stapiu_change_plus): Ditto.
  (stapiu_get_task_inode): Use stap_find_exe_file.

12 years agobump up SYSTEMTAP_CACHE_CLEAN_DEFAULT_INTERVAL_S to 300 (5 minutes)
Frank Ch. Eigler [Fri, 12 Oct 2012 21:34:03 +0000 (17:34 -0400)]
bump up SYSTEMTAP_CACHE_CLEAN_DEFAULT_INTERVAL_S to 300 (5 minutes)

12 years agotestsuite: tweak net-sanity.exp test
Frank Ch. Eigler [Fri, 12 Oct 2012 16:27:42 +0000 (12:27 -0400)]
testsuite: tweak net-sanity.exp test

It shouldn't use stap -vv, ashat creates too much noise in the .log file.
It shouldn't use 0xd34db33f as a known-bad address, because sometimes it's good.
Really good.  Mmmm, tasty, BBQ goodness good.  Honey, time to warm up the burners!

12 years agoPR14245 stapio should not pass inherited relay_basedir_fd
Frank Ch. Eigler [Fri, 12 Oct 2012 03:31:28 +0000 (23:31 -0400)]
PR14245 stapio should not pass inherited relay_basedir_fd

jistone reported that new fd passing should be suppressed for stapio-spawned
child processes like target_cmd or function::system().

* staprun/stapio.c (main): Set CLOEXEC on relay_basedir_fd (if any).

12 years agoPR14245 clean up error messages for staprun -d SOMETHING_AWFUL
Frank Ch. Eigler [Fri, 12 Oct 2012 03:28:30 +0000 (23:28 -0400)]
PR14245 clean up error messages for staprun -d SOMETHING_AWFUL

jistone reported that the previously moved
"ERROR: no access to debugfs; try "chmod 0755 /sys/kernel/debug" as root"
message was appearing for erroneous staprun -d FOOBAR cases.

* ctl.c (init_ctl_channel): Print a more general error for any .ctl-file
  opening failure.

12 years agoPR14245: fix staprun->stapio -F<fd> passing for -A (attach) mode
Frank Ch. Eigler [Fri, 12 Oct 2012 03:26:31 +0000 (23:26 -0400)]
PR14245: fix staprun->stapio -F<fd> passing for -A (attach) mode

jistone reported that the recent -F<fd> code was not passing on
a suitable basedir fd to stapio's forked for re-attach (-A) mode.
Make it so.

* staprun.c (init_staprun): In attach_mode, do a dummy
  init_ctl_channel, just to gather a relay_basedir_fd .

12 years agostapdyn: remove the TODO in favor of bugzilla
Josh Stone [Thu, 11 Oct 2012 19:58:47 +0000 (12:58 -0700)]
stapdyn: remove the TODO in favor of bugzilla

12 years agostaprun: let stap -vv (= staprun -v) print original/renamed module name before load
Frank Ch. Eigler [Thu, 11 Oct 2012 19:38:27 +0000 (15:38 -0400)]
staprun: let stap -vv (= staprun -v) print original/renamed module name before load

12 years agoBZ863832 part 2, add stap-server home directory into %install too
Frank Ch. Eigler [Thu, 11 Oct 2012 18:06:21 +0000 (14:06 -0400)]
BZ863832 part 2, add stap-server home directory into %install too

12 years agostapdyn: Fixed the verbose logging of probes found
Josh Stone [Thu, 11 Oct 2012 17:47:36 +0000 (10:47 -0700)]
stapdyn: Fixed the verbose logging of probes found

* stapdyn/stapdyn.cxx (find_uprobes): Use j to index the inner loop.

12 years agoSet staprun's verbosity one less than stap
Josh Stone [Thu, 11 Oct 2012 17:42:10 +0000 (10:42 -0700)]
Set staprun's verbosity one less than stap

Prior to commit e520ea8, staprun would get one -v for s.verbosity>1 and
a second -v for s.verbosity>2.  That commit unbounded the number of -v
for staprun, but changed the off-by-one, and staprun and stapio are too
chatty for that.

This also now sets stapdyn verbosity the same way.

* buildrun.cxx (make_run_command): Give one less -v flag.
  (make_dyninst_run_command): Set stapdyn -v flags the same way.

12 years agoFixed PR14659 so that ptrace can be used on tasks probed with systemtap.
David Smith [Thu, 11 Oct 2012 15:55:58 +0000 (10:55 -0500)]
Fixed PR14659 so that ptrace can be used on tasks probed with systemtap.

* runtime/stp_utrace.c (utrace_set_events): No longer set
  TIF_SYSCALL_TRACE on the target task.
  (utrace_reset): No longer clear TIF_SYSCALL_TRACE on the target task.
* testsuite/systemtap.base/ptrace.exp: New testcase.

12 years agoBZ863832 add stap-server home directory to our rpm payload
Frank Ch. Eigler [Thu, 11 Oct 2012 14:25:46 +0000 (10:25 -0400)]
BZ863832 add stap-server home directory to our rpm payload

dwalsh advises that doing so may make selinux more compliant with
our need for an unusually placed home directory for stap-server.

* systemtap.spec (-server %files): Add %dir /var/lib/stap-server.

12 years agoPR14245: support /sys/kernel/debug mounted 0700
Frank Ch. Eigler [Wed, 10 Oct 2012 22:10:40 +0000 (18:10 -0400)]
PR14245: support /sys/kernel/debug mounted 0700

This is done by staprun passing a file descriptor for the
/sys/kernel/debug/systemtap/stap_MODULE directory from staprun
(running setuid) to stapio (running unprivileged, previously unable to
traverse to that path itself). This FD passing is done with a new
option -F<fd> for stapio (though by accident staprun also accepts (and
rejects) this option).

Since openat(2) is relatively recent, autoconf macros are used to back
down to graceful failure on older kernels, and to hide the new code.
New staprun always uses -F<fd> to stapio, even if permissions on
/sys/kernel/debug do not require it.

* staprun/common.c (relay_basedir_fd): New variable.
  (parse_args): Parse new -F: option.
  (usage): Document it.
* staprun/staprun.h: Corresponding changes.
* staprun/ctl.c (init_ctl_channel): Reorganize to try an incoming
  relay_basedir_fd first (with a faccessat cross-user check) first.
  Try to compute a relay_basedir_fd if not already set.
* staprun/mainloop.c (read_buffer_info): Note ignoring of this PR facility on
  RHEL4-era old_transport.
* staprun/relayfs.c (init_relayfs): Attempt to open relay_fd[] using
  relay_basedir_fd if specified.
* staprun/stapio.c: Top secret.
* staprun/staprun.c (main): Don't allow staprun itself to take -F, for it
  could be misused by a very bad person (tm).  However, arrange to pass
  it to stapio, if we have incidentally discovered a good relay_basedir_fd.
* staprun/staprun_funcs.c (mountfs): Drop access_debugfs() check at this
  point, as init_ctl_channel() will do the check later.

12 years agoPR14245: have configury look for openat(2) syscall
Frank Ch. Eigler [Wed, 10 Oct 2012 22:09:21 +0000 (18:09 -0400)]
PR14245: have configury look for openat(2) syscall

... since it will be used for fd passing between staprun & stapio

12 years agostaprun: arrange -v params commeasurate with stap -v
Frank Ch. Eigler [Wed, 10 Oct 2012 21:43:53 +0000 (17:43 -0400)]
staprun: arrange -v params commeasurate with stap -v

* buildrun.cxx (make_run_command): Instead of a meager zero-to-two
  -v's for staprun, add just as many as s.verbose currently indicates.

12 years agoPR14555: tweak & simplify warning messages for _stext=0 message handling
Frank Ch. Eigler [Wed, 10 Oct 2012 16:44:03 +0000 (12:44 -0400)]
PR14555: tweak & simplify warning messages for _stext=0 message handling

12 years agoPR14555: handle 0 _stext relocs from userspace by kallsyms_lookup_name fallback
Alexander Lochmann [Wed, 10 Oct 2012 15:13:33 +0000 (11:13 -0400)]
PR14555: handle 0 _stext relocs from userspace by kallsyms_lookup_name fallback

* runtime/transport/symbols.c (_stp_do_relocation): For an incoming
  _stext=0 relocation (such as for /proc/sys/kernel/kptr_restrict = 2),
  fall back to kallsyms_lookup_name.

This page took 0.069201 seconds and 5 git commands to generate.