[DTrace-devel] [oracle/dtrace-utils] c4d1c1: test: add back a simple module loader.

Kris Van Hees noreply at github.com
Thu Jun 1 15:40:28 UTC 2023


  Branch: refs/heads/2.0-branch-dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: c4d1c1a6349ec47bb7def7affae922e3f16dbd1f
      https://github.com/oracle/dtrace-utils/commit/c4d1c1a6349ec47bb7def7affae922e3f16dbd1f
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M runtest.sh
    M test/modules
    M test/unittest/scalars/tst.misc.d
    A test/unittest/scalars/tst.misc.x

  Log Message:
  -----------
  test: add back a simple module loader.

This lets us use modules that may or may not exist on the test system.
(In all such cases, a .x file must check for the existence of the
module.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 0b7a0612d2c7f92ee0e649fe344c1d9877ffb886
      https://github.com/oracle/dtrace-utils/commit/0b7a0612d2c7f92ee0e649fe344c1d9877ffb886
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/types/tst.nested-unnamed-structs.d
    A test/unittest/types/tst.nested-unnamed-structs.x

  Log Message:
  -----------
  test: add a test for libctf bug 30264

If present, this bug breaks offsetof (and anything else requiring
reliable offset info, like, oh, say, *any access*) to fields of
unnamed structs/unions at nonzero offsets within their containing
struct/union.

(We just check offsetof, because it's simpler than doing full access
checks.  We check only the in-kernel CTF, because the D language does
not support unnamed struct/union fields at all.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 5582d141ae948ee023d16faf087cbee7e4e03273
      https://github.com/oracle/dtrace-utils/commit/5582d141ae948ee023d16faf087cbee7e4e03273
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M cmd/Build

  Log Message:
  -----------
  build: add gdb and valgrind support to the run-dtrace wrapper

Now, rather than having to mess around setting SYSLIBDIR and
LD_LIBRARY_PATH yourself to debug a just-built dtrace, you can
just run DTRACE_GDB=t build/run-dtrace or
DTRACE_VALGRIND=t build/run-dtrace

GDB is run with --args. Valgrind is run with no args other that the
just-built dtrace's for now.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: c37fe27ba294f0cbe67d32232ad40d0af9ce451e
      https://github.com/oracle/dtrace-utils/commit/c37fe27ba294f0cbe67d32232ad40d0af9ce451e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_module.c

  Log Message:
  -----------
  symbol: fix undefined, non-extern symbols

Undefined symbols are undefined symbols even if they are not marked as
extern: they shouldn't be returned as if they were validly resolved, but
with no definition.

(My bug, nearly a decade old. The code before my change acts this way.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 30955afb8a2dac2df069f86354813b24a8a86edf
      https://github.com/oracle/dtrace-utils/commit/30955afb8a2dac2df069f86354813b24a8a86edf
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/drti.c

  Log Message:
  -----------
  drti: drop misleading comment

Much of the block comment above _dtrace_dof_init hasn't been relevant in
the entire lifetime of DTrace for Linux.  Drop it.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: fc5ca2793e9487b9533f62f62eec307f6ca69fe4
      https://github.com/oracle/dtrace-utils/commit/fc5ca2793e9487b9533f62f62eec307f6ca69fe4
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c

  Log Message:
  -----------
  dtprobed: fix error message

The very first error emitted if the ioctl coming from the caller is
somehow wrong has the expected and received sizes backwards. (The actual
check is fine: only the error message is wrong.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 73f8bb9dbe9af9b6a77f27938f51e0272bba1d48
      https://github.com/oracle/dtrace-utils/commit/73f8bb9dbe9af9b6a77f27938f51e0272bba1d48
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M include/dtrace/dof_defines.h
    M libcommon/dof_parser.c
    M libdtrace/dt_link.c

  Log Message:
  -----------
  usdt: introduce DOF_VERSION_3 and use it when is-enabled probes are present

This guardrail prevents DTrace v2 from picking up v1-style is-enabled
probes, by suppressing is-enabled probes when DOF_VERSION <= 3, setting
the DOF_VERSION to 3 for programs containing is-enabled probes, and
refusing to -G-link object files containing DOF_VERSION_2 and is-enabled
probes. This is all necessary because v1-style probes have no function
arguments, so it would be dangerous to try to pick up the first
argument, treat it as a pointer, and write a 1 down it.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: c2005917edfce9a8f5cf1e23d58b40a674806e0a
      https://github.com/oracle/dtrace-utils/commit/c2005917edfce9a8f5cf1e23d58b40a674806e0a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c
    M libcommon/uprobes.c
    M libcommon/uprobes.h
    M libdtrace/dt_link.c
    M libdtrace/dt_pid.c
    M libdtrace/dt_program.c
    M libdtrace/dt_prov_uprobe.c
    M test/unittest/usdt/tst.enable.d
    M test/unittest/usdt/tst.enable_and.d
    M test/unittest/usdt/tst.enable_and_2.d
    M test/unittest/usdt/tst.enable_or_2.d
    M test/unittest/usdt/tst.enable_return.d
    M test/unittest/usdt/tst.enable_stmt.d
    M test/unittest/usdt/tst.enabled.sh

  Log Message:
  -----------
  usdt: is-enabled probe support

This implementation is in many ways similar to v1's, but contains one
significant simplification: rather than is-enabled probes appearing to
the user as a function that returns a 1 or 0, they appear as a function
that returns void and takes the address of a local variable: the
_IS_ENABLED macros use the GCC statement-expression extension
to declare and initialize a distinct local for each use of the
is-enabled probe:

	({ uint32_t enabled = 0; \
	__dtraceenabled_foo___bar(&enabled); \
	   enabled; })

The is-enabled trampoline writes a 1 into this local variable.  This
allows the dt_link code to discard all the architecture-dependent code
dealing with return value handling and treat is-enabled probes just like
other USDT probes: it still tracks whether is-enabled probes are used,
but doesn't use the info for anything but setting the DOF version.

The downside of this approach, of course, is that users need the
statement-expression extension to work, and that old is-enabled probes
from DTrace v1 aren't going to work without regeneration with dtrace
-G. Neither of these seem likely to be serious problems in practice, and
the commit before this one should help.

We use #pragma system_header to suppress -pedantic warnings about
use of the extension.

Internally, there are tiny changes in the dtprobed and dt_pid
uprobe-registration-and-creation layers to put is-enabled probes in a
different uprobe group to prevent their names clashing with USDT probes
with the same name (dt_pid_is_enabled/ rather than dt_pid/). Normal USDT
probes enable the correspondinng is-enabled probe, if any, when they are
enabled: those probes have custom trampoline that copy a 64-bit-wide 1
into the first function parameter (and have truncated parameter-copying
code that avoids preserving any parameter but the first, because there
will never be any more).

Please ignore the code duplication between trampoline() and
trampoline_is_enabled(): this is temporary to make it easier to make
changes for getting globbed systemwide probing working later on.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: db8cd42350e7894dd0d8686de8ad2c60212cf682
      https://github.com/oracle/dtrace-utils/commit/db8cd42350e7894dd0d8686de8ad2c60212cf682
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libcommon/uprobes.c
    M libproc/Psymtab.c
    M libproc/libproc.h

  Log Message:
  -----------
  uprobes, libproc: handle uprobes to procs in different fs namespaces

The specification for a uprobe includes a *mapping name*, which is
documented as the "path to [the] executable or library" where the probe
is placed.  Unstated in the documentation is what filesystem namespace
this path is relative to, because -- obviously enough -- it's relative
to the task placing the uprobe.

Unfortunately we get our mapping names, ultimately, from the names in
/proc/$pid/maps, and those names are relative to the fs namespace of the
process being queried.  So we cannot just use that name unmodified: the
file might not be there, or indeed anywhere accessible to the
prober. Worse yet, if we're really unlucky some *other* process might be
there and will have a probe stuffed in it at a thoroughly unsuitable
location. One can imagine an attacker setting up a mount namespace with
a /bin/su of their own in it, and putting a DTrace probe in it such that
we stick uprobes in the *real* /bin/su and oh dear. This can probably
only cause a crash, but it still feels very wrong.

Worse yet, when started by systemd dtprobed runs in a non-default
filesystem namespace in which /home is inaccessible: put all this
together and you can't create DTrace probes in binaries you compile
yourself under /home, unless you restart dtprobed yourself outside
systemd's aegis (or hack the service file to turn off ProtectHome).

So fix this by using the map names from /proc/$pid/map_files, which we
already acquire for the purposes of opening the ELF executable in
invasive mode.  For that, we can fall back to the old GETMAPFD approach,
but given that that is an out-of-tree patch and was dead, and we're not
even looking for an fd here but rather a filename, and because the
conseqeuences of just using a filename out of /proc/$pid/maps are so
bad, we'll simply not implement a fallback here.  USDT requires
map_files built into the kernel and that's all.

This makes uprobe_events less informative (no filenames any more), but
so be it. We can always add a filename as another parameter or something
if we want to.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 7269729b3a5ee114281dcc4d4d76ad2a0d7c7ee3
      https://github.com/oracle/dtrace-utils/commit/7269729b3a5ee114281dcc4d4d76ad2a0d7c7ee3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libproc/Psymtab.c

  Log Message:
  -----------
  libproc: fix mapping names low in the address space

For reasons which escape my understanding, address ranges in
/proc/$pid/maps are zero-padded up to eight digits, but filenames in
/proc/$pid/map_files are not zero-padded at all.  Strip the zeroes off
when deriving the latter from the former.

(Only observable with non-PIE executables, since only they are ever that
low in the address space.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 299bb601ae03abd5a97c2b43cdacce4bd95bff31
      https://github.com/oracle/dtrace-utils/commit/299bb601ae03abd5a97c2b43cdacce4bd95bff31
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_pid.c
    M libdtrace/dt_proc.h
    M test/unittest/usdt/tst.allargs.sh

  Log Message:
  -----------
  usdt: provide probes properly when >1 is specified

dt_pid_create_usdt_probes is called by dt_pid_create_probes, which
despite its name is usually called by the compiler to set the context
for one probe at a time, not all at once. So dt_pid_create_usdt_probes
is usually (currently: always) called in a mode in which it scans all
the probes and then creates only those it has been asked to create.
So we really do need to not skip invocations after the first.

This will obviously not work well for wildcard probe handling, but for
now the inefficient approach of just repeated rescanning should work
well enough.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 75f5d7c003966c88698a14076a26d344359ba114
      https://github.com/oracle/dtrace-utils/commit/75f5d7c003966c88698a14076a26d344359ba114
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/usdt/tst.multitrace.sh

  Log Message:
  -----------
  test, usdt: test multiple simultaneous tracers of multiple processes

We start them one after the other, to determine whether starting (or
starting tracing) one process affects the same active tracepoints in
other processes currently being traced.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 0bf49598dceffc78de636e3b16d31047f9201ac6
      https://github.com/oracle/dtrace-utils/commit/0bf49598dceffc78de636e3b16d31047f9201ac6
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M include/dtrace/pid.h
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_pid.c
    M libdtrace/dt_pid.h

  Log Message:
  -----------
  pid, uprobes: improve horrendously inefficient uprobe scanning

The uprobe scanning loop was meant to be an efficient loop that scanned
the set of uprobes only once.  Unfortunately, because it is invoked
repeatedly to create each pid's uprobes in turn, it ends up parsing
all the probes N times if you invoke dtrace with N distinct processes.
Since each such parse involves multiple rounds of memory allocation
and string manipulation to decode encoded probe names etc, this is
a definite waste of time. Worse yet, since the uprobe list can change
at any time, there is not even any guarantee that we're parsing the
same thing each time!

Fix this by having dt_pid_create_usdt_probes() call another function,
dt_pid_scan_uprobes(), to pull in the list of known DTrace uprobes; it
does this only once and stores the parsed probespecs in a new list of
dt_pid_probespecs in the dtp.  The probespecs still change a bit on each
call to dt_pid_create_usdt_probes, because it stuffs a pid in there, but
everything derived from uprobe_events is parsed only once and (in this
implementation, currently) never changes thereafter, no matter how many
probes are created.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 32a24541f8f1a8425ee0c94c7f57387f226f3f37
      https://github.com/oracle/dtrace-utils/commit/32a24541f8f1a8425ee0c94c7f57387f226f3f37
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_pid.c
    M libdtrace/dt_proc.h
    M test/unittest/pid/tst.provregex3.sh
    M test/unittest/usdt/tst.multiple.r
    M test/unittest/usdt/tst.multiple.sh

  Log Message:
  -----------
  usdt: provide all underlying probes in a pid once per pid

Another bug report revealed that USDT probes were sometimes failing to
be provided when there were multiple probes in the D script.  The
underlying cause of this is that dt_pid_create_usdt_probes() gets called
once per dt_setcontext() of a USDT probe, but every call checks each
underlying probe to see if it matches the overlying probe we're trying
to provide, provides it if so, and then calls dt_pid_fix_mod() on that
underlying probe... which changes the module name, and now it no longer
matches in subsequent calls.

Since these are in any case *underlying* probes, and thus kept disabled
unless an overlying probe enables them, there's no reason not to just
provide all underlying probes in a pid the first time
dt_pid_create_usdt_probes() is called for a given pid, and pay no
attention to the probe description passed down from dt_setcontext() at
all.

The existing change whereby all DTrace uprobes in the system are
remembered on the first call to dt_pid_create_usdt_probes() is still
beneficial and is retained: this just simplifies things and speeds them
up even more. As a side benefit this means that some wildcard USDT
probes now work: just provider wildcards, not other wildcards, but
that's better than nothing.

We soup up test/unittest/usdt/tst.multiple.sh to identify this failure
(which means not using -p or -c, since those trigger additional uprobe
scans in the old implementation and catch more probes by accident, and
also probing multiple different probes as well as one probe with
multiple loci; we also add a probe that isn't probed just to make sure
that non-enabled underlying probes really don't fire).

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f7b94c2207ab138d9af8b4b340b754452de6138a
      https://github.com/oracle/dtrace-utils/commit/f7b94c2207ab138d9af8b4b340b754452de6138a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_parser.h

  Log Message:
  -----------
  parser: check for all types of char

A while back I changed the check for IS_CHAR() in the parser to check
specifically for a char in the native signedness.  This can fail now
that the kernel might be using a char in the non-native signedness.

Consider all such types to be equally-valid chars.  We really
don't care if they're signed or not, they're still chars.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: fe7148f5a1d7d396e1f6d17cf315188350551225
      https://github.com/oracle/dtrace-utils/commit/fe7148f5a1d7d396e1f6d17cf315188350551225
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/unittest/actions/default/tst.default.d
    M test/unittest/actions/default/tst.default.r

  Log Message:
  -----------
  test: Convert tick-* probes to BEGIN probes for default-action test

The tick-* mechanism can be fickle on some platforms.  Do not use
it for this test, which is intended simply to check default actions.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: bd521b5d71408b6b96dce1726316d905587d3ab8
      https://github.com/oracle/dtrace-utils/commit/bd521b5d71408b6b96dce1726316d905587d3ab8
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/unittest/aggs/tst.count_notquiet.d
    M test/unittest/aggs/tst.count_notquiet.r

  Log Message:
  -----------
  test: Convert tick-* probes to BEGIN probes for count-not-quiet test

The tick-* mechanism can be fickle on some platforms.  Do not use
it for this test, which is intended simply to check that aggregations
do not result in data-recording actions.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 07a56e29b6c1fad961f935963a984ecd579c4259
      https://github.com/oracle/dtrace-utils/commit/07a56e29b6c1fad961f935963a984ecd579c4259
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/triggers/Build
    A test/triggers/periodic_output.c
    M test/unittest/aggs/tst.clear.d
    M test/unittest/aggs/tst.clear.r
    R test/unittest/aggs/tst.clear.r.p
    M test/unittest/aggs/tst.clearavg.d
    M test/unittest/aggs/tst.clearavg2.d
    M test/unittest/aggs/tst.clearavg2.r
    M test/unittest/aggs/tst.cleardenormalize.d
    M test/unittest/aggs/tst.cleardenormalize.r
    R test/unittest/aggs/tst.cleardenormalize.r.p
    M test/unittest/aggs/tst.clearlquantize.d
    M test/unittest/aggs/tst.clearnormalize.d
    M test/unittest/aggs/tst.clearnormalize.r
    R test/unittest/aggs/tst.clearnormalize.r.p

  Log Message:
  -----------
  test: Convert tick-* probes to write:entry probes for clear() tests

Tests for the clear() function rely on some interactions between the
producer and consumer.  Specifically, we want to make sure the producer
waits amply after sending a clear() action to the consumer before taking
further action.  Arguably, a tick-* probe could be used for such timing
purposes, but we find tick-* probes to be unreliable on many systems and
their robustness is not the subject of these tests.

Introduce a trigger that emits messages at most once a second.  The
D test scripts can then probe system::write:entry to fire after delays.

Also, add @@nosort options to these tests.

Finally, remove some .r.p files.  The output is deterministic anyhow.
So it's easier and more stringent to supply a verbatim .r results file.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: fd7f8e4f38ae96bb4bb3c8622a1b584a312e1aad
      https://github.com/oracle/dtrace-utils/commit/fd7f8e4f38ae96bb4bb3c8622a1b584a312e1aad
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/unittest/aggs/tst.lquantzero.d
    M test/unittest/aggs/tst.negorder.d
    M test/unittest/funcs/substr/tst.substrminate.d
    M test/unittest/funcs/tst.basename.d
    M test/unittest/multiaggs/tst.sort.d
    M test/unittest/multiaggs/tst.sortpos.d

  Log Message:
  -----------
  test: Convert tick-* probes to ioctl:entry for more tests

There are currently reliability issues in the kernel for tick-* probes.
Meanwhile, many tests have historically relied on tick-* for test
construction, even though they simply needed any probe to fire "many
times" -- which probe fires is immaterial to the test.

In patches
    80a539ae test: Account for unreliable tick firing
    8b989703 test: Fix race condition in many-fire tests
many tests were converted from tick-* probes to ioctl:entry probes (and
adding the appropriate trigger).  Not all tests that "incidentally" use
tick-* probes were converted, to mitigate disruption to the test suite and
because many tests do not use tick-* very aggressively.

Nevertheless, a few more tests have been failing egregiously in extensive
testing due to this problem.  They use tick-* "moderately" (e.g., one or more
dozen times).

Convert more tests from tick-* to ioctl:entry.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f084702ec3876f4016e9ad4ae0315314ad80adca
      https://github.com/oracle/dtrace-utils/commit/f084702ec3876f4016e9ad4ae0315314ad80adca
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/unittest/begin/tst.begin.d

  Log Message:
  -----------
  test: Convert tick-* probes to ioctl:entry for tst.begin.d

Even though this test needs tick-1m to fire only once, this does not
happen on some platforms.  Since tick-1m is not germane to the test's
purpose, replace it.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 3472de785a2b4e67049d6fcf0e40b8c309a971de
      https://github.com/oracle/dtrace-utils/commit/3472de785a2b4e67049d6fcf0e40b8c309a971de
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.q.d
    A test/unittest/options/tst.q.r
    A test/unittest/options/tst.quiet.d
    A test/unittest/options/tst.quiet.r

  Log Message:
  -----------
  test: Add test for option "quiet" (and -q)

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: fb7db6f875d812678c8a7b2024b1c62609b5828a
      https://github.com/oracle/dtrace-utils/commit/fb7db6f875d812678c8a7b2024b1c62609b5828a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: Add support for interpreter files

A D script foo.d can be run with "dtrace -s foo.d".

Alternatively, it can be made an executable interpreter file by adding
a "#!dtrace -s" initial line (using the correct path to dtrace) and then
"chmod +x foo.d".  At that point, it can be run "./foo.d".

A few tests have the #! initial line and therefore seem to intend to use
the second, interpreter invocation style.  In particular, this is how some
scripting tests are implemented.

But if a test has a .d extension, runtest.sh invokes it using "dtrace -s foo.d".
This means we ignore the initial #! line:  both the specific path to dtrace
as well as any dtrace options that are specified on the initial #! line.

There are some *.sh tests that get around this problem by setting up their
own .d files and invoking them, but this means that some minor infrastructure
is being replicated from file to file.

Add support in runtest.sh for *.d executable interpreter files.  In such
a file, the initial #! line should start #!dtrace, since runtest.sh will
replace the "dtrace" with the absolute path to the dtrace being tested.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 82a067cb21dc1b2753029e2bf6e3031632c6c2a5
      https://github.com/oracle/dtrace-utils/commit/82a067cb21dc1b2753029e2bf6e3031632c6c2a5
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/scripting/tst.quiet.d
    A test/unittest/scripting/tst.quiet.r
    R test/unittest/scripting/tst.quite.d
    R test/unittest/scripting/tst.quite.r

  Log Message:
  -----------
  test: Fix scripting test for "quiet"

This test was broken because the runtest.sh test harness was ignoring
the initial #! line, invoking the test as a D script rather than as an
interpreter file.  Hence, the -q was being ignored;  the .r results
file fit the actual (incorrect) behavior rather than the anticipated
(correct) behavior.

Use interpreter-file support in runtest.sh to launch the test as an
interpreter file.  Fix the results file to match expected "quiet"
results.  Rename the file from "quite" to "quiet."

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: d1b1918929979914923521ca73b741c30f698164
      https://github.com/oracle/dtrace-utils/commit/d1b1918929979914923521ca73b741c30f698164
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.strip.sh

  Log Message:
  -----------
  test: Add test for option "strip"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: d2c5c87e27f01ee5680d637b03ec2afcdb448b45
      https://github.com/oracle/dtrace-utils/commit/d2c5c87e27f01ee5680d637b03ec2afcdb448b45
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.linktype.r
    A test/unittest/options/tst.linktype.sh

  Log Message:
  -----------
  test: Add test for option "linktype"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: dc7e6955a88f4bd8d06b91f86cf4b06fc6a3d488
      https://github.com/oracle/dtrace-utils/commit/dc7e6955a88f4bd8d06b91f86cf4b06fc6a3d488
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.linkmode.r
    A test/unittest/options/tst.linkmode.sh

  Log Message:
  -----------
  test: Add test for option "linkmode"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 7ba3b97e0c7ab5e18bd3284c739ba56320529c46
      https://github.com/oracle/dtrace-utils/commit/7ba3b97e0c7ab5e18bd3284c739ba56320529c46
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.iregs.r
    A test/unittest/options/tst.iregs.sh

  Log Message:
  -----------
  test: Add test for option "iregs"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 2ff4682e3bea316db26280bbd916a927aa7083d3
      https://github.com/oracle/dtrace-utils/commit/2ff4682e3bea316db26280bbd916a927aa7083d3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_options.c
    A test/unittest/options/err.iregs.d
    A test/unittest/options/err.iregs.r

  Log Message:
  -----------
  Forbid increasing iregs above default

If iregs is set larger than the default, code is generated using
nonexistent registers and the BPF verifier emits confusing errors.

Simply do not allow users to increase iregs beyond the default.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: d3da4b1310ad66a04c7c64f33ec703ec1e4de826
      https://github.com/oracle/dtrace-utils/commit/d3da4b1310ad66a04c7c64f33ec703ec1e4de826
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/err.pspec-default.d
    A test/unittest/options/err.pspec-default.r
    A test/unittest/options/err.pspec-on.d
    A test/unittest/options/err.pspec-on.r

  Log Message:
  -----------
  test: Add tests for option "pspec"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: b9d79c50580e1f2c842c05aafac6ae483c086e54
      https://github.com/oracle/dtrace-utils/commit/b9d79c50580e1f2c842c05aafac6ae483c086e54
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/err.stdc-x.d
    A test/unittest/options/err.stdc-x.r
    A test/unittest/options/tst.stdc-a.d
    A test/unittest/options/tst.stdc-a.r
    A test/unittest/options/tst.stdc-c.d
    A test/unittest/options/tst.stdc-c.r
    A test/unittest/options/tst.stdc-s.d
    A test/unittest/options/tst.stdc-s.r
    A test/unittest/options/tst.stdc-t.d
    A test/unittest/options/tst.stdc-t.r

  Log Message:
  -----------
  test: Add tests for option "stdc"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 1f040af227e0770b4c6db444e76d720b0218db0a
      https://github.com/oracle/dtrace-utils/commit/1f040af227e0770b4c6db444e76d720b0218db0a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    A test/unittest/options/tst.aggrate-fast.d
    A test/unittest/options/tst.aggrate-fast.r
    A test/unittest/options/tst.aggrate-slow.d
    A test/unittest/options/tst.aggrate-slow.r

  Log Message:
  -----------
  test: Add tests for option "aggrate"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: e80ebb0a27711ca47027f8a105b6b15e665427ac
      https://github.com/oracle/dtrace-utils/commit/e80ebb0a27711ca47027f8a105b6b15e665427ac
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_subr.c
    A test/unittest/ustack/tst.uaddr-pid0.d
    A test/unittest/ustack/tst.uaddr-pid0.r
    A test/unittest/ustack/tst.ufunc-pid0.d
    A test/unittest/ustack/tst.ufunc-pid0.r
    A test/unittest/ustack/tst.usym-pid0.d
    A test/unittest/ustack/tst.usym-pid0.r

  Log Message:
  -----------
  Check pid==0 for uaddr2str

If dtrace_uaddr2str() is given pid==0, it will try to look up the
pid, get a NULL pointer back, dereference it, and cause dtrace to
segfault.

Add a check for pid==0.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: d5e205cda9057b1ac5ffd36ca9976167153543ef
      https://github.com/oracle/dtrace-utils/commit/d5e205cda9057b1ac5ffd36ca9976167153543ef
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M test/unittest/actions/trace/tst.array.r
    M test/unittest/actions/trace/tst.array.r.p

  Log Message:
  -----------
  test: make tst.array.d work for old and new kernels

Some older kernels leave trailing garbage in the curthread->comm char
array whereas newer kernels do not.  The post-processor is updated to
handle this variation.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 8020244d9963c27624186c5d7af361f38d655274
      https://github.com/oracle/dtrace-utils/commit/8020244d9963c27624186c5d7af361f38d655274
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_provider_tp.c

  Log Message:
  -----------
  tp: handle tracepoint argument datatypes with symbolic array size

Some kernels expose datatypes for tracepoint elements like this:

  field:char oldcomm[TASK_COMM_LEN]; offset:12; size:16; signed:1;

Since the type compiler and CTF type parser) cannot resolve the value
of TASK_COMM_LEN, we synthesize the type ourselves based on the base
type (char in this case) and the argument size (16 in this case).

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 52f45756f11eb9321ef05f6d9b00bf724c43ad02
      https://github.com/oracle/dtrace-utils/commit/52f45756f11eb9321ef05f6d9b00bf724c43ad02
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_bpf.c
    A test/unittest/aggs/err.aggsize-too-small.d
    A test/unittest/aggs/err.aggsize-too-small.r

  Log Message:
  -----------
  agg: report error if aggsize is too small

When aggregations are used, report a compilation error if the aggsize
value is insufficient to hold at least a single aggregation.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: e9d6fec68c88144b88b08c39c7896863ac422eaf
      https://github.com/oracle/dtrace-utils/commit/e9d6fec68c88144b88b08c39c7896863ac422eaf
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_bpf.c
    A test/unittest/assocs/err.dynvarsize-too-small.d
    A test/unittest/assocs/err.dynvarsize-too-small.r
    M test/unittest/assocs/tst.store_zero_deletes.d

  Log Message:
  -----------
  dynvar: report error if dynvarsize is too small

When dynamic variables (or associative arrays) are used, report a
compilation error if the dynvarsize value is insufficient to hold at
least one dynamic variable (or associative array element).

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 713e3bf44db7ba27470b0472c76d1717db8d5cca
      https://github.com/oracle/dtrace-utils/commit/713e3bf44db7ba27470b0472c76d1717db8d5cca
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  bpf: ensure cpuinfo can handle non-sequential CPU ids

The 'cpuinfo' BPF map (a per-cpu map) was populated assuming that CPU
ids are always strictly sequential, i.e. that no gaps in the numbering
can occur.  That is not a valid assumption.  We need to populate the
cpuinfo entries referenced by the cpu_id of each online CPU.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 394de56cb769ab065f40b8d03cf605a2793cef4d
      https://github.com/oracle/dtrace-utils/commit/394de56cb769ab065f40b8d03cf605a2793cef4d
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M bpf/speculation.c
    M include/bpf-lib.h

  Log Message:
  -----------
  bpf: introduce atomic_add()

The GCC BPF support does not provide a way to emit an atomic add
instruction (BPF xadd) without the fetch-flag.  But since older
kernels do not support xadd with the fetch flag, the generated
BPF programs are rejected by the BPF verifier.

The atomic_add() macro emits a raw xadd instruction that works on
all kernels.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 0b9276c462cc3a5c98b7382b0719a92f4b5c6aea
      https://github.com/oracle/dtrace-utils/commit/0b9276c462cc3a5c98b7382b0719a92f4b5c6aea
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-23 (Tue, 23 May 2023)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf_maps.h

  Log Message:
  -----------
  bpf: store per-CPU drop counts in the 'cpuinfo' map

Drop counters for principal and aggregation buffers are tracked per-CPU
and thus need to be stored per-CPU.  The 'cpuinfo' map is a convenient
place to put those so add them in after the actual cpuinfo data for a
given CPU.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 7e1cb200d9bae6779ffe6378725df5e614ae99d8
      https://github.com/oracle/dtrace-utils/commit/7e1cb200d9bae6779ffe6378725df5e614ae99d8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M bpf/get_agg.c
    M bpf/get_dvar.c
    M bpf/speculation.c
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_handle.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_state.h
    M libdtrace/dt_work.c
    M libdtrace/dtrace.h
    A test/unittest/assocs/tst.store_zero_safe.d
    A test/unittest/assocs/tst.store_zero_safe.r
    M test/unittest/drops/drp.DTRACEDROP_AGGREGATION.d
    M test/unittest/drops/drp.DTRACEDROP_AGGREGATION.r
    M test/unittest/drops/drp.DTRACEDROP_DYNAMIC.d
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.d
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.end.d
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.end.r
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.r
    M test/unittest/drops/drp.DTRACEDROP_SPEC.d
    M test/unittest/rates/tst.statusrate.d
    M test/unittest/speculation/tst.NoSpecBuffer.r
    M test/unittest/speculation/tst.TwoSpecBuffers.r

  Log Message:
  -----------
  Implement drop-counter support

DTrace provides a mechanism to report dropped events.  A drop occurs
when trace data cannot be recorded for a particular reason.  This
patch contains the full implementation of 4 categories of drops,
primarily because they are all closely related:

- principal buffer drops: reported when the producer failed to add
  trace data to the principal buffer
- aggregation buffer drops: reported when the producer failed to
  allocate an aggreggation and therefore failed to record data
- speculation drops: reported when something goes wrong with the
  recording of speculative tracing data
    + regular drops: reported when speculative data could not be
      written to a speculation buffer
    + busy drops: reported when a speculation could not be created
      because all buffers are busy being committed or discarded
    + unavailable drops: reported when no available speculation
      buffers were found
- dynamic variable drops: reported when a dynamic variable (or
  associative array element) could not be allocated

Two mechanisms for reporting drops are needed:

(1) Per-CPU reporting: used for principal and aggregation buffer
    drops (stored in the cpuinfo structures)
(2) Global reporting: used for speculation and dynamic variable
    drops (stored in the state BPF map)

Detection of drops (and subsequent reporting to the user) is done
through frequent retrieval of status data.  The handling of status
data (and the use of statusrate) is being re-introduced with this
patch.

The drop count for speculations is a bit more complex than the other
ones because drops can occur both in the producer (when data cannot
be written to the trace output buffer) *and* in the consumer (when
data cannot be recorded in a speculation buffer).  These separate
counts are combined whenever status processing takes place to ensure
the correct drop count is presented to the user.

Various tests have updated expected results because drops are now
being reported correctly.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 083a2fe2cd6c579078d19a74697e3ca8a730d9d3
      https://github.com/oracle/dtrace-utils/commit/083a2fe2cd6c579078d19a74697e3ca8a730d9d3
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M bpf/speculation.c
    M libdtrace/dt_bpf_maps.h
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M test/unittest/speculation/tst.SpecSizeVariations4.d
    M test/unittest/speculation/tst.SpecSizeVariations4.r

  Log Message:
  -----------
  spec: correct semantics of specsize overflow

The speculations implementation (commit 7fe6ce9a "consume, cg: implement
speculations") did not detect speculation data exceeding the specsize
limit until the consumer added data fragments to a speculation buffer.
As a result, all statements in clauses were always executed.

The legacy behaviour is to abort clause execution once a data recording
action causes the speculation buffer to overflow.  That causes any
further statements in the clause to be skipped.  The testsuite contains
an explicit test for this: tst.SpecSizeVariations4.d.  Unfortunately,
the test (and expected results) were amended to match the (incorrect)
new semantics.

This patch restores the legacy behaviour by tracking the size of the
speculation across clauses that contribute to a given speculation, so
that we can detect speculation buffer overflows as they occur due to
a specific data recording action.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: bfaf54091e815b828d137d6314e79cb71002d41c
      https://github.com/oracle/dtrace-utils/commit/bfaf54091e815b828d137d6314e79cb71002d41c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M bpf/get_bvar.c
    M bpf/speculation.c
    M test/unittest/speculation/err.CommitWithInvalid.r
    M test/unittest/speculation/err.DiscardWithInvalid.r
    M test/unittest/speculation/tst.negcommit.r

  Log Message:
  -----------
  bpf: add PC to fault reporting using dt_probe_error()

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 19c6283a3fc0e970e217cb34fa696274644fe1d8
      https://github.com/oracle/dtrace-utils/commit/19c6283a3fc0e970e217cb34fa696274644fe1d8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: optimize dt_cg_check_fault() a little

The comment block for dt_cg_check_fault() correctly states that when
a fault is detected, a jump can be made to the PCB exit label.  But
the code was not doing that.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: ba3459abe7a2303e9fafa87351e2c2266ef6f1ca
      https://github.com/oracle/dtrace-utils/commit/ba3459abe7a2303e9fafa87351e2c2266ef6f1ca
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M test/unittest/scalars/tst.selfarray2.d

  Log Message:
  -----------
  test: tst.selfarray2.d should not PASS

Due to the drop support triggering bad address faults, this test ended
up reporting XPASS which it really should not.  Added an explicit ERROR
clause to detect faults (and report failure if a fault occurs).

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: b4401744076e134fd1b84938bd037fefdc8fe004
      https://github.com/oracle/dtrace-utils/commit/b4401744076e134fd1b84938bd037fefdc8fe004
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.aarch64.x
    M test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.x86_64.x

  Log Message:
  -----------
  test: Use #!/usr/bin/bash explicitly when using BASH-features

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 525b8c4764ec9ac9a995398c9529e4d664995364
      https://github.com/oracle/dtrace-utils/commit/525b8c4764ec9ac9a995398c9529e4d664995364
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_prov_fbt.c

  Log Message:
  -----------
  fbt: ignore compiler-generated internal symbols

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 49c1dd93881974a056f75d5b8303beedc1e1d93a
      https://github.com/oracle/dtrace-utils/commit/49c1dd93881974a056f75d5b8303beedc1e1d93a
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/io.d.in

  Log Message:
  -----------
  dlib: update io.d for 5.12 and onward

With 5.12 and onward, the gendisk pointer in struct bio is replaced
with a block device pointer.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 02a36bfa8e94c1f895f807b580e0a6aeb522fb35
      https://github.com/oracle/dtrace-utils/commit/02a36bfa8e94c1f895f807b580e0a6aeb522fb35
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_open.c

  Log Message:
  -----------
  Fix memory leak of allocated tstrings

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 82b8e597f8d3254c4cb0edc01c8728693e946ab6
      https://github.com/oracle/dtrace-utils/commit/82b8e597f8d3254c4cb0edc01c8728693e946ab6
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_probe.c

  Log Message:
  -----------
  Fix memory leak of list of dependent probes

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: dd8bace4801c9d4126833f32bf9f51c89c9ba450
      https://github.com/oracle/dtrace-utils/commit/dd8bace4801c9d4126833f32bf9f51c89c9ba450
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: replace gawk-specific function with more generic function

The match(s, t, arr) form of the match function is specific to GAWK
and therefore is best avoided in favour of the more generic match()
function combined with tokenization.

The script was also not functioning correctly because the left
paranthesis of the action block wasn't on the same line as the
pattern it was supposed to be associated with.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 065af40a69b8e28b554a35325ebc46d0a9080227
      https://github.com/oracle/dtrace-utils/commit/065af40a69b8e28b554a35325ebc46d0a9080227
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_prov_proc.c
    M test/unittest/proc/tst.sigwait.d

  Log Message:
  -----------
  Implement proc:::signal-clear

Drop the undocumented proc:::fault probe.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 12183233b4a78714bf2f7b11b11b3ab34cdb2f4c
      https://github.com/oracle/dtrace-utils/commit/12183233b4a78714bf2f7b11b11b3ab34cdb2f4c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_prov_cpc.c
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_proc.c
    M libdtrace/dt_prov_profile.c
    M libdtrace/dt_prov_rawtp.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c
    M libdtrace/dt_prov_uprobe.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  provider: change the trampoline return type

The trampoline callback can now return 1 to indicate that no calls
should be made to clause functions (or 0 to retain the regular
operation of calling the clause functions).

This will be used by some providers to attach to probes that perform
auxiliary operations, e.g. setting up some data items that will be
needed for the actual probe processing.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: ae6344702b6d6a4b5e67db7e64f8acd14d136f8b
      https://github.com/oracle/dtrace-utils/commit/ae6344702b6d6a4b5e67db7e64f8acd14d136f8b
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_pcb.h

  Log Message:
  -----------
  provider: let dependent probe trampoline use parent probe

Future providers that are implemented as dependent probes on other
probes may need to know what parent probe they are to generate a
trampoline for.  Store it in the PCB.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 92653f8705436ee52e49ba601a23e860281ee90b
      https://github.com/oracle/dtrace-utils/commit/92653f8705436ee52e49ba601a23e860281ee90b
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_rawtp.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c
    M libdtrace/dt_prov_uprobe.c
    M libdtrace/dt_provider.h
    M libdtrace/dt_provider_tp.c
    A libdtrace/dt_provider_tp.h

  Log Message:
  -----------
  provider: split off tracepoint provider function defs in their own header file

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: b739f88ba9065f82cd755bc86edb8d1204c424fe
      https://github.com/oracle/dtrace-utils/commit/b739f88ba9065f82cd755bc86edb8d1204c424fe
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_parser.c
    M libdtrace/dt_prov_cpc.c
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_proc.c
    M libdtrace/dt_prov_profile.c
    M libdtrace/dt_prov_rawtp.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c
    M libdtrace/dt_prov_uprobe.c
    M libdtrace/dt_provider.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  provider: support (opaque) private data for providers

Commit 2ba7c3bd ("Add a CPC provider") added an opaque private data
pointer to the provider implementation struct.  In retrospect, that
does not seem to be the best place because the implementation struct
is really meant for callback function pointers.  The provider struct
itself is a better place for this.  SDT providers will also make use
of the ability to store private data for providers.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: cbee25373985a4bd6d19154a42d2d7efcef7b117
      https://github.com/oracle/dtrace-utils/commit/cbee25373985a4bd6d19154a42d2d7efcef7b117
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/Build
    A libdtrace/dt_provider_sdt.c
    A libdtrace/dt_provider_sdt.h

  Log Message:
  -----------
  sdt: consolidate the SDT infrastructure in its own provider framework

The various SDT providers are implemented using the same underlying
mechanisms.  A common SDT infrastructure avoids code duplication.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: b90e4f5d3bd7a2fec14783ca189952d72069758a
      https://github.com/oracle/dtrace-utils/commit/b90e4f5d3bd7a2fec14783ca189952d72069758a
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_sched.c
    M libdtrace/dt_provider.h
    M test/demo/sched/dtrace.d
    M test/demo/sched/howlong.d
    M test/demo/sched/qlen.d
    M test/demo/sched/qtime.d
    M test/demo/sched/tick.d
    M test/demo/sched/ticktime.d
    M test/demo/sched/where.d
    M test/demo/sched/whoqueue.d
    M test/demo/sched/whosteal.d
    M test/unittest/buffering/tst.cputime.sh
    A test/unittest/sched/tst.lv-dequeue.r
    A test/unittest/sched/tst.lv-dequeue.r.p
    A test/unittest/sched/tst.lv-dequeue.sh
    A test/unittest/sched/tst.lv-enqueue.r
    A test/unittest/sched/tst.lv-enqueue.r.p
    A test/unittest/sched/tst.lv-enqueue.sh
    A test/unittest/sched/tst.lv-off-cpu.r
    A test/unittest/sched/tst.lv-off-cpu.r.p
    A test/unittest/sched/tst.lv-off-cpu.sh
    A test/unittest/sched/tst.lv-on-cpu.r
    A test/unittest/sched/tst.lv-on-cpu.r.p
    A test/unittest/sched/tst.lv-on-cpu.sh
    A test/unittest/sched/tst.lv-surrender.r
    A test/unittest/sched/tst.lv-surrender.r.p
    A test/unittest/sched/tst.lv-surrender.sh
    A test/unittest/sched/tst.lv-tick.r
    A test/unittest/sched/tst.lv-tick.r.p
    A test/unittest/sched/tst.lv-tick.sh
    A test/unittest/sched/tst.lv-wakeup.r
    A test/unittest/sched/tst.lv-wakeup.r.p
    A test/unittest/sched/tst.lv-wakeup.sh
    M test/unittest/sched/tst.stackdepth.d

  Log Message:
  -----------
  Implement the sched provider (first part)

Partial implementation of the sched SDT provider.  The following probes
are implemented:

sched:::dequeue (arg1 is NULL)
sched:::enqueue (arg1 is NULL)
sched:::off-cpu
sched:::on-cpu (limited trigger locations)
sched:::surrender
sched:::tick
sched:::wakeup

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 32711a7c3a4aee90fe30e48fe62791f4103f3668
      https://github.com/oracle/dtrace-utils/commit/32711a7c3a4aee90fe30e48fe62791f4103f3668
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_bpf_maps.h
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_lockstat.c
    M libdtrace/dt_provider.h
    M test/demo/lockstat/whatlock.d
    R test/unittest/lockstat/test.x
    A test/unittest/lockstat/tst.lv-adaptive-acquire-error.r
    A test/unittest/lockstat/tst.lv-adaptive-acquire-error.r.p
    A test/unittest/lockstat/tst.lv-adaptive-acquire-error.sh
    A test/unittest/lockstat/tst.lv-adaptive-acquire.r
    A test/unittest/lockstat/tst.lv-adaptive-acquire.r.p
    A test/unittest/lockstat/tst.lv-adaptive-acquire.sh
    A test/unittest/lockstat/tst.lv-adaptive-block.r
    A test/unittest/lockstat/tst.lv-adaptive-block.r.p
    A test/unittest/lockstat/tst.lv-adaptive-block.sh
    A test/unittest/lockstat/tst.lv-adaptive-release.r
    A test/unittest/lockstat/tst.lv-adaptive-release.r.p
    A test/unittest/lockstat/tst.lv-adaptive-release.sh
    A test/unittest/lockstat/tst.lv-adaptive-spin.r
    A test/unittest/lockstat/tst.lv-adaptive-spin.r.p
    A test/unittest/lockstat/tst.lv-adaptive-spin.sh
    A test/unittest/lockstat/tst.lv-rw-acquire.r
    A test/unittest/lockstat/tst.lv-rw-acquire.r.p
    A test/unittest/lockstat/tst.lv-rw-acquire.sh
    A test/unittest/lockstat/tst.lv-rw-release.r
    A test/unittest/lockstat/tst.lv-rw-release.r.p
    A test/unittest/lockstat/tst.lv-rw-release.sh
    A test/unittest/lockstat/tst.lv-rw-spin.r
    A test/unittest/lockstat/tst.lv-rw-spin.r.p
    A test/unittest/lockstat/tst.lv-rw-spin.sh
    A test/unittest/lockstat/tst.lv-spin-acquire.r
    A test/unittest/lockstat/tst.lv-spin-acquire.r.p
    A test/unittest/lockstat/tst.lv-spin-acquire.sh
    A test/unittest/lockstat/tst.lv-spin-release.r
    A test/unittest/lockstat/tst.lv-spin-release.r.p
    A test/unittest/lockstat/tst.lv-spin-release.sh
    A test/unittest/lockstat/tst.lv-spin-spin.r
    A test/unittest/lockstat/tst.lv-spin-spin.r.p
    A test/unittest/lockstat/tst.lv-spin-spin.sh

  Log Message:
  -----------
  Implement the lockstat provider

Not all probes are supported yet in all possible proving locations due
to limitations in the kernel tracing framework and due to compiler
optimization of the kernel code.  Improvements will be added in an
incremental fashion.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: d51a52b13d7116da8b7024bb9885842e0b4e3e8f
      https://github.com/oracle/dtrace-utils/commit/d51a52b13d7116da8b7024bb9885842e0b4e3e8f
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M test/unittest/tracemem/tst.tracemem.d
    M test/unittest/tracemem/tst.tracemem.r
    R test/unittest/tracemem/tst.tracemem.r.p

  Log Message:
  -----------
  test: Switch kernel pointer in tracemem() test

The tracemem() test dumped a portion of kernel memory, comparing
different tracemem() output for the same kernel memory for consistency.
Since it was looking at task_struct for the current thread, however,
the underlying data could conceivably change as the test ran, leading
to inconsistency and a false negative.

Change the kernel memory to be the first 14 bytes of `linux_banner,
which should remain "Linux version ".

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 05b20bb6f25cff8207bcbb2a79d7835e14163695
      https://github.com/oracle/dtrace-utils/commit/05b20bb6f25cff8207bcbb2a79d7835e14163695
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: Fail if the postprocessor fails

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 50f66f4310334a97d088148bcbd9b23694cd4119
      https://github.com/oracle/dtrace-utils/commit/50f66f4310334a97d088148bcbd9b23694cd4119
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    A test/unittest/options/tst.switchrate.sh

  Log Message:
  -----------
  test: Add test for option "switchrate"

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 531e4926c6458863fb3e5e39455113ef63220242
      https://github.com/oracle/dtrace-utils/commit/531e4926c6458863fb3e5e39455113ef63220242
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    A test/stress/buffering/err.resize1.r
    R test/stress/buffering/err.resize3.d
    A test/stress/buffering/tst.resize3-manual.d
    A test/stress/buffering/tst.resize3-manual.r
    M test/stress/buffering/tst.resize3.d
    M test/stress/buffering/tst.resize3.r
    R test/stress/buffering/tst.resize3.r.p
    R test/stress/buffering/tst.resize3.x

  Log Message:
  -----------
  test: Fix specsize tests

It used to be that specsize specified the size of some speculative
buffers.

In the current implementation, the producer writes all speculative
data to the principal buffer and the consumer reads the data, placing
it into growable linked lists until commit/discard disposition is
decided.  So, an extremely high specsize does not necessarily cause
a problem:  no extremely high allocation necessarily occurs.

Modify the tests accordingly.  Update .r results files for any gratuitous
formatting changes in the new implementation.  Ensure there is a .r
results file for each test.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 7877da797d15dfe98721dccfcdfce287f9897211
      https://github.com/oracle/dtrace-utils/commit/7877da797d15dfe98721dccfcdfce287f9897211
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/codegen/err.deref_0.d
    A test/unittest/codegen/err.deref_0.r
    A test/unittest/codegen/err.deref_0.r.p
    A test/unittest/codegen/err.deref_1.d
    A test/unittest/codegen/err.deref_1.r
    A test/unittest/codegen/err.deref_1.r.p
    A test/unittest/codegen/err.deref_i0.d
    A test/unittest/codegen/err.deref_i0.r
    A test/unittest/codegen/err.deref_i0.r.p
    A test/unittest/codegen/err.deref_i1.d
    A test/unittest/codegen/err.deref_i1.r
    A test/unittest/codegen/err.deref_i1.r.p

  Log Message:
  -----------
  Have dt_cg_load_scalar report runtime error if it fails

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 5a71649836eae96800913ace19c59eff58f3818b
      https://github.com/oracle/dtrace-utils/commit/5a71649836eae96800913ace19c59eff58f3818b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_parser.c
    M test/unittest/pointers/tst.basic2.d

  Log Message:
  -----------
  Catch special DPTR cases in the parser

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 563d3c5cde47476afd885bab8ed37c93e1f38fa2
      https://github.com/oracle/dtrace-utils/commit/563d3c5cde47476afd885bab8ed37c93e1f38fa2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/arithmetic/tst.cast-add-assoc.d
    A test/unittest/arithmetic/tst.cast-add-assoc.r
    A test/unittest/arithmetic/tst.cast-add-tvar.d
    A test/unittest/arithmetic/tst.cast-add-tvar.r
    A test/unittest/arithmetic/tst.cast-imp-assoc.d
    A test/unittest/arithmetic/tst.cast-imp-assoc.r
    A test/unittest/arithmetic/tst.cast-imp-tvar.d
    A test/unittest/arithmetic/tst.cast-imp-tvar.r

  Log Message:
  -----------
  Promote associative integer arrays to 64 bits when loaded

In commit 7e9ce1eee475 ("Promote integers to 64 bits when loaded"),
integers were promoted to 64 bits when loaded.  Associative arrays
were on a different code path.

Add the promotion to the associative-array code path and add tests
for different variable types.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 6589fed6e86351e455494cd21565ed229c2d99bb
      https://github.com/oracle/dtrace-utils/commit/6589fed6e86351e455494cd21565ed229c2d99bb
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    A test/unittest/arithmetic/tst.cast-exp-assoc.d
    A test/unittest/arithmetic/tst.cast-exp-assoc.r
    A test/unittest/arithmetic/tst.cast-exp-tvar.d
    A test/unittest/arithmetic/tst.cast-exp-tvar.r

  Log Message:
  -----------
  test: Add cast-exp tests for other variable types

Add corresponding tests for non-global variables.  This is perhaps
overkill:  these tests check behavior on a code path that is shared
by multiple variable types.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f11e4da5a4cf9e40267324e1b46b7c7e7c3f97b9
      https://github.com/oracle/dtrace-utils/commit/f11e4da5a4cf9e40267324e1b46b7c7e7c3f97b9
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Call dt_cg_assoc_op() via dt_cg_load_var()

To load a variable, we currently call dt_cg_assoc_op() for associative
arrays and dt_cg_load_var() for all other types of variables.  This is
unfortunate since associative arrays and thread-local variables share
a lot of code, and this sharing will increase once NULL strings are
supported.  Further, such splitting is a different model from
dt_cg_store_var(), where all variable types are handled by a common
function.

Therefore, call dt_cg_assoc_op() via dt_cg_load_var().  Subsequent
patches will inline the call and consolidate common code.  This first
step appears separately to clarify the changes.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 044f91ec1fb9ade9f34026423e651f3c2906fc45
      https://github.com/oracle/dtrace-utils/commit/044f91ec1fb9ade9f34026423e651f3c2906fc45
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Move tvar code next to assoc code

Since the handling of thread-local variables and associative
arrays are so similar, move tvar code next to assoc code.
In subsequent patches, common code will be consolidated.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 1c35e8bc6ac42c5134719ac805a1c43659a27cc9
      https://github.com/oracle/dtrace-utils/commit/1c35e8bc6ac42c5134719ac805a1c43659a27cc9
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Inline dt_cg_assoc_op() into dt_cg_load_var()

Also, rename "dst" in dt_cg_load_var() to be "dnp".

A subsequent patch will consolidate common code.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 04c525f0e820a782c2d01660035438e853aebdcd
      https://github.com/oracle/dtrace-utils/commit/04c525f0e820a782c2d01660035438e853aebdcd
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Replace idp with fnp for function calls

Both dt_cg_load_var() and dt_cg_store_var() use "idp" to refer
to a variable id pointer and then reuse this variable to point
to a function.  The code is clearer if a new variable name is
used instead of reusing an old name.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: cda7b5bc9754f15b2bd969ef9bda78b4d97f5fce
      https://github.com/oracle/dtrace-utils/commit/cda7b5bc9754f15b2bd969ef9bda78b4d97f5fce
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Consolidate tvar/assoc pointer access

To load or store a thread-local variable or associative array
element, one must generate a dynamic pointer and then access the
pointer.  Currently, there are four code paths (load or store,
tvar or assoc).  However, generating the dynamic pointer depends
only on whether it's a tvar or assoc, not on whether we will load
or store.  Further, accessing the pointer depends only on whether
we load or store, not on whether the pointer represents a tvar or
assoc.  So, there is an opportunity to consolidate code.

In this patch, consolidate the pointer-access code.  In the next
patch, we will consolidate the pointer generation.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 08c26d223d1a9e80cd02c9d7673bcd7b9792bb13
      https://github.com/oracle/dtrace-utils/commit/08c26d223d1a9e80cd02c9d7673bcd7b9792bb13
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Consolidate tvar/assoc pointer generation

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: ddd14541ebf22a0fabfdea2108d334e04343d3db
      https://github.com/oracle/dtrace-utils/commit/ddd14541ebf22a0fabfdea2108d334e04343d3db
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/codegen/err.str_NULL_plus_offset-assoc.d
    A test/unittest/codegen/err.str_NULL_plus_offset-assoc.r
    A test/unittest/codegen/err.str_NULL_plus_offset-lvar.d
    A test/unittest/codegen/err.str_NULL_plus_offset-lvar.r
    A test/unittest/codegen/err.str_NULL_plus_offset-tvar.d
    A test/unittest/codegen/err.str_NULL_plus_offset-tvar.r
    A test/unittest/codegen/err.str_NULL_plus_offset.d
    A test/unittest/codegen/err.str_NULL_plus_offset.r
    A test/unittest/codegen/tst.deref_string-assoc.d
    A test/unittest/codegen/tst.deref_string-assoc.r
    A test/unittest/codegen/tst.deref_string-gvar.d
    A test/unittest/codegen/tst.deref_string-gvar.r
    A test/unittest/codegen/tst.deref_string-lvar.d
    A test/unittest/codegen/tst.deref_string-lvar.r
    A test/unittest/codegen/tst.deref_string-tvar.d
    A test/unittest/codegen/tst.deref_string-tvar.r

  Log Message:
  -----------
  map_value_or_null: add check for NULL pointer in load_var()

When we look up a dynamic pointer (e.g., associative array or thread-local
variable), the BPF verifier sees that we get back a "map_value_or_null".
Ultimately, we will check the validity of the value.  If we first add an
offset to it, however, the BPF verifier objects.  This is a little strange,
since the verifier is fine adding an integer to 0 or to a map value.
Nevertheless, that's the situation.

Check the value.  If 0, assign 0.  This seems like it doesn't do anything,
but it allows the BPF verifier to branch and handle map_value_or_null as
two separate cases.

Add tests.  While this fix addresses dynamic variables (associative arrays
and thread-local variables), add tests for global and local variables also.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 832b3d4706d9f4f034f7622a64c3124ee3988ecd
      https://github.com/oracle/dtrace-utils/commit/832b3d4706d9f4f034f7622a64c3124ee3988ecd
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_options.c
    A test/unittest/codegen/err.deref_string-assoc.d
    A test/unittest/codegen/err.deref_string-assoc.r
    A test/unittest/codegen/err.deref_string-assoc.r.p
    A test/unittest/codegen/err.deref_string-gvar.d
    A test/unittest/codegen/err.deref_string-gvar.r
    A test/unittest/codegen/err.deref_string-gvar.r.p
    A test/unittest/codegen/err.deref_string-lvar.d
    A test/unittest/codegen/err.deref_string-lvar.r
    A test/unittest/codegen/err.deref_string-lvar.r.p
    A test/unittest/codegen/err.deref_string-tvar.d
    A test/unittest/codegen/err.deref_string-tvar.r
    A test/unittest/codegen/err.deref_string-tvar.r.p
    A test/unittest/codegen/tst.str_runtime_NULL-assoc.d
    A test/unittest/codegen/tst.str_runtime_NULL-assoc.r
    A test/unittest/codegen/tst.str_runtime_NULL-gvar.d
    A test/unittest/codegen/tst.str_runtime_NULL-gvar.r
    A test/unittest/codegen/tst.str_runtime_NULL-lvar.d
    A test/unittest/codegen/tst.str_runtime_NULL-lvar.r
    A test/unittest/codegen/tst.str_runtime_NULL-tvar.d
    A test/unittest/codegen/tst.str_runtime_NULL-tvar.r
    M test/unittest/operators/tst.str_comparison-basic-with-NULL.d
    A test/unittest/options/err.strsize-min.d
    A test/unittest/options/err.strsize-min.r
    A test/unittest/options/tst.strsize-min.d
    A test/unittest/options/tst.strsize-min.r
    M test/unittest/vars/tst.nullassign.d

  Log Message:
  -----------
  Add support for NULL strings

In C, strings are (char*), and it is possible to have a NULL pointer.

In D, strings have fixed length strsize.  There may still be NULL
pointers -- say, as inputs to strtok() or as outputs from unsuccessful
strchr() (and other) functions.

Such NULL pointers are not a problem for storing strings as dynamic
variables (thread-local variables or associative arrays), since storing
0 clears a dynamic element and reading a cleared element means 0.

Static (global and local) variables are a different story.  Each
string has strsize bytes allocated for it, and every possible string
value is legal:  bytes up to the first NUL are part of the string
and subsequent bytes are ignored.  There is no value that represents
a NULL string.

Specifically, there is an important semantic difference between NULL
and empty strings.  The former are NULL pointers, while the latter are
strings that simply start with the NUL terminating char.

Add code to handle store and load of NULL-pointer strings to and from
global and local variables.

Specifically, define a byte string DT_NULL_STRING whose first byte is
0x00 but with extra nonzero bytes to distinguish between empty and NULL
strings.  An empty string stored as a static variable will have its
first bytes all zero.  A NULL string will have its first bytes be
DT_NULL_STRING.  That is, both will have initial byte 0, and then we
have to go further to distinguish the two cases.

We require strsize >= sizeof(DT_NULL_STRING), which is reasonable.

Note that comparisons between NULL and empty strings should work the
same way as between NULL strings and any other non-NULL strings.  Note
that Solaris and legacy DTrace on Linux incorrectly treated comparisons
between NULL and empty strings as between equal values.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f8a8c1773de6bc374ce03532d07fe47d4d914611
      https://github.com/oracle/dtrace-utils/commit/f8a8c1773de6bc374ce03532d07fe47d4d914611
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M test/unittest/codegen/tst.str_store_var.d
    M test/unittest/codegen/tst.str_store_var.r

  Log Message:
  -----------
  test: Add string store_var()/load_var() tests for more than gvars

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f915d03d64d98380b8e2c9f4a5a39ed673c6df90
      https://github.com/oracle/dtrace-utils/commit/f915d03d64d98380b8e2c9f4a5a39ed673c6df90
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/disasm/tst.ann-str_assoc.r
    A test/unittest/disasm/tst.ann-str_assoc.sh
    A test/unittest/disasm/tst.ann-str_gvar.r
    A test/unittest/disasm/tst.ann-str_gvar.sh
    A test/unittest/disasm/tst.ann-str_lvar.r
    A test/unittest/disasm/tst.ann-str_lvar.sh
    A test/unittest/disasm/tst.ann-str_tvar.r
    A test/unittest/disasm/tst.ann-str_tvar.sh

  Log Message:
  -----------
  Fix string disasm due to new code path

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 500773fff8aff28f923445007609524c5372ac98
      https://github.com/oracle/dtrace-utils/commit/500773fff8aff28f923445007609524c5372ac98
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  uregs: Minor cleanup

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f9afda1a9c24df3af56c89399f5be2f763447212
      https://github.com/oracle/dtrace-utils/commit/f9afda1a9c24df3af56c89399f5be2f763447212
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Add an offsetof() function for CTF types

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: cec382316bbd49e18e543245eec4aafd4e050452
      https://github.com/oracle/dtrace-utils/commit/cec382316bbd49e18e543245eec4aafd4e050452
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/arrays/tst.uregsarray-check2.d
    A test/unittest/arrays/tst.uregsarray-check2.r
    A test/unittest/arrays/tst.uregsarray-check2.r.p
    A test/unittest/arrays/tst.uregsarray-check2.x

  Log Message:
  -----------
  uregs: Fix access to thread members on x86

The "fix" is simply to account for thread members that are less than
8 bytes wide.

Most of this patch is for refactoring (using functions to determine
offsets with CTF types or to load a scalar safely from memory that
the BPF verifier cannot vet) and adding a test.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: cc64f41cb37e739f409d783a04d6feb1299a8b95
      https://github.com/oracle/dtrace-utils/commit/cc64f41cb37e739f409d783a04d6feb1299a8b95
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    R test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.d
    R test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.r
    R test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.x
    M test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.aarch64.x
    M test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.x86_64.x
    R test/unittest/arrays/tst.uregsarray-check.x
    M test/unittest/arrays/tst.uregsarray.arm64.x
    R test/unittest/arrays/tst.uregsarray.x
    M test/unittest/arrays/tst.uregsarray.x86_64.x
    R test/unittest/disasm/tst.vartab-bvar-uregs0.x

  Log Message:
  -----------
  uregs: Support for older kernels (without BPF pt_regs helper functions)

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 87c69bc995d96da38748b10889dafe4b47e227e6
      https://github.com/oracle/dtrace-utils/commit/87c69bc995d96da38748b10889dafe4b47e227e6
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    A test/unittest/codegen/tst.reg_spilling2.d
    A test/unittest/codegen/tst.reg_spilling2.r
    A test/unittest/codegen/tst.reg_spilling3.d
    A test/unittest/codegen/tst.reg_spilling3.r
    A test/unittest/codegen/tst.reg_spilling4.d
    A test/unittest/codegen/tst.reg_spilling4.r
    A test/unittest/codegen/tst.reg_spilling5.d
    A test/unittest/codegen/tst.reg_spilling5.r
    A test/unittest/codegen/tst.reg_spilling6.d
    A test/unittest/codegen/tst.reg_spilling6.r
    A test/unittest/codegen/tst.reg_spilling7.d
    A test/unittest/codegen/tst.reg_spilling7.r

  Log Message:
  -----------
  test: Add tests on register management for strjoin()

The current register management in the code generator needs overhaul.
Here are some tests to check operations in strjoin().  Some of these
tests are marked @@xfail until the overhaul has been done.

For example, here is what happens in tst.reg_spilling5.d.

The D script is:

  trace(strjoin("abc",
                strjoin("def",
                        strjoin("ghi",
                                strjoin("jkl",
                                        strjoin("mno",
                                                "pqrstuvwx"
                                               )
                                       )
                               )
                       )
               )
       );

The generated code basically does this:
    r8 = pointer to "abc"
    r7 = pointer to "def"
    r6 = pointer to "ghi"
    r5 = pointer to "jkl"
    r4 = pointer to "mno"
    r3 = pointer to "pqrstuvwx"

Then it does the innermost strjoin:
    r2 = pointer to tstring(0)
    spill %r2
    spill %r3
    spill %r4
    spill %r5
    dt_strjoin(tstring(0), "mno", "pqrstuvwx");
    restore %r2
    restore %r5

Then it starts the next strjoin:
    r4 = pointer to tstring(1)
    spill %r2
    spill %r4
    spill %r5

Next, it must fill the arguments for the dt_strjoin(dst, s1, s2) call.
It uses the following code from dt_cg_subr_strjoin():
    BPF_MOV_REG(BPF_REG_1, dnp->dn_reg);
    BPF_MOV_REG(BPF_REG_2, s1->dn_reg);
    dt_regset_free(s1->dn_reg);
    BPF_MOV_REG(BPF_REG_3, s2->dn_reg);
    dt_regset_free(s2->dn_reg);

At this point, however:
    r4  is  dst
    r5  is  s1
    r2  is  s2
So the code is:
    r1 = r4        // loads dst into r1, okay
    r2 = r5        // loads s1 into r2, but overwrites s2!
    fill r5        // okay, we do not care
    r3 = r2        // uses overwritten value!
    fill r2        // overwrites a function arg!

Careful register management in dt_cg_subr_strjoin() could fix this
problem, but resolution will be left for the larger overhaul.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 00d36aba475e9f6acc6c66e3e72abfea546b12b0
      https://github.com/oracle/dtrace-utils/commit/00d36aba475e9f6acc6c66e3e72abfea546b12b0
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libcommon/uprobes.c

  Log Message:
  -----------
  uprobes: don't leak one fd per uprobe created

An unfortunate typo led to us leaking one fd to uprobe_events
every time we created a uprobe.  (Spotted when creating thousands of
them, and dtprobed ran out of fds.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 98e18514384732b19912cf0712816a748befb7ac
      https://github.com/oracle/dtrace-utils/commit/98e18514384732b19912cf0712816a748befb7ac
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M dtprobed/Build
    M dtprobed/dtprobed.c
    A dtprobed/seccomp-assistance.c
    A dtprobed/seccomp-assistance.h

  Log Message:
  -----------
  dtprobed: stop malloc making syscalls in the DOF parser child

If dtprobed receives DOF larger than the glibc mmap threshold (64KiB by
default), it will make an mmap() to allocate space for it in the parser
child.  Since it's in a seccomp jail, this is denied and the child is
killed.  Whoops.

Rejigging the entire parser child to avoid allocations is possible, but
needless: we can just ask glibc to never call mmap and keep enough space
free at the top of the heap for plausible allocations, make a big
allocation right before nailing ourselves into the jail, and keep
going. We have a (fairly small) maximum size for a given piece of DOF,
and there is no risk of heap fragmentation because we free everything
on every message received, so a fixed size (with respect to that
maximum) should always be enough.

(There is a slight extra complexity here: we have to hide the malloc()
and free() for the big allocation in another translation unit (and turn
LTO off for that translation unit), or GCC will recognise that the
malloc/free are do-nothing, and optimize them away.)

(If glibc ever stops respecting M_MMAP_MAX or M_TRIM_THRESHOLD we'll be
in bigger trouble and might need our own simple-minded allocator, but
this doesn't seem at all likely in the near future at least.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: ea56ab019f56fc8d8c80ef63e3803af1e8d3ab5e
      https://github.com/oracle/dtrace-utils/commit/ea56ab019f56fc8d8c80ef63e3803af1e8d3ab5e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c
    A test/unittest/usdt/tst.manyprobes.r
    A test/unittest/usdt/tst.manyprobes.sh

  Log Message:
  -----------
  dtprobed: support DOF > 64KiB

dtprobed's ioctl handler is a state machine that reads in client DOF in
multiple phases:

 DTP_IOCTL_START: read the struct dof_helper_t

 DTP_IOCTL_HDR: read the struct dof_hdr_t, giving us the size of the DOF

 DTP_IOCTL_DOFHDR: read the DOF itself

 DTP_IOCTL_DOF: (everything is read; actually parse the DOF)

These various phases are triggered by issuing a fuse_reply_ioctl_retry()
to ask FUSE to read things out of the ioctl() caller for us and call us
back with the new stuff.  We can read from any address in the client (we
are root), but that doesn't mean we can read any *length* -- the kernel
refuses to read beyond a certain length and alas that length is
customizable via mount options (or, for CUSE, via kernel command-line
options) and we can't easily tell what it is.

I think it reasonable to say that anyone who *reduces* the length below
the default is asking for it: I can't find any CUSE or FUSE-using code
anywhere on the Internet that does anything more than hardwire this
value to 128KiB. For paranoia, we use 64KiB ourselves -- that's still a
lot of probes in one go.

We add a new state, DTP_IOCTL_DOFCHUNK, and read in one piece of DOF
per chunk until all the chunks are read in, concatenating them before
handing it off to the parser.

A new test checks this stuff: it has 206KiB of DOF which is enough to
test "first chunk", "neither first nor last chunk" and "last chunk"
cases: the DOF itself isn't formatted such that this equates to "first
probe, probe in the middle, last probe" but if any of those chunks is
missing or misaligned the string tables will be fubared and all the
probe names will be wrong, triggering a test failure (at best).

Orabug: 35411920
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 5c33bbdbf6ad4944838bb9caac1939695d34d900
      https://github.com/oracle/dtrace-utils/commit/5c33bbdbf6ad4944838bb9caac1939695d34d900
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c

  Log Message:
  -----------
  dtprobed: fix a tiny leak on an error path

Highly unlikely to be a problem, but still.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 7c211c484f0f12b9738ae96d7c5c0fbbb6763baf
      https://github.com/oracle/dtrace-utils/commit/7c211c484f0f12b9738ae96d7c5c0fbbb6763baf
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c

  Log Message:
  -----------
  dtprobed: retry DOF parses at least once

The whole point of jailing the DOF parser is so that failures are
harmless. To do harm to anything other than itself an attacking process
would need to compromise the state of the parser process such that it
not only doesn't crash but returns malicious results affecting
*subsequent calls*, which is quite difficult.  This implies that DOF
parser crashes can be because of corruption induced by *previous*
invocations -- but right now we penalize the crashed process by not
parsing its DOF if the parser crashed.

Give all processes at least one fresh try in a new instance before
giving up.  (This also means that if memory fragmentation or something
forces a malloc to make forbidden syscalls -- and thus a crash -- we try
again with a fresh copy which won't need to malloc.)

(In the process, fix one place where we were triggering a double-kill()
of the DOF parser child, which on a very busy system could theoretically
lead us to kill something we shouldn't.)

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: cddcc07d527c462d38a2f23f7fc9271b53d928bf
      https://github.com/oracle/dtrace-utils/commit/cddcc07d527c462d38a2f23f7fc9271b53d928bf
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_prov_uprobe.c

  Log Message:
  -----------
  uprobes: tiny style cleanup

Not sure where this crept in, but it's obviously wrong.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: 15e89bc38f60ae5e1317cfb2d26fb35f3599d15c
      https://github.com/oracle/dtrace-utils/commit/15e89bc38f60ae5e1317cfb2d26fb35f3599d15c
  Author: Steven Sistare <steven.sistare at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_link.c
    A test/unittest/usdt/tst.link-idempotence.sh

  Log Message:
  -----------
  link: do not modify the input object files unless changed

process_obj() and the various implementations of dt_modtext() go to
considerable lengths to not modify the input .o files unless they
actually need to change (dtrace -G differs from a linker in this,
since it modifies its input object files as well as creating an
output).

But if it finds probes, it unconditionally declares the file modified
and (eventually) calls elf_update() on it, even if all the modifications
were already done by a prior invocation of dtrace -G on the same inputs.
This leads to needless re-make(1)s and is entirely unnecessary.  (The
output is still modified regardless, of course.)

(nca: wrote test, commit log)

Orabug: 35417184
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: c5e8b28e6233c273ca45491d372eac5da71252e5
      https://github.com/oracle/dtrace-utils/commit/c5e8b28e6233c273ca45491d372eac5da71252e5
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_link.c
    M libdtrace/dt_options.c

  Log Message:
  -----------
  link: introduce -x linknommap

This option allows users of dtrace -G to force elfutils to not use
mmap(), avoiding various bugs in elfutils which can break mmap() usage
with large projects.

It's rather horrible and (I hope) a stopgap we can eventually turn into
a NOP.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 0bcaa6c468e42b64e11ddd35e1ad0973d779b96b
      https://github.com/oracle/dtrace-utils/commit/0bcaa6c468e42b64e11ddd35e1ad0973d779b96b
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-25 (Thu, 25 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c
    A test/unittest/usdt/tst.manyprocs.sh

  Log Message:
  -----------
  dtprobed: prevent inter-request contamination of state

On fairly rare occasions, one sometimes sees dtprobed saying things like
this:

46157: dtprobed: helper size incorrect: expected at least 80, not 0

or

25815: dtprobed: DOF too small: expected at least 64, not 0

The message varies, but the size is always 0.  Whenever this happens
one object's-worth of incoming DOF is thrown out.

The cause is, it turns out, simple.  CUSE ioctls are handled via a
multistage request/response protocol, where the CUSE server (dtprobed)
repeatedly calls fuse_reply_ioctl_retry() and returns and is immediately
called back with the result of extracting a bit more info from the
client's address space: this process is fast but still involves a
protocol roundtrip to the FUSE device, so it's not instantaneous.  To
carry state across this call FUSE has a userdata pointer that is shared
across calls to all the FUSE callbacks.

Now *obviously* CUSE isn't going to interleave the results of this
request/response process with further requests coming in from new
clients, right? I mean even the FUSE examples are written assuming that
this won't happen.

It does, and this problem is, while not terribly common, common enough
that I'm not the only one who's seen it. You can be halfway through a
request/response cycle and then some new PID can come blundering in and
you have to handle that as well, in parallel.

So we can't just pass a single userdata state vector around and have it
track everything because all our requests are serialized, since they're
*not* serialized.  So switch to managing them by hand: maintain a
dt_list_t of manually-malloced userdatas, reverse-insertion-sorted by
pid so that unless the pid wraps the pid we want is almost always at the
head of the list.  We need to clean up this list periodically because
processes can be killed in the middle of their ioctl() so we can get
stale stuff in the list: to save a bit of time and make sure the cleanup
code doesn't rust, *only* free in a periodic cleanup cycle: the cycle
goes through the list and frees every element with no associated process
or whose state indicates that it's not in the middle of a
request/response cycle right now.

For now, clean up every 128 requests -- rare enough that it's
amortized-free, common enough that even when pids wrap we hardly have to
traverse any stale ones to get to the one we care about.

Add a test for the cleanup code (and a bit of a load-test for dtprobed)
that just kicks off a bunch of processes with probes.  This won't fail
itself but if things go wrong it might provoke a dtprobed crash and a
failure of later usdt tests, which is not a valueless thing (since the
cleanup code is otherwise not tested at all, and it found a bug when I
wrote it, so let's keep it).

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: ac2f0edc7eb5294c0cf675f9f96b4d0e00f7e3b7
      https://github.com/oracle/dtrace-utils/commit/ac2f0edc7eb5294c0cf675f9f96b4d0e00f7e3b7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M test/unittest/types/tst.nested-unnamed-structs.d

  Log Message:
  -----------
  test: tst.nested-unnamed-structs.d needs to be xfail pending binutils patch

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 51ed7d05578fae9ccf4b0aeed3ea6a987f7a47de
      https://github.com/oracle/dtrace-utils/commit/51ed7d05578fae9ccf4b0aeed3ea6a987f7a47de
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M test/unittest/speculation/tst.SpecSizeVariations4.r

  Log Message:
  -----------
  test: tst.SpecSizeVariations4.d should expect a speculation drop warning

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 34522dfa6737f73fe55747a9d0e8311ea4046e92
      https://github.com/oracle/dtrace-utils/commit/34522dfa6737f73fe55747a9d0e8311ea4046e92
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M test/unittest/sched/tst.stackdepth.d

  Log Message:
  -----------
  test: tst.stackdepth.d marked unstable

The tst.stackdepth.d test is currently unstable because the
sched:::on-cpu probe it depends on requires more work to ensure it
fires correctly in all expected cases.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 10f885864a5c2149ac231d67b1c29675d8561091
      https://github.com/oracle/dtrace-utils/commit/10f885864a5c2149ac231d67b1c29675d8561091
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  uregs: Account for larger page sizes on some older ARM kernels

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: a55988ecf71110691f21fd783f194d141eb40f2c
      https://github.com/oracle/dtrace-utils/commit/a55988ecf71110691f21fd783f194d141eb40f2c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.d
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.end.d
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.end.r
    M test/unittest/drops/drp.DTRACEDROP_PRINCIPAL.r

  Log Message:
  -----------
  test: Adjust test for drops to allow for 64k page size

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 197115e2ac9a5f9c24af3ecf38046d240a2319bd
      https://github.com/oracle/dtrace-utils/commit/197115e2ac9a5f9c24af3ecf38046d240a2319bd
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M libdtrace/dt_prov_lockstat.c

  Log Message:
  -----------
  lockstat: refuse to provide probes on kernels < 5.10.0

Kernels earlier than 5.10.0 contain a bug that causes a kernel deadlock
when using kretprobe on spinlock functions.  We do not provide lockstat
probes on such kernels for the user's safety.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 67a6679fc82a3eea940c32d53feaa34c1e944cfa
      https://github.com/oracle/dtrace-utils/commit/67a6679fc82a3eea940c32d53feaa34c1e944cfa
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M NEWS
    M dtrace.spec

  Log Message:
  -----------
  Update NEWS and spec file for errata release 2.0.0-1.13

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 9019e9271533c15b59ffda154ae45f9dde0695d7
      https://github.com/oracle/dtrace-utils/commit/9019e9271533c15b59ffda154ae45f9dde0695d7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M bpf/speculation.c

  Log Message:
  -----------
  bpf: ensure speculations drops are reported when needed

The unrolled loop in dt_speculation() would return without recording
a speculation drop if an iteration was attempted beyond the configured
NSPEC value.  Depending on how the compiler optimized the code, that
could lead to an early return from the function without ever calling
dt_no_spec().

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: f8a705c49b606fa1f2f7098ea054771d8c4af70d
      https://github.com/oracle/dtrace-utils/commit/f8a705c49b606fa1f2f7098ea054771d8c4af70d
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M dtprobed/dtprobed.c

  Log Message:
  -----------
  dtprobed: delete redundant conditional

We've just tested this condition: it cannot be false.

This was pointed out in an earlier review, but I forgot to commit it.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 8dedee6fc6ef58c3818a32d84d2acc4bf87b1dce
      https://github.com/oracle/dtrace-utils/commit/8dedee6fc6ef58c3818a32d84d2acc4bf87b1dce
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M test/unittest/usdt/tst.manyprobes.sh

  Log Message:
  -----------
  test: Have manyprobes clean up uprobes

Once dtprobed cleans uprobes up automatically, this hack will no longer
be needed.  Meanwhile, we have to clean up lest a few runs of this test
lead to denial of service.

Note that the test did try to clean up uprobes but it referred to
uprobe_events with an incorrect pathname (leading to ineffectual cleanup
and, on some systems, test failures) and it cleaned up all uprobes, even
ones not created by this test.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 5ad4703d88db08b741b994ae1c960a907ca7e465
      https://github.com/oracle/dtrace-utils/commit/5ad4703d88db08b741b994ae1c960a907ca7e465
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M test/unittest/aggs/tst.allquant.d

  Log Message:
  -----------
  test: Convert tick-* probes to ioctl:entry for tst.allquant.d

Historically, many tests have used tick-* probes to get multiple
probe firings, but those probes can be unreliable, depending on
how a kernel is configured.  Tests that required very many probe
firings have been converted to ioctl:entry.  Tests that required
very few have been left alone.

Convert this "in-between" test as well.  It normally passes, but
with variable execution time and has even been observed to time out.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: e0d1c7cc0d2126be51a4bda16ac08ffb431acd4d
      https://github.com/oracle/dtrace-utils/commit/e0d1c7cc0d2126be51a4bda16ac08ffb431acd4d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M test/unittest/options/tst.switchrate.sh

  Log Message:
  -----------
  test: Loosen tolerance for switchrate test

The timing expected for the switchrate test is rather approximate.
We want a "short" switchrate to run in a "short" amount of time and
a "long" one to run "long."  That's about it.

The actual times observed tend to be a little higher than the expected
times.  On some systems (ARM OL9?), the discrepancy is slightly higher.
This test, however, is simply concerned with whether the switchrate
option is working.

Loosen the tolerance for the test.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: c34edd22ecd3f4c02f2f5f5a0e9e84538ac43a80
      https://github.com/oracle/dtrace-utils/commit/c34edd22ecd3f4c02f2f5f5a0e9e84538ac43a80
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M test/unittest/scalars/tst.misc.x

  Log Message:
  -----------
  test: Allow for ext4 and isofs to be built-in modules

The test uses symbols from modules ext4 and isofs.  So skip the test
if those modules are not present.  The modules, however, might be
built into the kernel.

So, check /proc/kallmodsyms rather than /proc/modules for the modules.

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: ded09d05a7386c18c5a89b4abd95169428718a51
      https://github.com/oracle/dtrace-utils/commit/ded09d05a7386c18c5a89b4abd95169428718a51
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    A test/unittest/lockstat/tst.lockstat-summary.aarch64.r
    A test/unittest/lockstat/tst.lockstat-summary.d
    A test/unittest/lockstat/tst.lockstat-summary.t
    A test/unittest/lockstat/tst.lockstat-summary.x86_64.r
    R test/unittest/lockstat/tst.lockstat.sh

  Log Message:
  -----------
  test: rework main lockstat test

The main lockstat test (tst.lockstat.sh) didn't need to be implemented
using a shell script.  It has been reworked to be a regular .d script
with a .t trigger executable script.  Because of varying kernel options
between aarch64 and x86_64, each arch gets its own expected output.

Test failures may be reported if kernel configurations differ from those
used for UEK6 and UEK7.  More specific tests (configured based on the
kernel configuration of the runtime kernel) will need to be developed to
make this type of testing more effective.

The test has been renamed as tst.lockstat-summary.d to reflect that it is
a test the summarizes the overall implementation of lockstat probes.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>


  Commit: ae9f2a137438b2e3798ff532bd986fe3abfd9c8a
      https://github.com/oracle/dtrace-utils/commit/ae9f2a137438b2e3798ff532bd986fe3abfd9c8a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M test/unittest/options/err.pspec-default.r
    A test/unittest/options/err.pspec-default.r.p

  Log Message:
  -----------
  test, options: work around a subtle lexer bug

The err.pspec-default test hits a horrible eleven-year-old bug in the
lexer (related to the move to flex from AT&T lex) which is triggering
the printing of garbage instead of a nice syntax error when in state 0
(possible probe name) and a type name is encountered, and its
second-to-last character is a *, and we are otherwise at EOF.

Let's fix this obscure monster in the next release and just evade it for
now.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 0cc5268289d3eda39ef161fc17c69c8f8e1b4d13
      https://github.com/oracle/dtrace-utils/commit/0cc5268289d3eda39ef161fc17c69c8f8e1b4d13
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-05-31 (Wed, 31 May 2023)

  Changed paths:
    M libdtrace/dt_prov_cpc.c

  Log Message:
  -----------
  cpc: Add a destroy function

Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: 54eaa8936464e11d290660a4f6d49074086d7124
      https://github.com/oracle/dtrace-utils/commit/54eaa8936464e11d290660a4f6d49074086d7124
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M NEWS
    M dtrace.spec

  Log Message:
  -----------
  Update NEWS and spec file for errata release 2.0.0-1.13 (correction)

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>


Compare: https://github.com/oracle/dtrace-utils/compare/f543fa6706c0...54eaa8936464



More information about the DTrace-devel mailing list