Frank Ch. Eigler [Wed, 21 Oct 2015 20:11:14 +0000 (16:11 -0400)]
/*stable*/ embedded-c functions: restore check for arity-0
During the various rewrites, this check got lost, and caused
arity-1 putatively-/*stable*/ functions to be recognized in
pass 2 but cause a SEGV in pass 3.
Frank Ch. Eigler [Wed, 21 Oct 2015 18:02:57 +0000 (14:02 -0400)]
PR14431: improve quoting of pretty-printed strings in $foo$$
Switch to using {kernel,user}_string_quoted() for expansion of
char-ish $var$ expansions. Required adding utf16/32 wrappers
for same, made easier by new tapset function string_quoted().
David Smith [Tue, 20 Oct 2015 21:25:36 +0000 (16:25 -0500)]
Update the fslatency-nd.stp and fsslower-nd.stp examples for newer kernels.
* testsuite/systemtap.examples/lwtools/fslatency-nd.stp: Updated for newer
kernels, without the kernel functions "do_sync_read", "do_sync_write",
and "sock_aio_write".
* testsuite/systemtap.examples/lwtools/fsslower-nd.stp: Ditto.
David Smith [Tue, 20 Oct 2015 18:19:42 +0000 (13:19 -0500)]
Fixed PR19120 by rearranging the list of modules to search in @cast().
* tapset/linux/dentry.stp (fullpath_struct_path): Rearrange the list of
modules to search for 'struct path' so that looking in "<linux/path.h>"
comes last, so that RHEL5-era kernels don't make it that far. That
include file doesn't exist on RHEL5-era kernels, which causes kbuild
warnings.
David Smith [Tue, 20 Oct 2015 17:45:59 +0000 (12:45 -0500)]
Update several of the example scripts for better kernel coverage.
* testsuite/systemtap.examples/network/tcp_trace.stp: Handle change in the
tcp_sock structure in newer kernels.
* testsuite/systemtap.examples/process/pfiles.stp: Add changes for
RHEL6-era kernels and kernels >= 4.0.
* testsuite/systemtap.examples/process/pstree.stp: Handle kernels < 3.7.
* testsuite/systemtap.examples/process/rlimit_nofile.stp: Add a fallback
for when the kernel function __alloc_fd() doesn't exist.
* testsuite/systemtap.examples/process/schedtimes.stp: Handle newer
kernels where the "sched_wakeup" tracepoint doesn't have a 'success'
argument.
* testsuite/systemtap.examples/profiling/fileline-profile.stp: Handle
32-bit kernels better by making the global array smaller.
* testsuite/systemtap.examples/profiling/pf3.stp: Ditto.
* testsuite/systemtap.examples/profiling/pf4.stp: Ditto.
* testsuite/systemtap.examples/io/slowvfs.meta: Add 'test_support' line.
* testsuite/systemtap.examples/process/procmod_watcher.meta: Ditto.
David Smith [Mon, 12 Oct 2015 16:17:00 +0000 (11:17 -0500)]
Fixed PR6525 by adding functions to get a task's cwd and exe path.
* tapset/linux/task.stp (task_cwd_path:long): New function.
(task_exe_file): Ditto.
* buildrun.cxx (compile_pass): Add export test for "get_mm_exe_file()".
* testsuite/systemtap.base/task_paths.exp: New test case.
* testsuite/systemtap.base/task_paths.stp: New test file.
* testsuite/buildok/task-embedded.stp: Added compile tests for new
functions.
Stan Cox [Fri, 9 Oct 2015 15:47:21 +0000 (11:47 -0400)]
Update systemtap.apps tests.
* (python.exp): Untest by noting that this test was replaced by
the example suite python test.
* (xulrunner.exp): Untest if gtk+-2.0 configure requirement fails
* (py?example.meta): Require python debuginfo
* (python.stpm): Update python3-lib version.
Remove the "-g" flag from both {k,u}probe tests; it's not needed, and
for the kernel case can trigger weird hangs due to overriding of the
blacklist. Relax the output matching patterns, perhaps due to
different ordering of task workqueues in 4.3.0-rc. Produce more
diagnostics upon failure.
David Smith [Thu, 8 Oct 2015 14:38:51 +0000 (09:38 -0500)]
Improve the nfsdtop.stp example script.
* testsuite/systemtap.examples/network/nfsdtop.stp: By default, now
returns 'dirname/filename' for the last files looked up for each
client. With any command line argument, returns the full pathname.
David Smith [Wed, 7 Oct 2015 19:01:20 +0000 (15:01 -0400)]
tapset: syscall.fadvise64_64.return
Tolerate occasionally mis-dwarf'd sys_fadvise64_64 function by
permitting the .return probe to resolve without a $return value.
Convert to if @defined()-based hack.
elaboration: decorate more pass-2 errors with probe derivation chain / function name
semantic_pass_types() carries out $context variable resolution, but
didn't identify what probe the $variable might have come from. This
is especially tricky if the derived_probe is many wildcarding/aliasing
levels away from the input probe point. We now print per-probe (or
analogous per-function) naming during the semantic_pass_types loops
via semantic_error chaining.
David Smith [Wed, 7 Oct 2015 15:14:15 +0000 (10:14 -0500)]
Fix PR19000 by making task_ns_pid() and task_ns_tid() more robust.
* runtime/linux/namespaces.h (from_target_pid_ns): Make sure the task
struct is valid before using it. The task_ns_pid() and task_ns_tid()
tapset functions call from_target_pid_ns().
(_stp_task_struct_valid): New function.
dsmith pointed out that switching to a quoted string is not always the
right thing to do, esp. from a backward compatibility point of view.
We now formalize a policy guideline in DEVGUIDE that *_string2 be used
when pointers should be valid but might be 0, which is the situation
with these probe points.
David Smith [Mon, 5 Oct 2015 18:10:49 +0000 (13:10 -0500)]
Fix PR19065 by making task_fd_lookup() more robust.
* tapset/linux/task.stp (task_fd_lookup): No longer write to the
task_struct memory. We check to make sure the memory is valid to read
from, but that doesn't mean it is valid to write to.
Martin Cermak [Mon, 5 Oct 2015 13:58:36 +0000 (15:58 +0200)]
Fix compile-time issues for a few _struct_compat_*_u() functions.
* tapset/linux/aux_syscalls.stp: Fix _struct_compat_itimerspec_u(),
and _struct_itimerval_u() so that they compile on non CONFIG_COMPAT
systems. Fix _struct_sched_attr_u() so that it compiles on kernels
not having struct sched_attr, i.e. when kernel_v < "3.14".
* testsuite/buildok/aux_syscalls-embedded.stp: Remove unneeded
constraint for _struct_sched_attr_u() testing.
David Smith [Fri, 2 Oct 2015 16:55:19 +0000 (11:55 -0500)]
Fix PR17920 by adding task_fd_lookup().
* tapset/linux/task.stp (task_fd_lookup): New function.
* tapset/linux/dentry.stp (fullpath_struct_file): Ditto.
* testsuite/buildok/dentry-embedded.stp: Added compile test for
fullpath_struct_file().
* testsuite/buildok/task-embedded.stp: Added compile test for
task_fd_lookup().
* testsuite/systemtap.base/task_fd_lookup.exp: New testcase for
task_fd_lookup.
* testsuite/systemtap.base/task_fd_lookup.stp: Ditto.
* testsuite/systemtap.base/task_fd_lookup.c: Ditto.
David Smith [Fri, 2 Oct 2015 15:36:35 +0000 (10:36 -0500)]
Fix PR19021 by adding support for synthetic filesystems to task_dentry_path().
* tapset/linux/dentry.stp (task_dentry_path): Add better support for
synthetic filesystems, like pipes, sockets, etc.
(fullpath_struct_path): Add better RHEL5 support.
Martin Cermak [Fri, 2 Oct 2015 14:48:54 +0000 (16:48 +0200)]
Explicitly set the return type for __stack_raw() and __ustack_raw().
Missing return type defs may cause "unresolved type" error when
calling a function without enough context for type inference to work
like e.g. `stap -e 'probe oneshot{println(__stack_raw(0))}'`.
David Smith [Thu, 1 Oct 2015 21:03:08 +0000 (16:03 -0500)]
Fix PR19045 by updating _stp_text_str() (called by kernel_string_quoted()).
* runtime/stp_string.c (_stp_text_str): Use _stp_read_address() to read
kernel memory also, not just user memory. This should keep us safe from
invalid pointers.
David Smith [Thu, 1 Oct 2015 18:50:21 +0000 (13:50 -0500)]
Fix PR19043 by updating __bio_ino(), __rqstp_gid() and __rqstp_uid().
* tapset/linux/nfsd.stp (__rqstp_uid): Make sure all pointers are valid
before using them.
(__rqstp_gid): Ditto.
* tapset/linux/ioblock.stp (__bio_ino): Ditto.
(bio_rw_num): Rewrite using embedded-C.
Eliminating the timer.s() wait, putting in a fixed 'sleep NN'
into the -c CMD string makes stopping condition clearer and
overall CMD exit value fixed (0).
On a rawhide smp box, it was possible to see corrupted lines of text
from this test's multiple concurrent outputs, and thus lose counts.
The strings are revised, and exit timing managed mroe carefully,
to make the run more repeatable.
David Smith [Fri, 25 Sep 2015 17:25:41 +0000 (12:25 -0500)]
Set up kfails for testsuite/buildok/stap_staticmarkers-detailed.stp.
* testsuite/systemtap.pass1-4/buildok.exp: For
buildok/stap_staticmarkers-detailed.stp, kfail if we don't have uprobes
or if we're not running as root. Only root can read "staprun".
Martin Cermak [Fri, 25 Sep 2015 14:20:20 +0000 (16:20 +0200)]
Add explicit typecasts ensuring buildability of json_set_prefix().
Without this update json_set_prefix() doesn't compile on rhel[56]
i686 systems due to "format ‘%lu’ expects type ‘long unsigned int’,
but argument 4 has type ‘size_t’". The reproducer is as follows:
`stap -wge 'probe oneshot {println(json_set_prefix("blah"))}'`
David Smith [Thu, 24 Sep 2015 21:01:57 +0000 (16:01 -0500)]
Refix PR18999 by changing the way we check last_error.
* tapsets.cxx (common_probe_entryfn_epilogue): Only check to see if
'last_error' isn't NULL, don't check to see if it isn't empty.
* tapset/logging.stp (error): Don't provide a default error message.
lberk noticed that our examples, and especially their listings at
sourceware.org/systemtap/examples/ may mislead people who run older
versions of systemtap that can't run all modern samples. We now
add a brief version header to tip people off.
work for PR18455 now produces a mismatch error in the case that
some binary expression has a long expression and a string expression,
meaning the string+long binary expression no longer gets optimized out.
elaborate.cxx: stop analyzing the script if an error was generated in
the initial type pass to avoid generating a duplicate error in the
main type resolution pass
elaborate.cxx: in const_folder::visit_binary_expression() if one
side is a literal number and the other is not pe_long or pe_unkown,
produce a type mismatch
PR18455: globals type_details are null in initial typres
elaborate.cxx: in the intial type pass, follow semantic_pass_types()
and set globals' type_details to null, since globals are not supposed
to have detailed types. this fixes the semko/autocast05.stp failure.
elaborate.cxx: since some visit* functions in the typeresolution_info visitor
just throw errors, create an initial_typeresolution_info visitor that
overwrites those functions to account for substitutions/replacements not being
done. semko tests autocast05 and binexpr_infer_type fail with theses changes.
Abegail Jakop [Wed, 26 Aug 2015 21:36:31 +0000 (17:36 -0400)]
PR18455: use an initial type resolution pass
elaborate.cxx: for the const_folder visitor attempt to resolve some
times before the const_foler visitor is called. this is to try to
propogate an expression's type that is implied by what expression it's
in, up to the vardecl, to avoid unresolved type errors in cases like:
{println(i*0)}
Abegail Jakop [Tue, 25 Aug 2015 15:09:39 +0000 (11:09 -0400)]
PR18455: testcases for type inference changes
semok/*: if some part of a binary expresion is elided in the const_folder
visitor, the type inference is still passed on.
semko/*: if some part of a binary expression, where one expression is a
string and the other is a long, gets elided in the const_folder visitor,
the type inference is still passed on, and stap reports a type mismatch.
Abegail Jakop [Tue, 25 Aug 2015 15:00:51 +0000 (11:00 -0400)]
PR18455: suggest type in const_folder binary expr
elaborate.cxx: within const_folder::visit_binary_expression(), for cases
like {println(i+0)} where part of the binary expression is elided, suggest
what the type (pe_long) should be to the remaining part of the expression.
Fix BZ1264678 by updating the networking tapset for the 4.1 kernel.
* tapset/linux/networking.stp (netdev.transmit): Prefer
__dev_queue_xmit() if available.
(netdev.hard_transmit): Handle the change in argument name from 'skb' to
'first'.
David Smith [Mon, 14 Sep 2015 15:35:36 +0000 (10:35 -0500)]
Fix PR18944 by updating runtime/linux/autoconf-blk-types.c.
* runtime/linux/autoconf-blk-types.c: Add linux/blkdev.h that hopefully
includes linux/rh_kabi.h. We can't include it directly since it doesn't
exist on non-RHEL kernels.
David Smith [Wed, 9 Sep 2015 15:47:57 +0000 (10:47 -0500)]
Fixed PR18942 by avoiding the inclusion of unused global variables.
* tapset/linux/aux_syscalls.stp (__count_envp): Changed the name of the
'argc' local variable to '__argc' to avoid confusing the translator with
the global 'argc' variable from tapset/argv.stp.
(__count_compat_envp): Ditto.
Josh Stone [Tue, 8 Sep 2015 21:24:36 +0000 (14:24 -0700)]
PR18936: extend the lifetime of synthesized DW_OP_addr
In dwflpp::literal_stmt_for_local(), a fake addr_loc is created for
variables we find in the symbol table. But this addr_loc had tight
scope on the stack, and its contents were clobbered by the time the
pointer was read by emit_header().
Just extending the lifetime to the whole function scope is enough.
Josh Stone [Fri, 4 Sep 2015 18:11:53 +0000 (11:11 -0700)]
Switch to SSL_GetImplementedCiphers()
When nss rebases, the size of SSL_ImplementedCiphers[] may change. If
we have a copy relocation, this could mean we'll get an incomplete copy
of the array. Use the accessor function instead for a simple pointer.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=496993
Martin Cermak [Fri, 4 Sep 2015 07:38:45 +0000 (09:38 +0200)]
PR18649: Add tests for the new --prologue-searching option
* NEWS: Add entry describing the new option.
* hash.cxx: Add the option index into the script hash.
* testsuite/parseko/cmdline23.stp: New testcase.
* testsuite/parseok/cmdline03.stp: Ditto.
* testsuite/systemtap.base/pr18649.exp: Ditto.
PR18889: switch to STP_TRACEPOINT* frontend for kernel tracepoint registration
jistone kindly reminded that the runtime/stp_tracepoint.[ch] machinery
allows us to attach to kernel tracepoints, whether on string- or
tp*-based kernel APIs, and whether or not the tp* objects are
EXPORT_TRACEPOINT_SYMBOL_GPL'd. Let's use those; presto we get
module-init probing back on kernels oldish and newish.
Frank Ch. Eigler [Mon, 31 Aug 2015 21:46:43 +0000 (17:46 -0400)]
PR18889 part: module-init notification via module_{load,free} tracepoints
Investigating RHBZ1257399 et al., we found that module_notifier is
being called too early after kernel commit #4982223e51. This
precludes normal module section-address computation and thus kprobe
emplacement. This patch adds hooking into the module_{load,free}
tracepoints in parallel, because on some kernels (RHEL7.1.Z+) they
occur at just the right time.
On the downside, on recent LKML kernels, attaching to those
tracepoints requires EXPORT_TRACEPOINT_SYMBOL_GPL's, so until that is
done (or another workaround made), LKML kernels will still miss out on
module-init probing.