William Cohen [Wed, 5 Aug 2020 13:43:17 +0000 (09:43 -0400)]
Make dtrace generated code work with LTO (take 2)
LTO needs to know which variables might be accessed by code. In sdt.h
there is a fair amount of assembly code which LTO cannot analyze. As
a result LTO would assume that the semaphores variables for various
userspace probes were not accessed by the generated code. The linking
would fail because LTO would optimize away the semphore variables
causing undefined references.
The fix adds the semaphore variables as input operands to the assembly
statements. This gives the LTO analyzer information that the
variables are used within the assembly statements and should not be
removed.
PR26307: adapt to kernel module_sect_attr changes in 5.8+
Linux v5.8 rc5ish, commit ed66f991bb19, introduced a change to the
internal module_sect_attr types. It caused a kernel BUG: with
pr14546.exp. This showed it's futile to keep chasing it this
particular way in runtime/transport/symbols.c, so for new enough
kernels (4.7+), a method based on
kernel_read_file_from_path("/sys/module/$MODULE/sections/$SECTION") is
used to extract module section base-addresses.
This is done by a new paper-thin abstraction. Tested on RHEL7, F32,
rawhide.
PR26249: "%p" -> "0x%lx" pointer formatting in *conversions.stp error messages
function::user_string() and function::user_string_warn() in uconversions.stp
were passing an "unsigned long" to the "%p" format-specifier, which upset gcc10.
Switch to 0x%lx. In the process, change other uses of %p to use 0x%lx instead,
changing casts from (void*) to (unsigned long) where necessary.
Fixes the following error on gcc10 (Fedora 32):
In function ‘function___global_user_string_n_warn__overload_1’:
/tmp/stapXXXXXX/stap_[...]_src.c: error: format ‘%lx’ expects
argument of type ‘long unsigned int’, but argument 5 has type
‘void *’ [-Werror=format=]
PR25568 / RHBZ1857749: buildid/uprobes/inode rework, task_finder etc. side
During work on a new stress tests for build-id based probes (coming in
next commit), it was found that the task_finder2 logic for buildid
verification didn't, well, work, because it was never run (due to an
erroneous pathlen conditional), and couldn't be safely run where it
was (because it was under spinlock but would have done
access_process_vm). Reworked the relevant bits of task_finder2 to
perform build-id verification for processes later - during the quiesce
callback periods. (Buildid verification for solibs is already done
in the task_finder2 consumer uprobes-inode.c.)
Testing with sdt_misc indicated a case where a preexisting process
(with solib sdt.h semaphores) was being attached to by a new stap
binary. task_finder2's enumeration of the preexising processes'
memory map segments violated assumptions by recent code related to
tracking in stapiu_process[] lists. (It did not mirror the temporal
ld.so mmap sequence.) Changed this tracking to use the inode* as the
key, and stop trying to track mapping lengths, to make positive
matches and eliminate duplicate stapiu_process[] entries for the same
(process,solib) permutation. Reworked stapiu_process[] accumulation
generally to move to the two immediate task_finder callbacks, out of
stapiu_change_plus().
Added lots of commentary and diagnostics throughout. stap
-DDEBUG_UPROBES give meaningful info about uprobes & sdt semaphores;
with -DDEBUG_TASK_FINDER, more but not overwhelming relevant info
appears.
rhbz1857749: uprobes-inode regression in sdt semaphore setting
Previous code neglected to set sdt.h semaphores for more than the
first process systemtap happened to encounter. This was from a
mistaken understanding of what it meant for stapiu_change_plus() to be
called with the same inode/consumer combination. Even though uprobes
are automatically shared, each new process still needs its perfctr and
sdt-semaphores individually set, so we do that now (as before the
rework of this code). Mechanized testing incoming shortly.
configury: make systemtap buildable with gcc -flto
Two problems corrected:
1 - Some of the stap object files compiled the interned_string type
differently based on whether config.h was #included early enough
or not. Now they all do it at the top.
2 - The staprun/libstrfloctime.a pseudo-archive (added in commit 0a5f4aa83e5b4 to work around an autoconf limitation), needs a
-Wl,--whole-archive wrapper around it for lto linking purposes.
Now also stap builds on f32 both with and without:
William Cohen [Tue, 14 Jul 2020 20:36:24 +0000 (16:36 -0400)]
Make dtrace generated code work with LTO
LTO will attempt to remove variables if they are not clearly as used
in assembly code and the linking will fail with errors about undefined
variables. The semaphores variables in the sdt.h macros need to be
marked as global to ensure that LTO doesn't incorrect remove them.
William Cohen [Mon, 13 Jul 2020 20:10:22 +0000 (16:10 -0400)]
Make dtrace generated code work with LTO
When variables are marked with the unused attribute LTO will attempt
to remove variables when they are only used by assembly code. Marking
the semaphores variables generated by the dtrace with the used
attribute will ensure that LTO doesn't incorrect remove them.
PR26234: stapbpf should warn about unsupported utrace_derived_probes
Probes such as process.begin are handled by task_finder, which is
not supported by BPF. Until some workaround is found, print
a warning instead of silently ignoring the probes.
testsuite: block listing_mode_sanity large tests on small machine
Use a /proc/meminfo based heuristic to block two particularly
cpu/ram-costly tests on small machines, for same reasons as we nuked
semok/twenty.stp some time ago.
RHBZ1847676 cont'd: one more uprobes-inode/onthefly concurrency control
In uprobes-inode.c (stapiu_change_plus), the runtime can react to
arrivals of new mappings of a solib or executable by registering new
uprobes. Due to an assumption that this could not happen at
inconvenient times (such as a stapiu_refresh or near shutdown times),
the actual uprobes registration operation was done outside the
consumer_lock mutex being held. But it appears this can happen at bad
times, so the mutex needs to be held, just like within
stapiu_consumer_refresh().
The onthefly tests now survive iterating testing on rawhide+lockdep
and rhel7+lockdep.
On recent kernels, printk("...%p...") pointers are obfuscated by
default. Tweak the systemtap startup dmesg to present a real pointer
(via "%lx"), which is essential for troubleshooting.
run-stap.in: forget about bundled elfutils build mode
The "run-stap" script in the build tree allows developers to run
a freshly built, un-installed copy of systemtap. It still knew of
our former bundled-elfutils build mode. That has been removed,
so this logic is now gone from this script.
PR25549: statement probe visibility for openmp / lto binaries
gcc -flto and -fopenmp can synthesize function bodies that may miss
DWARF attributes such as AT_decl_file. Previously, systemtap included
a check to match the value of that attribute against a list of file
names extracted from the source-file directory, and would reject any
function DIE that doesn't match. So these -flto/-fopenmp functions
were invisible to systemtap probes. We now override this for the case
for functions that completely lack that attribute, to expose these to
normal dwarfy probing. New test case included (using -fopenmp).
Martin Cermak [Thu, 9 Jul 2020 07:19:01 +0000 (09:19 +0200)]
Tapset and testsuite updates against @cast() change 00ee19ff03
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
These are respective tapset and testsuite minor updates.
RHBZ1847676 cont'd: more uprobes-inode/onthefly concurrency controls
The systemtap.onthefly/*.exp tests had recently become hang-prone on
some kernels, for reasons still not completely understood. This set
of patches adds:
- irq*-block spinlocks into uprobes-invoked paths, in case there is
peculiar reentrancy (from irq-related tracepoints)
- a mutex lock/unlock into the stapiu_exit() path, in case there is
a concurrent stapiu_refresh() invoked by onthefly machinery around
exit time
- restrictions into the onthefly module_refresh() translator code to
preclude STAP_SESSION_STOPPING as a time to do any sort of refresh
operation. Now probes that were disarmed will stay disarmed during
probe-end/error/etc. processing, which is always valid with the
spec, and avoids a class of late module-refresh ops
Testing on rhel7 and rawhide indicates the reproducible hang is gone.
Our testsuite already tortures this code; invoke by hand via:
% sudo make installcheck RUNTESTFLAGS="-v affection.exp hrtimer_onthefly.exp kprobes_onthefly.exp tracepoint_onthefly.exp uprobes_onthefly.exp"
Some versions of gcc complain about an error-message
formatting mismatch:
'probe begin {println(user_string_n_warn(0, 20)) }'
->
/var/tmp/stapk2aFPs/stap_b9f8a6b29bbfa7f7e051c7587bbf7762_1907_src.c:288:40: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘void *’ [-Werror=format=]
288 | "user string copy fault 0x%ld at %lx [man error::fault]", rc,
This switches to "0x%lx", (uintptr_t) consistently in related functions.
Frank Ch. Eigler [Tue, 30 Jun 2020 23:04:16 +0000 (19:04 -0400)]
PR26142: adapt to linux mmap_sem api transition
With upstream linux 5.8-bound commit da1c55f1b27, the
mm_struct->mmap_sem field is renamed, and a new <mmap_lock.h> api is
introduced to lock/unlock it. Adapting only the most recent runtime
parts (task_finder2.c and access_process_vm.h) to the new api by
providing autoconf-driven macro wrappers. Other
backward-compatibility parts of the stap runtime still use mmap_sem,
but those are only compiled on old kernels, so don't appear to need
this porting. Tested on 5.8.0-0.rc2.20200626git4a21185cda0f.1.fc33.x86_64
and 5.6.19-300.fc32.x86_64.
Frank Ch. Eigler [Tue, 30 Jun 2020 19:24:18 +0000 (15:24 -0400)]
PR26142: Adapt to linux/vermagic.h file hiding
Linux commit 51161bfc66a68 (2020-04-19) enforces a convention of not
including <linux/vermagic.h> from normal source files. Switch to
<generated/utsrelease.h>, which has UTS_RELEASE, which is all that we
really wanted anyway.
Martin Cermak [Mon, 29 Jun 2020 14:30:34 +0000 (16:30 +0200)]
PR26181: Use explicit @cast() within get_ip_from_client()
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
Also, fix the type of server_ip, which historically had been a long,
but since systemtap_v >= "4.3", it is a string.
William Cohen [Mon, 22 Jun 2020 15:28:32 +0000 (11:28 -0400)]
Use explicit @cast() operators pointing to kernel for tapsets
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
PR26131: garbled data might appear in staprun data channel output
The relay v2 data writing lacked inode locking protection against
concurrent readers (on the stapio side).
The garbled data often contains '\0' bytes and might replace good data
or get appended to the good data stream.
Because the context of relay data writers may not allow sleeping, we use
a simple bounded spinlock to acquire the inode lock at our best effort
(up to about 300K cycles). Data loss might occur when we fail to obtain
the inode lock in which case it will be recorded as a "transportation
failure" and will get reported as a warning message. Increasing the
buffer size via 'staprun -b SIZE' would help reduce the risk of lock
contention.
The relay v1 implementation is not covered in this patch since it is old
and not even used on CentOS 6.
Succcessfully stress-tested on CentOS 6, CentOS 7, and Fedora 28. Also
tested with the kernel-debug packages' kernels on CentOS 7 and Fedora 28.
William Cohen [Thu, 18 Jun 2020 21:14:30 +0000 (17:14 -0400)]
Use kernel.trace("sched:sched_process_fork") for kprocess.create when possible
With optimization the copy_process function is often inlined making it
impossible for kprocess.create to probe the return of the copy_process
function. The equivalent tracepoint sched:sched_process_fork should
be used instead to avoid that issue. This change allows the
forktracker.stp and spawn_seekeer.stp examples to run even on kernels
where copy_process has been inlined.
William Cohen [Thu, 18 Jun 2020 17:32:50 +0000 (13:32 -0400)]
Use explicit @cast() operators for periodic.stp
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
Serhei Makarov [Wed, 17 Jun 2020 19:48:56 +0000 (15:48 -0400)]
PR24758: increase stack size for BPF userspace interpreter
Requires parametrizing MAX_BPF_STACK by the target.
* bpf-internal.h (MAX_BPF_KERNEL_STACK): new constant.
(MAX_BPF_USER_STACK): new constant.
(MAX_BPF_STACK): change to a macro depending on target.
(program::use_tmp_space): pass target to MAX_BPF_STACK.
* bpf-opt.cxx (alloc_literal_str): pass target to MAX_BPF_STACK.
(spill): pass target to MAX_BPF_STACK.
* stapbpf/bpfinterp.cxx (bpf_interpret): increase stack size
to match MAX_BPF_USER_STACK in bpf-internal.h.
William Cohen [Wed, 17 Jun 2020 17:39:20 +0000 (13:39 -0400)]
Use explicit @cast() operators for pfiles.stp and ioctl_handler.stp
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
William Cohen [Wed, 17 Jun 2020 17:13:43 +0000 (13:13 -0400)]
Remove the unneeded test_support check the lwtools meta info
The test_support is to check to see if some needed feature or probe
point is available. Using the example itself as the test for support
is not useful, so removing them.
William Cohen [Wed, 17 Jun 2020 17:08:30 +0000 (13:08 -0400)]
Use explicit @cast() operators to fslatency-nd.stp and fsslower-nd.stp
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to include kernel as location for
this information for the @cast() rather than just assuming a default.
William Cohen [Wed, 17 Jun 2020 15:57:18 +0000 (11:57 -0400)]
Fix sizeof.stp to explicitly use kernel debuginfo if one not specified
Commit 00ee19ff030f665df7e087a579f39105256a0253 changed how @cast()
operations work and they no longer default to using the kernel
debuginfo for type information. Need to use the @cast_module_sizeof()
instead of @cast_size() to use the kernel debuginfo.
Frank Ch. Eigler [Wed, 17 Jun 2020 00:35:53 +0000 (20:35 -0400)]
RHBZ1847676: uprobes-inode tweaks redux
Added (back) a spinlock to manage the stapiu_consumer -> process_list
structure, since it is occasionally travered from uprobe pre-handlers,
which are sometimes entered in atomic context (e.g. on rhel7). There,
the normal mutex_t is unsafe. So restoring a spinlock_t just for
those shortlived traversals, rhel7 and rawhide are both happy.
William Cohen [Thu, 11 Jun 2020 20:19:26 +0000 (16:19 -0400)]
Avoid exceeding space constraints for the BPF environment in mmfilepage.stp
The BPF runtime environment is very space constraint. The
mmfilepage.stp example has been reorganized to reduce the stack space
and number of BPF registers needed to run the code to allow the
generated BPF code to fit within the constraints.
William Cohen [Thu, 11 Jun 2020 19:54:32 +0000 (15:54 -0400)]
Avoid exceeding space constraints for BPF environment in mmwriteback.stp
BPF is very contrained on the space allowed when running the code.
Using too complicated printf statements caused too much stack space to
be used for temporaries and the stap compile would fail for the BPF
backend. Replacing the complicated printf with simpler string printf
statements uses less stack space and allows the BPF backend to compile
this example.
Serhei Makarov [Thu, 11 Jun 2020 00:22:06 +0000 (20:22 -0400)]
PR26019 stapbpf: don't continue startup if begin probe already exited
if a bpf begin probe sets exit status, the main thread will skip the
pause() call and immediately deallocate global data structures. Then
the perf_event_loop thread will run on the corrupted data and
occasionally fail. Example result is an assertion failure due
count_active_cpus() running on corrupted data.
Could change the main thread to join() instead of detach(), but then
all threads must be modified to listen for exit status including exit
status from begin thread. TODO Consider doing so later.
I think if the begin probe was running, it wasn't correct to start the
perf_event_loop (or PERF_EVENT_IOC_ENABLE, or any of the procfs
threads) in the first place, as those things logically happen after
the begin probe has already exited. Simply clean up and exit.
Frank Ch. Eigler [Thu, 11 Jun 2020 00:28:01 +0000 (00:28 +0000)]
uprobes-inode: rework for buildid vs. onthefly work
Tweak locking in the cleanup paths. stapiu_consumer_unreg (at
stap exit time) now does all cleanup, including its process_list,
and stapiu_change_minus (at probed process exit) does nothing.
This seems to strike a good balance between cheering up lockdep
and using a little more memory during very long-lived stap jobs.
uprobes-inode: rework for buildid vs. onthefly work
Addition of the buildid-based probes has highlighted some weaknesses
in the uprobes-inode code with respect to the interlinking & sharing
of various tracking data structures. This patch reworks the code to
simplify and document. The uprobes_onthefly.exp test case easily
survives now.
gcc compatibility: use gcc #pragma to suppress -Wtautological-compare
On some compilers / distros, the kbuild-flavour cc-options runtime
test for suppressing -Wtautological-compare does not work. So we
switch to a pragama based suppression that works as far back as rhel7
gcc 4.8.5. We need to suppress that warning because script-originated
generated code can easily include tautologies.
Serhei Makarov [Wed, 10 Jun 2020 17:47:07 +0000 (13:47 -0400)]
PR26074 fixup: disable #else paths on !USE_KALLSYMS_ON_EACH_SYMBOL
These previously #else paths should only be taken if
USE_KALLSYMS_ON_EACH_SYMBOL does not hold, not if
USE_KALLSYMS_ON_EACH_SYMBOL is true but the runtime condition is
false.
Serhei Makarov [Tue, 9 Jun 2020 16:31:34 +0000 (12:31 -0400)]
PR26099: adapt to struct proc_ops split from struct file_operations
Linux kernel commit d56c0d45f0e for version 5.6 made the following changes:
- procfs functions now take struct proc_ops instead of struct file_operations
- proc_dir_entry now has union{proc_ops,proc_dir_ops} instead of proc_fops
struct proc_ops is newly declared in the commit, so we test for its presence.
* buildrun.cxx (compile_pass): Introduce STAPCONF_PROC_OPS.
* runtime/linux/autoconf-proc-ops.c: New file. Test for struct proc_ops.
* runtime/procfs-probes.c (_stp_proc_fops): Declare as proc_ops when available.
* runtime/procfs.c (_stp_create_procfs): Take fops as proc_ops when available.
* runtime/transport/control.h (_stp_ctl_proc_ops.cmd): New proc_ops version of
_stp_ctl_fops_cmd for use
* runtime/transport/control.c (_stp_ctl_proc_ops.cmd): Ditto.
* runtime/transport/procfs.c (_stp_proc_fops): Declare as proc_ops when available.
(_stp_register_ctl_channel): struct proc_dir_entry renamed proc_fops to proc_ops,
adapt in two locations.
William Cohen [Tue, 9 Jun 2020 13:29:46 +0000 (09:29 -0400)]
Add probes to container_check.stp for additional capabilities checks
Probe points were added for ns_capable_noaudit, ns_capable_setid,
and file_ns_capable functions. Before adding these probes some
capability checks were missed by the container_check.stp script.
This was observed running the script on DPDK testpmd.
Serhei Makarov [Fri, 5 Jun 2020 19:12:21 +0000 (15:12 -0400)]
PR26074: pass kallsyms_lookup_name as a relocation to the stap runtime
Kernel commit 0bd476e6c671 unexports kallsyms_lookup_name
and kallsyms_on_each_symbol.
As kallsyms_lookup_name is used to look up unexported symbols, we need to
use the relocation mechanism (the same one used to pass _stext) to pass
these symbols to the runtime where necessary.
The patch preserves the old behaviour (link the exported symbol directly)
where kallsyms_lookup_name is available.
* buildrun.cxx (compile_pass): Change output_autoconf
STAPCONF_KALLSYMS_ON_EACH_SYMBOL to exportconf
STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED. Since the symbol may be
accessed even when unexported, the autoconf-kallsyms-on-each-symbol.c
is no longer accurate. Control the powerpc issue (PR11514) with
appropriate #ifdefs instead.
Change STAPCONF_KALLSYMS to STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED.
* runtime/linux/autoconf-kallsyms-on-each-symbol.c: Deleted.
* runtime/linux/runtime.h (_stp_kallsyms_lookup_name): New field.
(_stp_kallsyms_on_each_symbol): New field.
* runtime/sym.c (kallsyms_lookup_name_fn): New typedef.
(kallsyms_lookup_name): New function, linked in place
of kallsyms_lookup_name, calls _stp_kallsyms_lookup_name if available.
(kallsyms_on_each_symbol_fn): New typedef.
(kallsyms_on_each_symbol): New function, linked in place of
kallsyms_on_each_symbol, calls _stp_kallsyms_on_each_symbol if available.
* runtime/sym.h (_stp_need_kallsyms_stext): New field.
(_stp_set_stext): New function, called to adjust _stp_kretprobe_trampoline
if kallsyms_lookup_name("_stext") call is delayed until after the relocation
is received.
* runtime/transport/symbols.c (_stp_set_stext): New function.
(_stp_do_relocation): Set _stp_kretprobe_trampoline if kallsyms_lookup_name
is not yet available,
Accept and set _stp_kallsyms_lookup_name and _stp_kallsyms_lookup_symbol
from relocations.
* runtime/transport/transport.h (_stp_handle_kallsyms_lookups): New function,
does delayed kallsyms_lookup_name() lookups previously done
in _stp_transport_init(), does delayed _stext lookup.
* runtime/transport/transport.c: Include sym.h for _stp_set_stext().
(_stp_handle_kallsyms_lookups): New function.
(_stp_transport_init): Don't do kallsyms_lookup_name() lookups yet
as kallsyms_lookup_name may be passed later on via relocation.
Init the addresses and _stp_need_kallsyms_stext to NULL instead.
* translate.cxx (c_unparser::emit_module_init): Emit a call to
_stp_handle_kallsyms_lookups() into systemtap_module_init(),
where the relocations for kallsyms_lookup_name() will be available.
* staprun/staprun.c (send_relocation_kernel): Look up
kallsyms_lookup_name and kallsyms_on_each_symbol in /proc/kallsyms
and send their addresses as STP_RELOCATION messages.
* runtime/linux/kprobes.c: define USE_KALLSYMS_ON_EACH_SYMBOL.
May be determined statically or dynamically depending on whether
a relocation is necessary to call kallsyms_on_each_symbol.
(stapkp_prepare_kprobe): change #ifdef to if(USE_KALLSYMS_ON_EACH_SYMBOL).
(stapkp_prepare_kretprobe): Ditto.
(stapkp_symbol_data): make available in all circumstances.
(stapkp_init): change #ifdef to if(USE_KALLSYMS_ON_EACH_SYMBOL).
(stapkp_refresh): Ditto.
* runtime/transport/transport_msgs.h (enum): clarifying comment
for STP_RELOCATION message.
While -lebl has been integrated into -ldw in recent versions of
elfutils, some older versions need a better aimed check, for
the exact symbol that bpf-translate.cxx uses.
Juri Lelli [Wed, 3 Jun 2020 13:19:26 +0000 (09:19 -0400)]
RHBZ1842866 kernel-rt port: treat CONFIG_PREEMPT_RT as if ..._FULL
Until recently CONFIG_PREEMPT_RT_FULL was the config switch used by
PREEMPT_RT (and RHEL-RT up to 8.2) for building an RT kernel.
Upstream commit a50a3f4b6a313 ("sched/rt, Kconfig: Introduce
CONFIG_PREEMPT_RT") changed that to be CONFIG_PREEMPT_RT.
Alice Zhang [Mon, 1 Jun 2020 16:10:30 +0000 (12:10 -0400)]
Fix PR13793 by adding IPv6 support nfs_proc.stp
* tapset/linux/nfs_proc.stp: Updated get_ip_from_client and get_ip with IPv6 support for version after 4.3
* testsuite/buildok/nfs_proc-embedded.stp: Fix probe point so that embedded-C would work properly. Support version before 4.2.
* testsuite/buildok/nfs_proc-embedded-newver.stp: nfs_proc-embedded test case that supports version after 4.3.
* testsuite/buildok/rpc-embedded.stp: Fix probe point so that embedded-C would work properly.
Frank Ch. Eigler [Sat, 30 May 2020 18:15:29 +0000 (14:15 -0400)]
runtime/tapset: adapt to more time32 kernel deprecation
Linux commit 412c53a6 et al., deprecate various 32-bit time-related
types/structs. Many are replaced by userspace-compatibility types
under different names ("old_*") in a different header, so we #include
that. In order to keep the runtime code as unchanged as possible, we
add some of the name-mapping macros into our own embedded-C code.
Frank Ch. Eigler [Thu, 28 May 2020 20:58:28 +0000 (16:58 -0400)]
syscall tapset: _do_fork args conversion
As of linux 5.3 commit 7f192e3cd316ba, the _do_fork() function probed
for syscall.clone switched its API to carry arguments curried in a
struct. Adjusting the syscall.clone tapset to accept either API
via the @choose_defined() macro.
to configure pretty-printing. There's no need to warn about
unintentional cross-file global var accesses in this case.
So the warning is restricted to tapsets matching with user-script
globals only.
Subject DWARF OP is used for accessing TLS variables in GCC-compiled C
code. In all but the simplest cases, we must emulate libthread_db
logic for resolving TLS addresses. Step 1 is to map this operator to
a tapset function call __push_tls_address, which will implement the
architecture-specific lookup functionality.
We also tweak systemtap_session::print_error to ensure even isolated
little error messages seen only once do get printed.
Frank Ch. Eigler [Thu, 28 May 2020 15:25:01 +0000 (11:25 -0400)]
translator: ditch one assert(0)
In translator_output::assert_0_indent(), we used to assert(0) if
something went wrong with the translation process that resulted in the
generation of incorrectly nested C code. We could emit a warning or a
runtime_error or something, but even doing nothing is OK, since a
pass-4 error will surely follow.
Frank Ch. Eigler [Wed, 27 May 2020 22:36:33 +0000 (18:36 -0400)]
Correct error counting error in systemtap_session::print_error()
Logic such as
if (verbose > 0 || seen_errors[pe.errsrc_chain()]++ < 1)
short-cirtuits the increment of seen_errors[] in verbose mode.
This can lead systemtap_session::num_errors() to return 0 (!!)
even if errors occurred, which can in turn lead to later passes
being attempted. This sort of thing is nuked in two places,
to look thusly instead:
Serhei Makarov [Tue, 26 May 2020 16:08:40 +0000 (12:08 -0400)]
bigmap1.stp: tetentative fix for a hang on RHEL8
My suspicion is that the vfs_read probe was not triggering sufficiently often,
causing the script to keep running (and the subsequent attempt to kill it failed).
Added an extra probe within the testcase to time out after a while.
If it doesn't work, the in-testcase timeout should be further reduced.
XXX The failure to kill the process needs further investigation. It
was possible at one point to get a hang like this in the userspace
interpreter, but I'm unsure of the reason it's happening here and now.
Frank Ch. Eigler [Mon, 25 May 2020 11:23:26 +0000 (07:23 -0400)]
PR11599: fix buildid function & mark probes for stap list/run purposes
Listing mode and sdt derived probes muck with the understanding of the
new buildid probe points, since the process("....") argument string is
internally sometimes an exemplar executable name, and sometimes just
the buildid. (Too bad it's not easy to track what is what -- and we
even have code like dwarf_query::mount_well_formed_probe_point which
temporarily rewrites previously hand-crafted probe point arguments.)
This current set of changes seems to be the minimum to make all these
work & retain the buildid hexcode:
Frank Ch. Eigler [Sun, 24 May 2020 20:48:47 +0000 (16:48 -0400)]
PR11599: tweak macro for F31
runtime/linux/stp_tracepoint.h's fallback definition of
STAPCONF_TRACEPOINT_HAS_DATA needs to match the stapconf-generated
one - now they both define explicitly as 1, so they don't evoke
conflicting macro setting errors.
Aaron Merey [Sat, 23 May 2020 02:43:42 +0000 (22:43 -0400)]
util.cxx: Add function is_build_id()
Determines whether a string is a build-id. For the purposes of
this function, a string is considered a build-id when it consists
only of lowercase hex digits and has a length greater than 2.