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.
Frank Ch. Eigler [Wed, 31 Aug 2011 17:04:27 +0000 (13:04 -0400)]
runtime: remove probe_start/_exit() intermediary
These functions were unnecessary; the runtime can call to the
translator-generated systemtap_module_init|exit throughout.
Documentation and comment changes dominate this patch.
Frank Ch. Eigler [Wed, 31 Aug 2011 15:52:29 +0000 (11:52 -0400)]
PR6503 part 1: separate out _stp_kmodule_update_address
* runtime/sym.c (_stp_kmodule_update_address): New function, body
pulled from river at ...
* runtime/transport/symbols.c (_stp_do_relocation): Chop into two bits.
Auto-discovered dependencies are fine when building on the system the
package will be used on; but for distributions such as Gentoo or for
cross-compilation, they only cause headaches if they are not configurable.
By adding two simple ./configure options, the problem is solved.
Checking for directories directly on the /usr disallows building against a
locally-installed NSS or Avahi, and makes cross-compilation difficult.
By using pkg-config, it's easy to override the results, which allow
building against non-system libraries as well as properly identifying
cross-compiled libraries.
Chris Meek [Tue, 30 Aug 2011 13:42:28 +0000 (09:42 -0400)]
PR12773 cont'd: Added Kernel Debuginfo Support
NOTE: Due to BZ733690, abrt cannot download the kernel-debuginfo.
As soon as that bug is fixed, this feature should work.
setupdwfl.cxx
- Added get_kernel_build_id_from_notes()
- This is used to extract the build ID hex string
from /sys/kernel/notes
- Added download_kernel_debuginfo(systemtap_session &s)
- This attempts to extract the build ID hex string
from /lib/modules/<release>/build/vmlinux.id and
if it fails, it calls the above function. It then
calls abrt to attempt to download the associated
debuginfo.
setupdwfl.cxx
Added function declarations for the above.
Frank Ch. Eigler [Thu, 25 Aug 2011 21:21:22 +0000 (17:21 -0400)]
PR13057 related, remove process.**.return.maxactive(N) probe type
The .maxactive stuff is strictly for kretprobes, so should not be
present in process (uprobes) probes. Use the existing
bind_unprivileged_p flag as a proxy for whether we're dealing with
kernel vs. process probe point hierarchy.
* tapsets.cxx (dwarf_derived_probe::register_*_variants): Make
bind_unprivileged_p an explicit (non-defaulted) argument.
Update callers.
(register_function_variants): Skip TOK_MAXACTIVE variant for process
probes.
Dave Brolley [Thu, 25 Aug 2011 16:14:10 +0000 (12:14 -0400)]
PR 11441 - continue with unprivileged test suite
- New unprivileged_all.exp replaces previously existing unprivileged
mode test suites.
- Tests all known probe point types for expected success/failure for
unprivileged users.
- Checks the above directly and also using an alias.
- Checks that all known probe point types have been tested (uses
--dump-probe-types).
Dave Brolley [Thu, 25 Aug 2011 16:10:59 +0000 (12:10 -0400)]
PR 13057 Provide a Command Line Option to Dump Supported Probe Points
New command line option, --dump-probe-types, has been added. If
--unprivilged is also specified, the dump will be limited to
probe types available to unprivileged users.
David Smith [Thu, 18 Aug 2011 18:34:01 +0000 (13:34 -0500)]
Fixed PR13055 by getting procfs probes working on 3.1 kernels.
* runtime/procfs.c (_stp_rmdir_proc_module): Fix problem where
'/proc/systemtap' wasn't getting removed correctly.
(_stp_mkdir_proc_module): Add support for kernels where neither
path_lookup() or kern_path_parent() are exported (such as the 3.1
kernels).
* buildrun.cxx (compile_pass): Convert compile test for kern_path_parent()
to an export test. Add exports tests for path_lookup() and
vfs_path_lookup().
* runtime/autoconf-kern-path-parent.c: Removed.
Josh Stone [Wed, 17 Aug 2011 21:46:45 +0000 (14:46 -0700)]
PR13078: Support stap --remote unix:/path sockets
* remote.cxx (unix_stapsh): New, connects to an AF_UNIX socket.
(stapsh::get_reply): Deal with possible stapsh stderr chatter.
(stapsh::handle_poll): Rework to handle some corner cases better,
like having the same fd for in and out.
* testsuite/systemtap.base/stapsh-unix.exp: New test using socat.
* testsuite/systemtap.base/stapsh-unix.stp: New test.