[DTrace-devel] [oracle/dtrace-utils] 94d952: Tweak testsuite to account for libctf / libdtrace-...

euloh noreply at github.com
Fri Apr 29 17:00:44 UTC 2022


  Branch: refs/heads/2.0-branch-dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 94d95280489a69fef9c975a8a9df9fb670697d64
      https://github.com/oracle/dtrace-utils/commit/94d95280489a69fef9c975a8a9df9fb670697d64
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    A test/unittest/enum/err.D_UNKNOWN.RepeatIdentifiers.r.p
    M test/unittest/funcs/err.inet_ntoabadaddr.d
    M test/unittest/funcs/err.inet_ntopbadaddr.d
    M test/unittest/funcs/err.inet_ntopbadarg.d
    A test/unittest/offsetof/err.D_UNKNOWN.OffsetofNULL.r.p
    A test/unittest/types/err.D_UNKNOWN.dupenum.r.p
    A test/unittest/types/err.D_UNKNOWN.dupstruct.r.p
    A test/unittest/union/err.D_DECL_INCOMPLETE.circular.r.p
    A test/unittest/union/err.D_DECL_INCOMPLETE.order.r.p
    A test/unittest/union/err.D_DECL_INCOMPLETE.simple.r.p
    M test/utils/Build
    A test/utils/libctf.r.p

  Log Message:
  -----------
  Tweak testsuite to account for libctf / libdtrace-ctf differences

Some error messages changed in libctf while libdrace-ctf is still using
the old messages.  The most common change is the addition of a trailing
period for error messages.

Forward declarations were printed as 'struct FOO' with libdtrace-ctf
even if they were for a union or enum.  With libctf they are printed
correctly - the testsuite tests affected by this now support both cases.

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


  Commit: cd179d39f759cff7526da7e53a7f35d8f4ec30a4
      https://github.com/oracle/dtrace-utils/commit/cd179d39f759cff7526da7e53a7f35d8f4ec30a4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Ensure proper validation checks are done before freeing a tstring

We want to call dt_cg_tstring_free() if a tstring is in use.  Two
styles of checks were being used:
    if (dnp->dn_kind == DT_NODE_FUNC && dnp->dn_tstring)
        dt_cg_tstring_free(pcb, dnp);
and
    if (dnp->dn_tstring)
        dt_cg_tstring_free(pcb, dnp);
The problem with the second style is that if dn_kind is not DT_NODE_FUNC,
then dnp->dn_string might still be non-NULL since it is a union with
other members.  This leads to calling dt_cg_tstring_free() with an
invalid address and an assertion failure.

Add the check for dnp->dn_kind == DT_NODE_FUNC and dnp->dn_tstring into
dt_cg_tstring_free() to ensure the checks are performed at all times and
to simplify the code.

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


  Commit: 40a9fe53f27e5b5d5914fed190dbcf86ebd2f7c1
      https://github.com/oracle/dtrace-utils/commit/40a9fe53f27e5b5d5914fed190dbcf86ebd2f7c1
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_parser.h
    A test/unittest/codegen/tst.tstring_asgn_expr.d
    A test/unittest/codegen/tst.tstring_asgn_expr.r
    A test/unittest/codegen/tst.tstring_ternary.d
    A test/unittest/codegen/tst.tstring_ternary.r

  Log Message:
  -----------
  Make sure assignment expressions work correctly with tstrings

The node kinds that can hold a tstring has been expanded from just
DT_NODE_FUNC to DT_NODE_OP1, DT_NODE_OP2, DT_NODE_OP3, DT_NODE_DEXPR.
This is necessary in order to properly manage the life of tstrings.

The dt_cg_store_var() function no longer frees the (possible) tstring
associated with the assignment itself.

Support has been added to handle tstrings when generating code for a
ternary (?:) operator where the value are strings.

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


  Commit: b4baa3e83f8b338ab5f92f5df419b81be222e099
      https://github.com/oracle/dtrace-utils/commit/b4baa3e83f8b338ab5f92f5df419b81be222e099
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M bpf/substr.S
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-too-far-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-too-far-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-too-far.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg-too-far.r
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-pos-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-pos-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-too-far-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-too-far-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-too-far.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg-too-far.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-pos-no-cnt.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-pos-no-cnt.r
    A test/unittest/funcs/substr/tst.substr-stored-len.d
    A test/unittest/funcs/substr/tst.substr-stored-len.r
    A test/unittest/funcs/substr/tst.substr-strsize.d
    A test/unittest/funcs/substr/tst.substr-strsize.r

  Log Message:
  -----------
  Fix length stored by substr() and optimize the implementation

In certain cases, substr() would store an incorrect length for the
result string.  This problem is resolved with this patch.

Better comments have been added as well to make the code easier to
follow.

The code handling the case where (idx < 0) failed to recognize that
when the adjusted idx value was more negative than the value of cnt,
the result would always be the empty string.  This has been corrected
which improved code performance as well.

Another important change can be found in label .Lcheck_idx (formerly
.Ladjust_cnt).  The original four conditionals were overkill, and the
case for (cnt > 0) was jumping to .Lcnt_pos incorrectly (causing the
incorrect string length value).  It now correctly jumps to .Lcopy.
In fact, the .Lcnt_pos code was unnecessary.

Copying the substring now makes use of the probe_read_str() helper
rather than the probe_read() helper.

10 new tests are added to test various special conditions.

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


  Commit: 25d31f840253aaabdeb4b2ce11e8b8099d87bbe2
      https://github.com/oracle/dtrace-utils/commit/25d31f840253aaabdeb4b2ce11e8b8099d87bbe2
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Fix tstring length

The tstring area was being allocated without accounting for the NUL byte
at the end of strings.

The tstring reset code was calculating the allocation size per string at
every iteration rather than once.

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


  Commit: cf1e9df28b9585a1e8ca149d72d26a7ddee3070f
      https://github.com/oracle/dtrace-utils/commit/cf1e9df28b9585a1e8ca149d72d26a7ddee3070f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Optimize dt_cg_store_val() for string values

The dt_cg_store_val() implementation was doing more than just copying
a value to the output buffer when dealing with strings.  It was
checking the size of the string to ensure that it was not beyond the
maximum string size, and if it was, it would truncate the string.

That turns out to pose issues because it hides the fact that some of
the string handling code was not ensuring that strings were stored
with the correct string length.  It also hid the fact that string
constants can be longer than the maximum string length, and therefore
atring functions were being presented with strings of an unacceptable
length.

This patch causes several tests in the testsuite to fail.  This is
expected behaviour and will require bugfix patches to string handling
code to ensure that all strings used in D code have a length that is
the maximum string length or less.

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


  Commit: ace8cbfd4d742e1bf06712a3f330addb0b5425c5
      https://github.com/oracle/dtrace-utils/commit/ace8cbfd4d742e1bf06712a3f330addb0b5425c5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-19 (Fri, 19 Nov 2021)

  Changed paths:
    M bpf/strjoin.S
    A test/unittest/funcs/strjoin/tst.strjoin-bordercases.d
    A test/unittest/funcs/strjoin/tst.strjoin-bordercases.r

  Log Message:
  -----------
  Fix length stored by strjoin() and optimise the implementation

The length that was stored for strjoin() was the sum of the lengths of
the two argument strings.  That means that if the sum was larger than
STRSIZE, we would still store that larger length even though the string
itself got truncated.

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


  Commit: 6cf4dedf1301d3721413870bae30874472d83568
      https://github.com/oracle/dtrace-utils/commit/6cf4dedf1301d3721413870bae30874472d83568
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_subr.c
    A test/unittest/codegen/tst.str_const_length.d
    A test/unittest/codegen/tst.str_const_length.r

  Log Message:
  -----------
  Ensure string constants that are too long are truncated correctly

The string table can contain strings that are longer than the maximum
string size for the program being compiled.  They need to be truncated
before they are used to ensure that string operations work correctly.

Since string constants can be used verbatim or as values of built-in
variables, it is easiest to just pre-process the string table before it
is loaded into the 'strtab' BPF map.  Every string that is longer than
the maximum string size has its length prefix set to the maximum string
size and the string itself is truncated to that length.

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


  Commit: 361d3443578901483c233f0bf8c7c478d13da39c
      https://github.com/oracle/dtrace-utils/commit/361d3443578901483c233f0bf8c7c478d13da39c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M libdtrace/dt_cg.c
    M test/unittest/dif/rand.d
    M test/unittest/funcs/tst.rand.d
    A test/unittest/funcs/tst.rand_inter.sh
    A test/unittest/funcs/tst.rand_intra.sh

  Log Message:
  -----------
  Add support for rand() subroutine

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


  Commit: c194ba4d332730fb1632b99411cb199448e4bf6a
      https://github.com/oracle/dtrace-utils/commit/c194ba4d332730fb1632b99411cb199448e4bf6a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M test/unittest/actions/symmod/tst.symmod.sh

  Log Message:
  -----------
  Add test for func(), which is an alias for sym()

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


  Commit: ab83f64d8e7c0dad643ec131d1c454811eede995
      https://github.com/oracle/dtrace-utils/commit/ab83f64d8e7c0dad643ec131d1c454811eede995
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-11-30 (Tue, 30 Nov 2021)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M test/unittest/funcs/tst.ftruncate.sh

  Log Message:
  -----------
  Add support for the ftruncate() action

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


  Commit: 44f72b19509198733b53973e96502c6678fb67fc
      https://github.com/oracle/dtrace-utils/commit/44f72b19509198733b53973e96502c6678fb67fc
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M cmd/Build
    R cmd/ctf_module_dump.c
    M dtrace.spec

  Log Message:
  -----------
  cmd: delete ctf_module_dump

This tool was useful back in the day because it knew how to read CTF
that was dumped into kernel modules, digging out the shared CTF
dict and built-in module info from the fake ctf.ko module and
passing it to ctf_dump.

But it is 2021.  We haven't linked CTF into in-tree kernel modules since
UEK4 in 2017 (4.1.12-113, libdtrace-ctf 0.7).  Every tool needed for
this is obsolete, including libdtrace-ctf's ctf_dump; and objdump does
just as good a job of dumping modules as this tool (or, actually, given
that it can't dump raw .ctfa files yet, just as bad a job; but this will
be fixed soon and is easily workable around with a single objcopy call
even now).  Also ctf_module_dump is getting in the way of
representational improvements to the kernel module tracking.

So drop ctf_module_dump.

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


  Commit: 9b8733bbcc873d9092d887af54bcba8a5e0d9396
      https://github.com/oracle/dtrace-utils/commit/9b8733bbcc873d9092d887af54bcba8a5e0d9396
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_module.c
    M libdtrace/dt_open.c

  Log Message:
  -----------
  modules: purge linked-in shared ctf.ko module support

The original design for CTF in DTrace for Linux had all CTF linked into
kernel modules in the .ctf section. This worked fine except that a
lot of CTF has no corresponding module file on disk: built-in modules,
the core kernel, and shared CTF.

So we linked all of those into a fake module named ctf.ko, with
section names akin to .ctf.$MODULE.

This led to a pile of complexity in dt_module, since one ctf.ko,
uniquely among ELF files loaded for CTF, could have multiple dt_modules
associated with it, with section names that were constructed on the fly
and hence needed dynamic allocation.  No less than two new module flags
were needed to track all of this, and it was a perennial source of
rarely-spotted bugs (since out-of-tree modules, in particular, are
rarely tested).

Now that all in-kernel CTF has been stored in vmlinux.ctfa for almost
five years (the last kernel to support the ctf.ko fake module was
4.1-era, and no such ancient kernel has a hope of having good enough BPF
support to work with DTrace) we can rip all this out.

Support for loading shared CTF from anywhere other than vmlinux.ctfa is
removed in the process: the only other source of shared CTF is .ctf in
userspace, and if we ever support that it will be loaded by ctf_open and
we won't need to do anything special at all.

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


  Commit: 4c66cfeeb596795c94fbac7be8606d408c94515e
      https://github.com/oracle/dtrace-utils/commit/4c66cfeeb596795c94fbac7be8606d408c94515e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_htab.c
    M libdtrace/dt_htab.h

  Log Message:
  -----------
  htab: add dt_htab_entries

This returns the number of entries added to the hashtable.

We also fix a bug in the per-bucket entry count (used only by
dt_htab_stats): it was being incremented on addition but never
decremented on removal, even though dt_htab_ops.del had better be an
inverse of dt_htab_ops.add, and nentries was being incremented on
addition -- and we don't have tombstones in the bucket chain list, so
the number of nentries in a bucket really does fall on removal.

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


  Commit: c5b9b89c9f50410eb46d21fee1ec5e1651b5efa9
      https://github.com/oracle/dtrace-utils/commit/c5b9b89c9f50410eb46d21fee1ec5e1651b5efa9
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_htab.c

  Log Message:
  -----------
  htab: have dt_htab_destroy del all the elements

This means that a dt_htab_destroy of a non-empty htab doesn't leak memory
and leave all its former elements full of wild pointers.

Also add some comments to dt_htab_delete given how many mistakes I made
reading it.

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


  Commit: bead3613b9c5e98bdb8a3cf8bebcfc55b60042f6
      https://github.com/oracle/dtrace-utils/commit/bead3613b9c5e98bdb8a3cf8bebcfc55b60042f6
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_consume.c
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  speculations: use a destructor rather than hand-freeing

Combined with the member-destroying ht_htab_destroy in the previous
commit, this lets us do away with the dt_spec_bufs list and just have
the dt_specs_byid hash own its own members.  (We rename that hash
to dt_spec_bufs because that's just a better name.)

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


  Commit: fc0e5e778d45d028422f1402ae7ca8640e4a9ce2
      https://github.com/oracle/dtrace-utils/commit/fc0e5e778d45d028422f1402ae7ca8640e4a9ce2
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_kernel_module.c
    M libdtrace/dt_kernel_module.h
    M libdtrace/libdtrace.ver

  Log Message:
  -----------
  kernpath: delete the dt_kernpath 'public API wrappers'

These were used by the old module dumper as an escape hatch to get
inside libdtrace and use its facilities to locate kernel modules.

Now the old module dumper is dead, we don't need this any more.

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


  Commit: 1b022e4d61e25a5a9cde4019dd37e85c907a07fd
      https://github.com/oracle/dtrace-utils/commit/1b022e4d61e25a5a9cde4019dd37e85c907a07fd
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_kernel_module.c
    M libdtrace/dt_kernel_module.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  htab reduction: kernpath

Replace the special-purpose kernpath hash table with the generic
dt_htab.  This is a simple case which serves as a template for the
more complex ones to follow.

This has very little effect on performance, because even though the htab
is terribly poorly sized, it is sized in the wrong direction: the
kernpath hash only contains out-of-tree modules, and there won't be
hundreds of those.  The main improvement here is in clarity.

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


  Commit: 06ee5547fe940dd45ac0f89709f3f06243b94aea
      https://github.com/oracle/dtrace-utils/commit/06ee5547fe940dd45ac0f89709f3f06243b94aea
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_consume.c
    M libdtrace/dt_htab.c
    M libdtrace/dt_htab.h
    M libdtrace/dt_kernel_module.c

  Log Message:
  -----------
  htab: add an iterator

This commit defines an iterator in the libctf _next style because it's
*so much* nicer to use than the function-calling _iter form:

extern void *dt_htab_next(const dt_htab_t *htab, dt_htab_next_t **it);
extern void dt_htab_next_destroy(dt_htab_next_t *i);

Call dt_htab_next with the htab to iterate over and a dt_htab_next_t
initialized to NULL to allocate an iterator and return the first
element.  Subsequent calls with the allocated iterator will return
further elements from the hash until iteration is complete, at which
time the iterator is freed and reset to NULL, ready for another
iteration cycle.

There are no restrictions whatsoever on what you can do inside iteration
(iterate over other things, iterate over the same thing, fork, longjmp
out of it, etc) except that you should not delete hash entries that the
iterator has not yet returned: if you insert new ones, they may or may
not be returned by this iteration cycle.  If you need to exit early or
longjmp out, dt_htab_next_destroy frees the iterator for you.

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


  Commit: d7b29de37c7385c1458293785788b570ef768bfa
      https://github.com/oracle/dtrace-utils/commit/d7b29de37c7385c1458293785788b570ef768bfa
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_dof.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_pcb.c
    M libdtrace/dt_probe.c
    M libdtrace/dt_program.c
    M libdtrace/dt_provider.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  htab reduction: providers

Providers were stored in fixed-size hash tables and companion
lists.  The fixed-size tables generally were grossly oversized;
with USDT or pid, they were terribly undersized.

Eliminate the lists and replace the hash tables with dt_htab.

We can move to using destructors (allowing deletion of htab elements
without needing a specialized _destroy function, and straightforward
freeing of the dt_provs htab on dtrace_close), but this is a little
troublesome because the dt_provlist is separate from dt_provs, and since
dt_provs element destructors don't have access to a dtp, the destructors
also can't get at the dt_provlist to unchain dt_provs elements that are
being deleted.

We can fix all this by dropping the dt_provlist and replacing it with
dt_htab_next-based iteration over dt_provs. The iteration order is
different, but that's all that changes.

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


  Commit: 7c20540a1d4326227ff92d39a91574aef9c24400
      https://github.com/oracle/dtrace-utils/commit/7c20540a1d4326227ff92d39a91574aef9c24400
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_module.c
    M libdtrace/dt_module.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  htab reduction: modules

This one is nice and simple, just the same as all the others.

We can ditch nmods in favour of dt_htab_entries, but cannot remove the
modlist (because the order of modules matters, so htab iteration cannot
replace it).

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


  Commit: 8151fb850b033e30dad98b6db26a6c22ee5df56a
      https://github.com/oracle/dtrace-utils/commit/8151fb850b033e30dad98b6db26a6c22ee5df56a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M libdtrace/dt_impl.h
    M libdtrace/dt_module.c
    M libdtrace/dt_open.c
    M libdtrace/dt_symtab.c
    M libdtrace/dt_symtab.h

  Log Message:
  -----------
  htab reduction: symtab

The symtab is a major performance sink.  The symtabs in a running DTrace
vary from tiny (most modules) to huge (20,000+ entries in the vmlinux
symtab), but all of them are stuffed into fixed-size htabs of size 211,
leading to hash chains hundreds long.  Combine that with the exponential
explosion of symtab lookups at startup time (something to be fixed in a
later commit), and huge amounts of time get spent traversing bucket
chains on every DTrace startup (and a lot of time doubtless gets wasted
at runtime too).  Symbol lookup is also slow: it does one lookup per
loaded module until it finds the right one.

This is silly: most lookups are done over all modules, and for those
that aren't, we can intern all symbol names into a global
(per-dtrace_hdl) htab and walk matching names until we find one in the
right module (most names are unique across all modules, and for all such
names, as well as for names where we only want the first matching one,
there is no need to walk at all). This requires the storage of a module
back-pointer in the symbol so we can populate the module name in
dtrace_lookup_by_name, but that's easy enough.  We also store the hval
of the name so we don't need to recompute it over and over again, since
it can never change.

We can simplify the dt_symbol a bit, throwing out explicit storage of
the offset pointer and explicit checking of the DT_ST_PACKED flag on
every name lookup, and instead just replace the name pointer in each
symbol with a pointer into the strtab when packing happens.  We still
need to check the packed flag at destroy time to see whether we need to
free the string, but this simplifies all lookups and in particular makes
it easier than it would otherwise be to look up the symbol name when
doing a htab comparison.  Since the dt_htab naturally supports multiple
entries with the same name (returning the first inserted by default,
unless the caller explicitly walks through them, as we do when a symbol
from a specific module is requested) this lets us throw out the entirety
of the dt_symtab_purge complexity: should it turn out to be actually
important (if there are vast numbers of symbols with the same name
in a lot of modules), it's much easier to implement by just walking
the htab links now, just as is done in dt_module_symbol_by_name.

The only extra bit of fragility this adds is that destruction of the
centralized dt_kernsym_t makes all symbol name lookups fail, since we no
longer have any per-symbol hashtabs.  So we add a new dt_module_fini
that ensures that modules are destroyed right after the kernsym hashtab,
so there is no room for any name lookups to sneak in.

Speeds up startup from ~3.8s/invocation to ~0.9s/invocation.  Speeds up
a full test run by about 20 minutes, which is less than I would expect
given that we have a thousand-odd tests: I suspect cache effects or
something. Still, it's faster than it was.

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


  Commit: 8348a36dbcb7944c1020bcc50c09c1bbe7f21396
      https://github.com/oracle/dtrace-utils/commit/8348a36dbcb7944c1020bcc50c09c1bbe7f21396
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M bpf/Build
    A bpf/basename.S
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    M test/unittest/dif/basename.d
    A test/unittest/funcs/tst.basename0.d
    A test/unittest/funcs/tst.basename0.r

  Log Message:
  -----------
  Add support for the basename() action

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


  Commit: 872067151fbcc47116e291c9ebbf0a7d3f3de714
      https://github.com/oracle/dtrace-utils/commit/872067151fbcc47116e291c9ebbf0a7d3f3de714
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M bpf/Build
    A bpf/dirname.S
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    M test/unittest/dif/dirname.d
    A test/unittest/funcs/tst.dirname0.d
    A test/unittest/funcs/tst.dirname0.r

  Log Message:
  -----------
  Add support for the dirname() action

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


  Commit: 3e380b35cbcc09eec89c8b9413c91987516c4986
      https://github.com/oracle/dtrace-utils/commit/3e380b35cbcc09eec89c8b9413c91987516c4986
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M test/unittest/funcs/tst.rand_inter.sh
    M test/unittest/funcs/tst.rand_intra.sh

  Log Message:
  -----------
  Change trigger for rand() test

The tick-* probe is unreliable on some kernels, depending on how
their timers subsystem is configured (CONFIG*_HZ*).  Add a trigger
that generates many ioctl() calls and use a syscall::ioctl:entry
probe instead.

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


  Commit: ed0f9a1560196b292c83966a65f19198ba6145b5
      https://github.com/oracle/dtrace-utils/commit/ed0f9a1560196b292c83966a65f19198ba6145b5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-01 (Wed, 01 Dec 2021)

  Changed paths:
    M bpf/Build
    M bpf/get_tvar.c
    R bpf/map_tvar.c
    R bpf/set_tvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dis.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    A test/unittest/variables/tvar/err.D_OP_INCOMPAT.default_int.d
    A test/unittest/variables/tvar/err.limited_space.d
    A test/unittest/variables/tvar/err.limited_space.r
    A test/unittest/variables/tvar/tst.alignment-array.r
    A test/unittest/variables/tvar/tst.alignment-array.sh
    A test/unittest/variables/tvar/tst.alignment-char.r
    A test/unittest/variables/tvar/tst.alignment-char.sh
    A test/unittest/variables/tvar/tst.alignment-int.r
    A test/unittest/variables/tvar/tst.alignment-int.sh
    A test/unittest/variables/tvar/tst.alignment-long.r
    A test/unittest/variables/tvar/tst.alignment-long.sh
    A test/unittest/variables/tvar/tst.alignment-ptr.r
    A test/unittest/variables/tvar/tst.alignment-ptr.sh
    A test/unittest/variables/tvar/tst.alignment-short.r
    A test/unittest/variables/tvar/tst.alignment-short.sh
    A test/unittest/variables/tvar/tst.alignment-struct-2.r
    A test/unittest/variables/tvar/tst.alignment-struct-2.sh
    A test/unittest/variables/tvar/tst.alignment-struct.r
    A test/unittest/variables/tvar/tst.alignment-struct.sh
    A test/unittest/variables/tvar/tst.default_int.d
    A test/unittest/variables/tvar/tst.init.d
    A test/unittest/variables/tvar/tst.load_before_store.d
    A test/unittest/variables/tvar/tst.load_no_alloc.d
    A test/unittest/variables/tvar/tst.load_no_alloc.r
    A test/unittest/variables/tvar/tst.post_inc_lvar.d
    A test/unittest/variables/tvar/tst.post_inc_lvar.r
    A test/unittest/variables/tvar/tst.pre_inc_lvar.d
    A test/unittest/variables/tvar/tst.pre_inc_lvar.r
    A test/unittest/variables/tvar/tst.store-char.d
    A test/unittest/variables/tvar/tst.store-char.r
    A test/unittest/variables/tvar/tst.store_zero_deletes.d
    A test/unittest/variables/tvar/tst.store_zero_deletes.r
    A test/unittest/variables/tvar/tst.store_zero_nop.d
    A test/unittest/variables/tvar/tst.store_zero_nop.r
    A test/unittest/variables/tvar/tst.str-size.d
    A test/unittest/variables/tvar/tst.str-size.r
    A test/unittest/variables/tvar/tst.struct.d

  Log Message:
  -----------
  Implement TLS variables

Thread-local storage (TLS) variables are a form of dynamic variables in
DTrace.  They are implemented using a global BPF hash map, indexed using
a key value that is derived from the task ID and the variable ID (with
some special magic to handle the idle task that has TID 0 on all CPUs).

Access to the TLS variables is handled through a pre-compiled BPF
function : dt_get_tvar.  It returns the address of the storage location
for the given variable in the current task.  This is used for both load
and store operations.

The dvars BPF map contains an element at key 0 that contains a value of
all zeros.  This is used to initialize new TLS variables.

One test (variables/tvar/err.limited_space.d) is marked XFAIL because
there is no support for reporting drops just yet.

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


  Commit: abc4778aa02625bbd782260d5ac551746e9ce1aa
      https://github.com/oracle/dtrace-utils/commit/abc4778aa02625bbd782260d5ac551746e9ce1aa
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-02 (Thu, 02 Dec 2021)

  Changed paths:
    M bpf/basename.S
    M bpf/dirname.S

  Log Message:
  -----------
  Write 0 rather than '\0' in *.S files

Apparently, when one uses stb in a bpf/*.S file to write a '\0',
one writes a literal '0'.  This problem was not seen until the
basename/dirname patches were combined with
        cf1e9df28b95  Optimize dt_cg_store_val() for string values
Prior to that, we trusted the string-length prefix and truncated the
string before the literal '0'.

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


  Commit: 06b4c6871499b77f6444407abf27216c66e3550c
      https://github.com/oracle/dtrace-utils/commit/06b4c6871499b77f6444407abf27216c66e3550c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-06 (Mon, 06 Dec 2021)

  Changed paths:
    M bpf/Build
    A bpf/strtok.S
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_dlibs.c
    M test/stress/fbtsafety/tst.shortstr.d
    A test/unittest/funcs/strtok/err.D_PROTO_ARG.strtokbaddel.d
    A test/unittest/funcs/strtok/err.D_PROTO_ARG.strtokbaddel.r
    A test/unittest/funcs/strtok/err.D_PROTO_ARG.strtokbadstr.d
    A test/unittest/funcs/strtok/err.D_PROTO_ARG.strtokbadstr.r
    A test/unittest/funcs/strtok/err.D_PROTO_LEN.strtoktoofew.d
    A test/unittest/funcs/strtok/err.D_PROTO_LEN.strtoktoofew.r
    A test/unittest/funcs/strtok/err.D_PROTO_LEN.strtoktoomany.d
    A test/unittest/funcs/strtok/err.D_PROTO_LEN.strtoktoomany.r
    A test/unittest/funcs/strtok/tst.strtok.d
    A test/unittest/funcs/strtok/tst.strtok.r
    A test/unittest/funcs/strtok/tst.strtok2.d
    A test/unittest/funcs/strtok/tst.strtok2.r
    A test/unittest/funcs/strtok/tst.strtok_long.d
    A test/unittest/funcs/strtok/tst.strtok_long.r
    A test/unittest/funcs/strtok/tst.strtok_null.d
    A test/unittest/funcs/strtok/tst.strtok_null.r
    A test/unittest/funcs/strtok/tst.strtok_nulldel.d
    A test/unittest/funcs/strtok/tst.strtok_nulldel.r
    A test/unittest/funcs/strtok/tst.strtok_nullstr.d
    A test/unittest/funcs/strtok/tst.strtok_nullstr.r
    A test/unittest/funcs/strtok/tst.strtok_nullstr2.d
    A test/unittest/funcs/strtok/tst.strtok_nullstr2.r
    A test/unittest/funcs/strtok/tst.strtok_regs.d
    A test/unittest/funcs/strtok/tst.strtok_regs.r
    R test/unittest/funcs/tst.strtok.d
    R test/unittest/funcs/tst.strtok.r
    R test/unittest/funcs/tst.strtok_null.d
    R test/unittest/funcs/tst.strtok_null.r

  Log Message:
  -----------
  Add support for strtok() subroutine

Internal state holds a copy of the string being parsed, along with an
offset where in the string the next strtok(NULL, ...) call should start.
This state cannot overlap the scratch memory used for stack() calls.

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


  Commit: 269b70c6283515186fd493d43e025fac9f70bc38
      https://github.com/oracle/dtrace-utils/commit/269b70c6283515186fd493d43e025fac9f70bc38
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-07 (Tue, 07 Dec 2021)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/codegen/tst.tstring_free.d
    A test/unittest/codegen/tst.tstring_free.r

  Log Message:
  -----------
  Add tstring free test

Commit cd179d39f759
("Ensure proper validation checks are done before freeing a tstring")
was supposed to have included a test.  Add it.

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


  Commit: 9da1009684461c27c229f43a245d83966d48c1d7
      https://github.com/oracle/dtrace-utils/commit/9da1009684461c27c229f43a245d83966d48c1d7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

  Changed paths:
    M test/unittest/actions/raise/tst.sigdefs.sh

  Log Message:
  -----------
  Remove dependency on bits/signum.h from test

The actions/raise/tst.sigdefs.sh test was explicitly referring to the
bits/generic-signum.h and bits/signum.h header files.  This same info
is found by including signal.h which is the preferred way.  Also, newer
glibc versions no longer have bits/signum.h.

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: d2a29b06d1b9a3abc8a79844c92c2b6d124a30c2
      https://github.com/oracle/dtrace-utils/commit/d2a29b06d1b9a3abc8a79844c92c2b6d124a30c2
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-08 (Wed, 08 Dec 2021)

  Changed paths:
    M NEWS
    M dtrace.spec

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

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


  Commit: 8046dc71fac48c2c9f6100cbd9a6d7ac7a57963a
      https://github.com/oracle/dtrace-utils/commit/8046dc71fac48c2c9f6100cbd9a6d7ac7a57963a
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Fix type of default key when creating BPF maps

The default key (0) used to populate various BPF maps was declared as
uint32_t. but the 'dvars' BPF map uses a uint64_t key.  Since we know
that the value of the key will always be 0, it is safe to just make it
uint64_t for all maps, and have it be interpreted as uint32_t for the
maps that use a smaller key size.

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


  Commit: 810b20f9d8414759d7f3a68ffc54a79e7d863323
      https://github.com/oracle/dtrace-utils/commit/810b20f9d8414759d7f3a68ffc54a79e7d863323
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M test/unittest/variables/tvar/tst.store-char.d

  Log Message:
  -----------
  Adjust dynvarsize to avoid hitting BPF size limits

The number of entries in the dvars BPF map is calculated as the
dynvarsize divided by the size of the value type, which is 1.  It
turns out that there is a limit on the number of entries and this
test hits that limit.

This patch sets dynvarsize to 1024 to force a lower limit so that
this issue is not triggered anymore.

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


  Commit: 107cbf35d55a32821d47dc925d10fd21825a0ed4
      https://github.com/oracle/dtrace-utils/commit/107cbf35d55a32821d47dc925d10fd21825a0ed4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2021-12-09 (Thu, 09 Dec 2021)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Move free(%r0) in stack() actions

We should free BPF_REG_0 as soon as it has been used for the last
time and before calling dt_cg_probe_error().

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


  Commit: 37364e931131e55f86df6ba2a7fecdbc71fd0bd0
      https://github.com/oracle/dtrace-utils/commit/37364e931131e55f86df6ba2a7fecdbc71fd0bd0
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-12 (Sun, 12 Dec 2021)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Fix %r0 register leak

The dt_cg_load_var() function was not properly freeing the %r0 register
for by-ref loads.  This caused a spill/fill pair to be generated for the
dt_cg_check_notnull() invocation.

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


  Commit: 978f2c0a4fba50849b43e6c0771b292927d6a22c
      https://github.com/oracle/dtrace-utils/commit/978f2c0a4fba50849b43e6c0771b292927d6a22c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-13 (Mon, 13 Dec 2021)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Avoid checking for NULL pointers multiple times

The dt_cg_load_var() function included a check to see that a loaded
pointer value was not NULL (and to generate a probe error if it was).
However, callers of this function are already checking for NULL before
using the pointer (if such a check is necessary).  Therefore, this
does not need to be done in dt_cg_load_var().

The dt_cg_load_var() function was also creating two labels that were
only actually used in one branch.  Eugene Loh also pointed out that a
MOV instruction could be saved here.

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


  Commit: 94f82db2210b5d09fc1e361267885dd0f68d7788
      https://github.com/oracle/dtrace-utils/commit/94f82db2210b5d09fc1e361267885dd0f68d7788
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-12-14 (Tue, 14 Dec 2021)

  Changed paths:
    M test/unittest/sdt/tst.args.d

  Log Message:
  -----------
  Ensure that sdt/tst.args.d filters on pid correctly

The logic in this test was flawed, and would occasionally allow kernel
threads to be reported, causing test failures.  We now explicitly use
a predicate on the data generating clause to ensure that arg0 matches
pid.

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


  Commit: 1abff1c5b564a2d711af9cdeea015d66cb15b66b
      https://github.com/oracle/dtrace-utils/commit/1abff1c5b564a2d711af9cdeea015d66cb15b66b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-01-31 (Mon, 31 Jan 2022)

  Changed paths:
    M libdtrace/dt_map.c

  Log Message:
  -----------
  Check dt_rec_add() alignment is reasonable

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


  Commit: 266560f55185ceb46ead7e746b729cdac045e609
      https://github.com/oracle/dtrace-utils/commit/266560f55185ceb46ead7e746b729cdac045e609
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-02-02 (Wed, 02 Feb 2022)

  Changed paths:
    M test/unittest/consumer/tst.symbols.c

  Log Message:
  -----------
  test: Fix tst.symbols.c

Skip symbols (e.g., ftrace_trampoline) in module __builtin__ftrace
since we cannot load the module ELF.

Fix the check for duplicate symbols in the "lookup by name" test.
Specifically, we were checking for duplicates when dtrace_lookup_by_name()
failed.  Check for duplicates when that function succeeds.  This fix
is necessitated by commit 8151fb85 "htab reduction: symtab", which
makes it hard for us to know which duplicate will be chosen.

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


  Commit: a89753cc6df118b27d100ff93b4706c990578ebe
      https://github.com/oracle/dtrace-utils/commit/a89753cc6df118b27d100ff93b4706c990578ebe
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M libdtrace/procfs.d.in

  Log Message:
  -----------
  translators: support 5.16

The cpu member has moved back out of task_struct
to signal_struct (which it moved from in 4.9).

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


  Commit: 2215f77df4cccfcdd49cf6f04bd9a1eb13a61bd2
      https://github.com/oracle/dtrace-utils/commit/2215f77df4cccfcdd49cf6f04bd9a1eb13a61bd2
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M test/unittest/noresolve/test.x
    M test/unittest/pid/test.x
    M test/unittest/stack/tst.stack_fbt.x

  Log Message:
  -----------
  test: use more reliable way of finding kernel versions

In several places we were using cut and/or awk to find kernel versions:
in each case the code used worked for versions like 5.15 or 5.11.4 but
failed for things like 5.15+ or 5.15-00024-g679b45e057b4-dirty,
because they are splitting fields on dots alone.

The rarely-used and little-known grep -o can do all of this more simply
and reliably, since it can split fields using full regular expressions
(and thus can easily be told that what we are looking for here is a run
of digits only).

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


  Commit: e85272726650f7f9dfad543378c96658db55c310
      https://github.com/oracle/dtrace-utils/commit/e85272726650f7f9dfad543378c96658db55c310
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M README.md

  Log Message:
  -----------
  README revisions

Mention the toolchain CTF system, deprecate libdtrace-ctf,
mention newer kernels, mention the kernel git trees much
higher up, don't mention wireshark and libpcap.

Not sure if it's syntactically valid markdown :( the internal hyperlinks
don't seem to point to anything, but maybe Github creates them for us.
If it does, I'm not sure if I got their names right...

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


  Commit: c51554270b4930189d3fa0e856f738969d60dceb
      https://github.com/oracle/dtrace-utils/commit/c51554270b4930189d3fa0e856f738969d60dceb
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/variables/tvar/tst.dis-ann.r
    A test/unittest/variables/tvar/tst.dis-ann.sh

  Log Message:
  -----------
  Fix annotation for dt_get_tvar()

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


  Commit: 5c25b725f6f6f25700e8d0fe82009751542d0d73
      https://github.com/oracle/dtrace-utils/commit/5c25b725f6f6f25700e8d0fe82009751542d0d73
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/actions/trace/tst.array.d
    A test/unittest/actions/trace/tst.array.r
    A test/unittest/actions/trace/tst.array.r.p
    A test/unittest/actions/trace/tst.struct-1-byte.d
    A test/unittest/actions/trace/tst.struct-1-byte.r
    A test/unittest/actions/trace/tst.struct.d
    A test/unittest/actions/trace/tst.struct.r
    A test/unittest/actions/trace/tst.union.d
    A test/unittest/actions/trace/tst.union.r

  Log Message:
  -----------
  Add support for array/struct/union to trace()

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


  Commit: 7f40cd2b649aa4a2fd1c4905eb62e2ee8da1db1e
      https://github.com/oracle/dtrace-utils/commit/7f40cd2b649aa4a2fd1c4905eb62e2ee8da1db1e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M bpf/get_bvar.c
    M bpf/probe_error.c
    M bpf/probe_error.h
    M bpf/speculation.c

  Log Message:
  -----------
  Pass dctx as a const struct to BPF functions.

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


  Commit: e04248378e3a7183ae3cb1c18eb508857d3008ec
      https://github.com/oracle/dtrace-utils/commit/e04248378e3a7183ae3cb1c18eb508857d3008ec
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M bpf/strlen.c
    M bpf/substr.S
    M include/bpf-lib.h
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    A test/unittest/funcs/strlen/err.D_PROTO_ARG.non_string.d
    A test/unittest/funcs/strlen/err.D_PROTO_LEN.missing_arg.d
    A test/unittest/funcs/strlen/err.D_PROTO_LEN.too_many_args.d
    A test/unittest/funcs/strlen/tst.basic.d
    A test/unittest/funcs/strlen/tst.basic.r
    A test/unittest/funcs/strlen/tst.capped-sizw.d
    A test/unittest/funcs/strlen/tst.empty.d
    A test/unittest/funcs/strlen/tst.null.d
    A test/unittest/funcs/strlen/tst.null.r
    R test/unittest/strlen/tst.strlen1.d

  Log Message:
  -----------
  Implement strlen() based on bpf_probe_read_str()

The bpf_probe_read_str() BPF helper returns the number of characters
it copies (incl. the terminating NUL byte), up to the maximum number
passed as one of the arguments.  This can be used to determine the
length of a string.

This new strlen() implementation makes use of the unused space at the
end of the string constant table, which is sized so that it can
contain the largest string possible.

The implementation of substr() is adjusted to reflect this change as
well.  Rather than calling the strlen() function, it uses the BPF
helper directly.

This patch also introduces tests for the strlen() function.

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


  Commit: f0b8973a16f7fe5a2b882ce8ab1de60799cc2655
      https://github.com/oracle/dtrace-utils/commit/f0b8973a16f7fe5a2b882ce8ab1de60799cc2655
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_printf.c
    M test/unittest/codegen/tst.str_const_length.r
    M test/unittest/codegen/tst.str_data_size.r
    M test/unittest/codegen/tst.str_store_var.r
    M test/unittest/funcs/strjoin/tst.strjoin-bordercases.r
    M test/unittest/funcs/strjoin/tst.strjoin-capped-size-2.r
    M test/unittest/funcs/strjoin/tst.strjoin-capped-size-3.r
    M test/unittest/funcs/strjoin/tst.strjoin-capped-size.r
    M test/unittest/funcs/substr/tst.substr-stored-len.r
    M test/unittest/funcs/substr/tst.substr-strsize.r

  Log Message:
  -----------
  Store strings in the trace output buffer without length prefixes

There is no need to store string length prefixes in the output buffer.

This change affects various tests that explicitly compare the raw bytes
in the output buffer for strings.

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


  Commit: ddf1f4991c4b92892a4344b07439309f78bd1faf
      https://github.com/oracle/dtrace-utils/commit/ddf1f4991c4b92892a4344b07439309f78bd1faf
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Perform string constant truncation without using string length prefix

The string constant truncation processing was reading the string length
from the 2-byte prefix.  The new approach uses strlen() on the string
data.

This patch prepares for the removal of the string length prefix support.

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


  Commit: 29e3f4222a3bd2b4f675d8df345353d52ff8dc2e
      https://github.com/oracle/dtrace-utils/commit/29e3f4222a3bd2b4f675d8df345353d52ff8dc2e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M bpf/basename.S
    M bpf/dirname.S
    M bpf/index.S
    M bpf/lltostr.S
    M bpf/rindex.S
    M bpf/strchr.S
    M bpf/strcmp.S
    M bpf/strjoin.S
    M bpf/strlen.c
    M bpf/strrchr.S
    M bpf/strtok.S
    M bpf/substr.S
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_ident.c
    M libdtrace/dt_string.c
    M libdtrace/dt_string.h
    M libdtrace/dt_strtab.c
    M libdtrace/dt_subr.c
    M test/unittest/variables/gvar/tst.undecl-offset.r

  Log Message:
  -----------
  Remove the string length prefix

This is the final stage of discontinuing the string length prefix code.
It removes the actual storage allocation for the 2-byte string length
prefix, and updates all code that adjusted pointers because of the
prefix.  The dt_strlen_store() function is gone.

This change affects the offset calculation for variab;e storage when a
string is involved.  Test results for gvar/tst.undecl-offset.r are
updated to reflect this.

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


  Commit: c165d73e7d12e04fcdf65a093de4ba98aa7f17b5
      https://github.com/oracle/dtrace-utils/commit/c165d73e7d12e04fcdf65a093de4ba98aa7f17b5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M bpf/get_bvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_state.h
    M test/demo/builtin/execname.d
    M test/unittest/variables/bvar/tst.execname.d
    A test/unittest/variables/bvar/tst.execname.r

  Log Message:
  -----------
  Add support for built-in variable execname

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: ae197a869637282abd6905f8fa08dba76d6f61c1
      https://github.com/oracle/dtrace-utils/commit/ae197a869637282abd6905f8fa08dba76d6f61c1
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M libdtrace/dt_dis.h

  Log Message:
  -----------
  Remove the long-orphaned DT_DISASM macro

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


  Commit: e3ee3a6300bbac58e601d679d46afb01558b4873
      https://github.com/oracle/dtrace-utils/commit/e3ee3a6300bbac58e601d679d46afb01558b4873
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    M libdtrace/dt_dis.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  Set the disasm default symbolically

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


  Commit: 2e1b5daedf3a947891f25aac8919fc0974e1fb71
      https://github.com/oracle/dtrace-utils/commit/2e1b5daedf3a947891f25aac8919fc0974e1fb71
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-02-08 (Tue, 08 Feb 2022)

  Changed paths:
    A test/unittest/dtrace-util/tst.DisOption.sh

  Log Message:
  -----------
  Add a test of disassembly modes

Check that:

x  disassembly of all modes in one run is the same
   as what the various modes report individually

x  the default mode is correct

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


  Commit: 44ed8c9d4fd49b999969df9bd30a7a22e6e0ef11
      https://github.com/oracle/dtrace-utils/commit/44ed8c9d4fd49b999969df9bd30a7a22e6e0ef11
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-03-17 (Thu, 17 Mar 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Reunite dt_cg_subr_speculation() and its comment

When patch 5f8c4107a "Add support for index() subroutine"
was applied, somehow the new function dt_cg_subr_index() was inserted
between dt_cg_subr_speculation() and the comment block describing (and
immediately preceding) it.  Subsequent patches only increased the
separation.  Move the comment block back to the function.

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


  Commit: 3750d711ef7638392228113e39b1d485cd429348
      https://github.com/oracle/dtrace-utils/commit/3750d711ef7638392228113e39b1d485cd429348
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_as.c
    M libdtrace/dt_dlibs.c

  Log Message:
  -----------
  Remove list of pre-populated BPF function symbols

The list of pre-defined BPF function symbols is no longer needed because
it gets populated by loading the BPF dlib.

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


  Commit: 82b12dc9c0f0af0777275904928afe560cecb357
      https://github.com/oracle/dtrace-utils/commit/82b12dc9c0f0af0777275904928afe560cecb357
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h

  Log Message:
  -----------
  Consolidate offset and size calculations for dctx->mem content

Rather than duplicating expressions that calculate offsets and sizes of
components of the dctx->mem content, express them using macros.

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


  Commit: 745419911555185d1c1b53f834c36bd0ae0f70bf
      https://github.com/oracle/dtrace-utils/commit/745419911555185d1c1b53f834c36bd0ae0f70bf
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/disasm/tst.ann-strconst.r
    A test/unittest/disasm/tst.ann-strconst.sh

  Log Message:
  -----------
  Add disassembler annotations for string constants

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


  Commit: a4cc12dd463b69586bb1bd7a5a984fa7e56da08b
      https://github.com/oracle/dtrace-utils/commit/a4cc12dd463b69586bb1bd7a5a984fa7e56da08b
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    A test/unittest/variables/tvar/tst.init-str.d

  Log Message:
  -----------
  Add test for default value of string type TLS variables

The default value of any unknown TLS variable is 0.  This means that
a TLS variable of type string will contain NULL.  This test verifies
that by detecting the invalid address fault on address 0x0.

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


  Commit: d3a0d87d5dafca396e4a911970d51d93acf90423
      https://github.com/oracle/dtrace-utils/commit/d3a0d87d5dafca396e4a911970d51d93acf90423
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_prov_dtrace.c
    M test/unittest/codegen/tst.stack_layout.r

  Log Message:
  -----------
  Fix stack offsets for clause functions

Clause functions were reserving space on the stack for the DTrace
context even though they only store a pointer to the DTrace context
that is stored on the stack of the trampoline program.  This wasted
64 bytes (out of 512 bytes that are available).

This patch also provides some reworking of how reference is made to
members of dctx on the stack.  Both trampolines and functions now use
[reg + offset].

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


  Commit: 137a1f42cd13867d0521a24f12f4bcd6e8a1aa51
      https://github.com/oracle/dtrace-utils/commit/137a1f42cd13867d0521a24f12f4bcd6e8a1aa51
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  Reflect that the dvars map is not just for TLS variable storage

The 'dvars' BPF map is used for all dynamic variable storage.  While TLS
variables are currently the only implemented type of dynamic variables,
associative array elements will use this same storage area once they are
fully implemented.

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


  Commit: f56058acb46badb7f2221f9b4ee089e92eb65584
      https://github.com/oracle/dtrace-utils/commit/f56058acb46badb7f2221f9b4ee089e92eb65584
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Partial revert of 279d7fe8

Commit 279d7fe8 ("Handle @-type and ... for function arglists.") was a
bit too broad, causing arglists used for tuples to not update the index
in the identifier type list.

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


  Commit: 530dc8761c59b88151440642d245c85eeb9f24dc
      https://github.com/oracle/dtrace-utils/commit/530dc8761c59b88151440642d245c85eeb9f24dc
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M bpf/Build
    A bpf/get_dvar.c
    R bpf/get_tvar.c

  Log Message:
  -----------
  Refactor get_tvar() into generic components

The TLS variable support function get_tvar() contained the machinery for
accessing a dynamic variable.  This is now refactored to make the TLS
key calculation and the dynamic variable retrieval separate functions so
they can be used in the associative array implementation.

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


  Commit: 6dadee65e05299edfca52eaf6fd1e1760a98cce5
      https://github.com/oracle/dtrace-utils/commit/6dadee65e05299edfca52eaf6fd1e1760a98cce5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_prov_dtrace.c
    M test/unittest/codegen/tst.stack_layout.r
    M test/utils/print-stack-layout.c

  Log Message:
  -----------
  Add macro to access stack slots past the register spill area

The DT_TRAMP_SP(n) macro has been renamed to DT_TRAMP_SP_SLOT(n) for
consistency with the new DT_STK_SP_SLOT(n) macro.  DT_STK_SP is new
and refers to the location of a "stack pointer" that holds the address
of a DT_STK_SP_SLOT.

This patch also removes the SCRATCH_* macros because they are obsolete.

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


  Commit: a01c3b83e6a2734d031a4bd30167446c0db0df74
      https://github.com/oracle/dtrace-utils/commit/a01c3b83e6a2734d031a4bd30167446c0db0df74
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_as.c

  Log Message:
  -----------
  Add reloc support for the add immediate instruction

This patch also reworks a somewhat ugly compound conditional statement
into a switch statement.

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


  Commit: 465823c609a398e91ac11d95a815d2784d2e0af4
      https://github.com/oracle/dtrace-utils/commit/465823c609a398e91ac11d95a815d2784d2e0af4
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_strtab.c

  Log Message:
  -----------
  Remove remnants of length prefix code in strtab handling

The removed code was introduced in commit aa9b7058a ("Store strings in
the string table with varint length prefix") and commit 99719da90
("Transition from variable-length string size to 2-byte string size").

It involved unnecessary copying of string data and also caused string
comparison to be broken once length prefixes were removed in commit
29e3f422 ("Remove the string length prefix")..

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


  Commit: 8d80e9adc367220288c40d5e07e17fe37746cc39
      https://github.com/oracle/dtrace-utils/commit/8d80e9adc367220288c40d5e07e17fe37746cc39
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_cc.c
    A test/unittest/disasm/tst.ann-strconst-strtab.r
    A test/unittest/disasm/tst.ann-strconst-strtab.sh

  Log Message:
  -----------
  Fix DIFO strtab handling

Incorrect handling of the DIFO strtab caused DIFOs to have string
constant tables that were missing items.  This caused annotations to
report incorrect strings.

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


  Commit: 6bd24a5c95b075af4b038448cb038592161ea876
      https://github.com/oracle/dtrace-utils/commit/6bd24a5c95b075af4b038448cb038592161ea876
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M bpf/substr.S
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Reduce register pressure in substr()

Have substr() return the result string pointer.  This means that we can
delay allocating the register to hold the result until after the call to
dt_substr() has been made.

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


  Commit: db993e51fec575b803ee179c6afffb607a87010e
      https://github.com/oracle/dtrace-utils/commit/db993e51fec575b803ee179c6afffb607a87010e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_parser.c

  Log Message:
  -----------
  Remove dn_reg assignment in dt_node_tstring()

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


  Commit: 14b45a5740b379d83323edfa83ed0638c3e8f246
      https://github.com/oracle/dtrace-utils/commit/14b45a5740b379d83323edfa83ed0638c3e8f246
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-18 (Fri, 18 Mar 2022)

  Changed paths:
    M libdtrace/dt_regset.c

  Log Message:
  -----------
  Exclude %r0 from automatic register allocation

The %r0 register is used as a scratch register in various parts of the
code generator and should therefore not be among the registers that can
be allocated when dt_regset_alloc() is called.

This patch also offers a minor improvement in the regset debugging
output, reporting in-use registers by number rather than with a 'x'
in the register list.

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


  Commit: 6b6f736ff8eabc8117137854e4044ae10c583264
      https://github.com/oracle/dtrace-utils/commit/6b6f736ff8eabc8117137854e4044ae10c583264
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-21 (Mon, 21 Mar 2022)

  Changed paths:
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_handle.c
    M runtest.sh
    M test/demo/dtrace/error.r
    M test/unittest/assocs/tst.cpyarray.d
    M test/unittest/assocs/tst.invalidref.r
    M test/unittest/assocs/tst.misc.d
    M test/unittest/drops/drp.DTRACEDROP_DBLERROR.r
    M test/unittest/error/tst.DTRACEFLT_BADADDR.d
    M test/unittest/error/tst.DTRACEFLT_BADADDR.null_ptr_field.d
    M test/unittest/error/tst.DTRACEFLT_BADADDR.null_ptr_field.r
    M test/unittest/error/tst.DTRACEFLT_BADADDR.r
    M test/unittest/error/tst.DTRACEFLT_BADADDR2.r
    M test/unittest/error/tst.DTRACEFLT_DIVZERO.div.d
    M test/unittest/error/tst.DTRACEFLT_DIVZERO.div.r
    M test/unittest/error/tst.DTRACEFLT_DIVZERO.mod.d
    M test/unittest/error/tst.DTRACEFLT_DIVZERO.mod.r
    M test/unittest/error/tst.DTRACEFLT_UNKNOWN.r
    M test/unittest/error/tst.clause_scope-begin-ended.r
    M test/unittest/error/tst.clause_scope-begin.r
    M test/unittest/error/tst.clause_scope-regular.r
    M test/unittest/error/tst.error.r
    M test/unittest/error/tst.errorend.r
    A test/unittest/error/tst.fault-location.sh
    M test/unittest/funcs/err.badbcopy6.r
    M test/unittest/funcs/strlen/tst.null.r
    M test/unittest/funcs/strtok/tst.strtok_null.r
    M test/unittest/funcs/strtok/tst.strtok_nulldel.r
    M test/unittest/funcs/strtok/tst.strtok_nullstr.r
    M test/unittest/funcs/strtok/tst.strtok_nullstr2.r
    M test/unittest/funcs/substr/err.substr_null_arg1.r
    M test/unittest/regression/tst.DTRACEFLT_BADADDR.d_path.r

  Log Message:
  -----------
  Include PC in fault reporting

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


  Commit: 1dec5842c010fc0a4cc25987839bf231652b901f
      https://github.com/oracle/dtrace-utils/commit/1dec5842c010fc0a4cc25987839bf231652b901f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-21 (Mon, 21 Mar 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/disasm/tst.ann-reg-spill.r
    A test/unittest/disasm/tst.ann-reg-spill.sh

  Log Message:
  -----------
  Add disassembler annotations for register spills

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


  Commit: f93a39593e941973e06706c2739a30374cc8f916
      https://github.com/oracle/dtrace-utils/commit/f93a39593e941973e06706c2739a30374cc8f916
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M bpf/get_dvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_impl.h
    M test/demo/dtrace/begin.d
    A test/unittest/assocs/err.limited_space.d
    A test/unittest/assocs/err.limited_space.r
    M test/unittest/assocs/err.tupoflow.d
    M test/unittest/assocs/err.tupoflow.r
    A test/unittest/assocs/tst.clean-tuple.d
    M test/unittest/assocs/tst.cpyarray.d
    A test/unittest/assocs/tst.gvar-postdec.d
    A test/unittest/assocs/tst.gvar-postinc.d
    A test/unittest/assocs/tst.gvar-predec.d
    A test/unittest/assocs/tst.gvar-preinc.d
    A test/unittest/assocs/tst.init-str.d
    A test/unittest/assocs/tst.init.d
    M test/unittest/assocs/tst.misc.d
    A test/unittest/assocs/tst.nested.d
    A test/unittest/assocs/tst.nested.r
    A test/unittest/assocs/tst.nested2.d
    A test/unittest/assocs/tst.nested2.r
    M test/unittest/assocs/tst.orthogonality.d
    A test/unittest/assocs/tst.store_zero_deletes.d
    A test/unittest/assocs/tst.store_zero_deletes.r
    A test/unittest/assocs/tst.tvar-postdec.d
    A test/unittest/assocs/tst.tvar-postinc.d
    A test/unittest/assocs/tst.tvar-predec.d
    A test/unittest/assocs/tst.tvar-preinc.d

  Log Message:
  -----------
  Implement associative array support

Associative arrays (global or TLS) are variables that are indexed with
a tuple (one or more values).  The underlying storage is provided by
the dvars (dynamic variables) BPF hash map.  Since dvars elements are
indexed using a unique 64-bit ID, and given that it provides storage
for both regular TLS variables and associate array elements, the
algorithms to calculate the ID are designed to provide orthogonal
value ranges.

1. Thread-local storage (TLS) variables: self->a
        dvar key = TLS key (highest bit = 0)
2. Global associative array elements: a[tuple]
        dvar key = &tuples[var id, tuple, 0] (highest bit = 1)
3. TLS associative array elements: self->a[tuple]
        dvar key = &tuples[var id, tuple, TLS key] (highest bit = 1)

Given that the TLS key can never be 0, uniqueness of the dvar key is
guaranteed in this scheme.

A new BPF hash map (tuples) associates the concatenation of the tuple
values as key with the address of the hash map element (which is
guaranteed to be unique).  Since BPF maps are allocated in kernel space,
these addresses will always have high order bit 1.

To ensure uniqueness between global associate array elements and TLS
associate array elements, and to ensure uniqueness between elements
with the same tuple index in different arrays, the key in the tuples
map is determined based on a rewritten tuple:

    [ variable ID, original tuple values, TLS variable key or 0 ]

While variable IDs are not unique between variable kinds, the final
component in the rewritten tuple is the TLS variable key (for TLS
associative arrays - never 0) or 0 (for global associative arrays).

Various new tests are added to exercise the new functionality.

Running out of dynamic variable space is not being reported as a drop
yet due to lack of drop counter support.  It generates an error
instead, and therefore the test for the drop reporting remains XFAIL.

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


  Commit: 9574434662d0458802af012086fcaa7bbe507e7f
      https://github.com/oracle/dtrace-utils/commit/9574434662d0458802af012086fcaa7bbe507e7f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M test/demo/intro/rwtime.d
    M test/unittest/arrays/tst.basic1.d
    M test/unittest/arrays/tst.basic2.d
    M test/unittest/arrays/tst.basic3.d
    M test/unittest/arrays/tst.basic4.d
    M test/unittest/arrays/tst.basic5.d
    M test/unittest/arrays/tst.basic6.d
    M test/unittest/dtrace-util/tst.InvalidModule4.sh
    M test/unittest/funcs/tst.basename.d
    M test/unittest/funcs/tst.hton.d
    M test/unittest/scalars/tst.selfarray.d
    M test/unittest/sizeof/tst.SizeofString1.d
    M test/unittest/struct/tst.StructAssoc.d
    M test/unittest/union/tst.UnionAssoc.d

  Log Message:
  -----------
  Remove @@xfail markers from tests that should pass with assoc support

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


  Commit: 4db19fd74403f3594fbe81a3bc3cf7e5a29b74e1
      https://github.com/oracle/dtrace-utils/commit/4db19fd74403f3594fbe81a3bc3cf7e5a29b74e1
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/disasm/tst.ann-gvar-assoc.r
    A test/unittest/disasm/tst.ann-gvar-assoc.sh
    A test/unittest/disasm/tst.ann-tvar-assoc.r
    A test/unittest/disasm/tst.ann-tvar-assoc.sh

  Log Message:
  -----------
  Add disassembler annotations for assoc arrays

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


  Commit: 8839c6b7ffa2b54ea54af5844b651700fa999e02
      https://github.com/oracle/dtrace-utils/commit/8839c6b7ffa2b54ea54af5844b651700fa999e02
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Improve and unify dt_cg_prearith() and dt_cg_postarith()

Combine dt_cg_prearith() and dt_cg_postarith() into a single function
given how much functionality they share.  The implementation is now
evaluating the child node as an lvalue, to be used to load the original
value and also to store the new value.  Associative arrays and TLS
variables are a special case because they will yield a NULL lvalue if
the variable was never assigned to (or if 0 was assigned to it).  In
that case, we use dt_cg_store_var() to store the new value.

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


  Commit: 14bd8601912229c986bfb498cca3b55eb57413b9
      https://github.com/oracle/dtrace-utils/commit/14bd8601912229c986bfb498cca3b55eb57413b9
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-03-22 (Tue, 22 Mar 2022)

  Changed paths:
    M test/unittest/arrays/tst.basic6.d

  Log Message:
  -----------
  Reduce strsize to avoid BPF hash map key size limitations

Some older kernels impose a limitations on the key size for BPF hash
maps based on the maximum BPF stack size.  That limitation was lifted
before the 5.4 kernel series but the verifier kept imposing it until
the 5.12 kernel series.

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


  Commit: c9390536d3673c12e361249c60b98fbae665fb64
      https://github.com/oracle/dtrace-utils/commit/c9390536d3673c12e361249c60b98fbae665fb64
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    A test/unittest/disasm/tst.ann-js-neg.r
    A test/unittest/disasm/tst.ann-js-neg.sh

  Log Message:
  -----------
  Show signed values for signed immediate conditional branches

The disassembler will now print negative values correctly in signed
conditional branch instructions with an immediate operand.

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


  Commit: 31bbe75756d0794950ebc801df304934628bd197
      https://github.com/oracle/dtrace-utils/commit/31bbe75756d0794950ebc801df304934628bd197
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

  Changed paths:
    M libdtrace/dt_handle.c

  Log Message:
  -----------
  Do not report an address value for BADADDR faults with illval -1

This patch allows code to pass -1 as illval to a BADADDR fault to
surpress reporting an address.

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


  Commit: 9489c3b106fd2510b6bb51ef3d58b959a954bbaf
      https://github.com/oracle/dtrace-utils/commit/9489c3b106fd2510b6bb51ef3d58b959a954bbaf
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-08 (Fri, 08 Apr 2022)

  Changed paths:
    M bpf/strlen.c

  Log Message:
  -----------
  Ensure that strlen() returns a value >= 0

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


  Commit: a37f2d018f9b7b8b36b63f53746822dd6023e6cf
      https://github.com/oracle/dtrace-utils/commit/a37f2d018f9b7b8b36b63f53746822dd6023e6cf
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_errtags.h
    M libdtrace/dt_ident.c
    M libdtrace/dt_ident.h
    M libdtrace/dt_open.c
    M libdtrace/dt_parser.c
    M libdtrace/dt_parser.h
    M libdtrace/dt_pcb.h

  Log Message:
  -----------
  alloca: track alloca()ed allocations

This introduces a DT_IDFLG_ALLOCA flag which, when set, will (in future
commits) cause dereferences to bounds-check alloca scratch-space offsets
against the scratch top and boost the offsets into actual pointers into
scratch memory.  There is a matching parse tree node flag DT_NF_ALLOCA
which indicates that a parse tree node has been influenced by an
alloca'ed value.  There is also a DT_IDFLG_NONALLOCA flag which
indicates that an assignment happened that did *not* involve an
alloca()ed value: this will be used to prevent reuse of the same
variable for both alloca() and non-alloca() purposes.  The node flag
propagates across most operations (but not dereferences, because
dereferencing a pointer yields a value, which should not have its offset
adjusted).  One function's identifier has this flag set by default:
obviously enough, alloca().  (Other functions that always return
alloca()ed pointers, or pointers into alloca()ed space, should do the
same.)

Propagating this is fairly amusing, because not only do we have to
handle propagation of these flags both to and from parse tree nodes and
identifiers (because you can do things like "foo = alloca(10); bar =
foo;") and across casts, but we have to handle cases like identifiers
with alloca'ed vars in their arglists (which will become relevant when
indexed associative arrays appear), ternaries in which one side is
allocaed and the other side isn't (which flips on a similarly-propagated
DT_NF_NONASSIGN flag to stop you using such things in assignments), and
the same possibility of changes sweeping backwards and forwards between
the predicate and the clause that already has to be handled for ++,
which can require the two to be cooked in either order and to be cooked
repeatedly (yes, you can alloca in a predicate, and you can use
alloca'ed memory in a predicate).

A few things are newly banned that were allowed before: in particular,
you can't say bar : -alloca(10). It makes little sense to negate a
pointer anyway, but this pointer's eventual representation as a
bounds-checked offset from the scratchmem array makes it even less
sensible.  You also cannot add or subtract pointers where one is
allocaed and the other is not, nor (as noted above) assign the results
of a partly-allocaed ternary to a variable.

The parser dn_flags is boosted to a ushort because we have run out of
flags :(

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


  Commit: 137225d200a2b4225cb1e5c3daaaea72844f7888
      https://github.com/oracle/dtrace-utils/commit/137225d200a2b4225cb1e5c3daaaea72844f7888
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: fault improvements

Do not use regset allocation in dt_cg_probe_error on the grounds that
spilling to the stack is pointless when the regs will all be thrown away
in any case, and will trigger BPF verifier errors if some of the regs
are not initialized, as is relatively likely in an error condition.

Also add an argument specifying whether the illegal value is actually
a register whose value should be printed.  (Cases which don't care
can just pass DT_ISIMM, 0).

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


  Commit: 4414e8c16e7aa49fc11a20354f261bf31464a10e
      https://github.com/oracle/dtrace-utils/commit/4414e8c16e7aa49fc11a20354f261bf31464a10e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M include/dtrace/faults_defines.h
    M libdtrace/dt_error.c
    M libdtrace/dt_handle.c

  Log Message:
  -----------
  alloca: new bad-size fault

We'll use DTRACEFLT_BADSIZE to distinguish in error messages between
out-of-bounds errors in bcopy and the like, and size-too-large errors.
(Without this, it's hard to tell if a, say, 0x12 in the fault value
is a nearly-NULL pointer or a wrong size.)

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


  Commit: b4c6e441f4e2bee6ab08853629f80a596762cec6
      https://github.com/oracle/dtrace-utils/commit/b4c6e441f4e2bee6ab08853629f80a596762cec6
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M include/dtrace/options_defines.h
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dctx.h
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_open.c
    M libdtrace/dt_options.c

  Log Message:
  -----------
  alloca: add alloca() itself

We add a new scratchsize option (default value an arbitrary 256), and a
new scratchmem dctx pointer.  We allocate twice as much space as we
asked for (only half of which is usable), because the verifier can only
use the values of variables to adjust its bounds in very limited
conditions: so we leave enough space to write the full size of scratch
space to the last byte of scratch space without overflow.  (Runtime
checks will prohibit such things, but the verifier doesn't know about
those.)

The top of currently-allocated scratch space is indicated via a single
new 8-byte-aligned value in the machine state, DMST_SCRATCH_TOP.  It is
reset to 0 before each clause is invoked.

alloca itself is fairly pedestrian given all that.  The size check is
fairly trivial: the only fiddly bit is the alignment (thanks to Kris Van
Hees for that).

Overly large allocations are unconditionally refused via a compile-time
error, before even generating any code, preventing the verifier from
concluding that too-large allocations can't succeed and therefore
the success branch in the alloca size check is unreachable code.

alloca'ed pointers are not yet terribly usable at this stage: you can't
dereference them because they are not map_values, just arbitrary
scalars.  Thus there are no tests yet either.

(One new test fails temporarily:
test/unittest/codegen/tst.stack_layout.sh.  It needs adjusting for the
new dmst variables, but we still have more to add in later commits.)

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


  Commit: 020c85fb67f6ef97787b3e5026d6adebc4d64f9f
      https://github.com/oracle/dtrace-utils/commit/020c85fb67f6ef97787b3e5026d6adebc4d64f9f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_parser.c
    M test/unittest/dif/alloca.d
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.ternary.d
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.ternary.r
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.var-clash-non-first.d
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.var-clash-non-first.r
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.var-clash.d
    A test/unittest/funcs/alloca/err.D_ALLOCA_INCOMPAT.var-clash.r
    A test/unittest/funcs/alloca/err.alloca-crossing-clauses.d
    A test/unittest/funcs/alloca/err.alloca-crossing-clauses.r
    A test/unittest/funcs/alloca/err.alloca-load-before-bottom.d
    A test/unittest/funcs/alloca/err.alloca-load-before-bottom.r
    A test/unittest/funcs/alloca/err.alloca-load-beyond-top.d
    A test/unittest/funcs/alloca/err.alloca-load-beyond-top.r
    A test/unittest/funcs/alloca/err.alloca-load-crossing-bottom.d
    A test/unittest/funcs/alloca/err.alloca-load-crossing-bottom.r
    A test/unittest/funcs/alloca/err.alloca-null-deref-lvalue.d
    A test/unittest/funcs/alloca/err.alloca-null-deref-lvalue.r
    A test/unittest/funcs/alloca/err.alloca-null-deref.d
    A test/unittest/funcs/alloca/err.alloca-null-deref.r
    A test/unittest/funcs/alloca/err.alloca-store-before-bottom.d
    A test/unittest/funcs/alloca/err.alloca-store-before-bottom.r
    A test/unittest/funcs/alloca/err.alloca-store-beyond-top.d
    A test/unittest/funcs/alloca/err.alloca-store-beyond-top.r
    A test/unittest/funcs/alloca/err.alloca-store-crossing-bottom.d
    A test/unittest/funcs/alloca/err.alloca-store-crossing-bottom.r
    A test/unittest/funcs/alloca/tst.alloca-alignment.d
    A test/unittest/funcs/alloca/tst.alloca-crossing-clauses.d
    A test/unittest/funcs/alloca/tst.alloca-overtainting.sh
    A test/unittest/funcs/alloca/tst.alloca-store-load-aliasing-arith-bottom.d
    A test/unittest/funcs/alloca/tst.alloca-store-load-aliasing-arith-bottom.r
    A test/unittest/funcs/alloca/tst.alloca-store-load-aliasing-arith.d
    A test/unittest/funcs/alloca/tst.alloca-store-load-bottom.d
    A test/unittest/funcs/alloca/tst.alloca-store-load-idx-1.d
    A test/unittest/funcs/alloca/tst.alloca-store-load-top.d
    A test/unittest/funcs/alloca/tst.alloca0-after-alloca-load.d
    A test/unittest/funcs/alloca/tst.alloca0-after-alloca.d
    A test/unittest/funcs/alloca/tst.alloca0-load.d
    A test/unittest/funcs/alloca/tst.alloca0-values.sh
    A test/unittest/funcs/alloca/tst.alloca0.d
    A test/unittest/funcs/alloca/tst.ternary.d
    A test/unittest/funcs/err.D_ALLOCA_SIZE.big_alloca.d
    A test/unittest/funcs/err.D_ALLOCA_SIZE.big_alloca.r
    A test/unittest/funcs/err.badalloca.r
    A test/unittest/funcs/err.badalloca.r.p
    M test/unittest/funcs/err.badalloca2.d
    M test/unittest/funcs/err.badalloca2.r
    A test/unittest/pointers/err.AllocaOverrun.d
    A test/unittest/pointers/err.AllocaOverrun.r
    M test/unittest/pointers/tst.ValidPointer1.d
    R test/unittest/pointers/tst.ValidPointer2.d
    A test/unittest/predicates/err.D_ALLOCA_INCOMPAT.alloca-postinc-instantiation.d
    A test/unittest/predicates/err.D_ALLOCA_INCOMPAT.alloca-postinc-instantiation.r
    A test/unittest/predicates/tst.alloca-postinc-instantiation.d

  Log Message:
  -----------
  alloca: deref

Dereferencing an alloca() pointer (identified via its parser taint) is a
matter of validating that it is suitably bounded and not null, then
converting it into an actual map_value pointer by adding the scratchmem
base to it.

But this is made a bit more complex because bounds validation involves
not only validation of the address but the access size, and there we
have two distinct sorts of derefs to deal with: non-lvalue derefs, like
*foo, for which the load is done at the time of dereferencing and the
size is known, and lvalue loads, like foo[10]=bar, where the size stored
is not known until after the deref is complete.

For non-lvalue derefs this is quite easy: adjust dt_cg_load so it tells
us the size of load it's generating an op for, and add a bounds check to
the DT_TOK_DEREF case in dt_cg_node.  For lvalue derefs this is
trickier: at DT_TOK_DEREF codegen time we have no idea what size of
store will be carried out, and in fact dt_cg_node generates no code at
all to deref an lvalue store.  The deref is carried out in
dt_cg_store_val, which has to grow a special case for a store to a
writable lvalue node whose child is a deref with the DT_NF_ALLOCA flag
turned on.  (This combination is generated by the compiler for lvalue
stores, so is completely stereotyped and safe to rely on).  When this
case fires we can do a bounds-check just like the one done for reads.

We can also add a lot of tests and flip off XFAIL for a few pre-existing
ones, now that alloca and dereferencing of allocations both work.

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


  Commit: e05eb1d7a33f061ffad881cfd129226aa5918d9d
      https://github.com/oracle/dtrace-utils/commit/e05eb1d7a33f061ffad881cfd129226aa5918d9d
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/alloca/err.alloca-bcopy-before-beyond.d
    A test/unittest/funcs/alloca/err.alloca-bcopy-before-beyond.r
    A test/unittest/funcs/alloca/err.alloca-bcopy-before-bottom.d
    A test/unittest/funcs/alloca/err.alloca-bcopy-before-bottom.r
    A test/unittest/funcs/alloca/err.alloca-bcopy-beyond-top.d
    A test/unittest/funcs/alloca/err.alloca-bcopy-beyond-top.r
    A test/unittest/funcs/alloca/err.alloca-bcopy-crossing-bottom.d
    A test/unittest/funcs/alloca/err.alloca-bcopy-crossing-bottom.r
    A test/unittest/funcs/alloca/err.alloca-bcopy-crossing-top.d
    A test/unittest/funcs/alloca/err.alloca-bcopy-crossing-top.r
    A test/unittest/funcs/alloca/err.alloca-scratch-exceeding-bcopy.d
    A test/unittest/funcs/alloca/err.alloca-scratch-exceeding-bcopy.r
    A test/unittest/funcs/alloca/tst.alloca-bcopy-top.d
    A test/unittest/funcs/alloca/tst.alloca-bcopy-top.r
    A test/unittest/funcs/alloca/tst.alloca-scratch-filling-bcopy.d
    A test/unittest/funcs/err.badbcopy.r
    A test/unittest/funcs/err.badbcopy1.r
    A test/unittest/funcs/err.badbcopy2.r
    A test/unittest/funcs/err.badbcopy3.r
    M test/unittest/funcs/err.badbcopy4.d
    M test/unittest/funcs/err.badbcopy4.r
    M test/unittest/funcs/err.badbcopy5.d
    M test/unittest/funcs/err.badbcopy5.r
    M test/unittest/funcs/err.badbcopy6.d
    M test/unittest/funcs/err.badbcopy6.r
    A test/unittest/funcs/err.badbcopy7.d
    A test/unittest/funcs/err.badbcopy7.r
    A test/unittest/funcs/err.badbcopy8.d
    A test/unittest/funcs/err.badbcopy8.r
    M test/unittest/funcs/tst.bcopy.d

  Log Message:
  -----------
  alloca: bcopy

This is fairly simple given the machinery already present: we just need
to make sure the arguments are suitably alloca-tainted or non-tainted,
then call dt_cg_alloca_access_check on the alloca pointer to bounds
check it, and dt_cg_alloca_ptr to turn it into a real map_value pointer.

Since we validate the destination address completely ourselves, if the
underlying probe_read call fails we can even tell that it's a problem
with the source pointer, and report the failing address appropriately.

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


  Commit: 227d469fc547a38258dc86a9245cbfb114bb118c
      https://github.com/oracle/dtrace-utils/commit/227d469fc547a38258dc86a9245cbfb114bb118c
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

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

  Log Message:
  -----------
  cg: support casts of pointers to integers

When we cast a pointer to an integer, we want to scalarize it,
i.e. ensure that it is no longer a map_value, so that the user can
compare it freely to other integers.

Add a new DMST_SCALARIZER field to the machine state that anyone
can stuff map_values into and pull them right back out of to
scalarize them.

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


  Commit: 543e8225758cfbd622dc1ec135da7d072a3f3fbc
      https://github.com/oracle/dtrace-utils/commit/543e8225758cfbd622dc1ec135da7d072a3f3fbc
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: support null pointers in ternary conditionals

This lets you compare ternaries with NULL without risking a dereference.

(Some of the alloca tests can sometimes do this.)

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


  Commit: 91c20623a3d9019bb94373dd7ca1cde4e2883af6
      https://github.com/oracle/dtrace-utils/commit/91c20623a3d9019bb94373dd7ca1cde4e2883af6
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: move dt_regset_xalloc for consistency

Pack it next to BPF_CALL_FUNC where possible.

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


  Commit: a24181dc606c4a946c8f4f383db21eec209b5088
      https://github.com/oracle/dtrace-utils/commit/a24181dc606c4a946c8f4f383db21eec209b5088
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/alloca/tst.alloca-funcs.d
    A test/unittest/funcs/alloca/tst.alloca-funcs.r
    A test/unittest/funcs/alloca/tst.string-alloca.d
    A test/unittest/funcs/alloca/tst.string-alloca.r

  Log Message:
  -----------
  alloca: allow passing alloca pointers to actions and subrs

A great many subrs and a good few actions allow the passing-in of
pointers (mostly, but not entirely, char *) which may be in alloca()ed
space.  Since they then usually go on to dereference these pointers,
the pointers must be bounds-checked.  We already handled actions
earlier (they don't do formal dereferences except insofar as it
is already done via the deref operator, so we only needed to check
them for nullity); but subrs remain unhandled.

For non-alloca pointers we can just keep on doing null checking; for
alloca pointers, we need to do the usual access_check/ptr dance, with a
length derived from the parser's idea of the length (which is passed
through identifiers accurately).

In addition to subrs, we also need to handle alloca'ed pointers in
codegen for stringof(), since the arg to stringof() might be in
alloca()ed space too.

A new test that tests more or less all of this is added: it has no
expected results because all we actually care about is that there are no
verifier failures.

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


  Commit: 4b8a007f2e46a48f36e8b500cfce57cb09d24422
      https://github.com/oracle/dtrace-utils/commit/4b8a007f2e46a48f36e8b500cfce57cb09d24422
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M test/unittest/stack/tst.stack_fbt.x

  Log Message:
  -----------
  test: Fix incomplete line in .x file

A line in tst.stack_fbt.x had been put back mysteriously chopped off,
causing the script to fail and tst.stack_fbt.d and tst.stack3_fbt.d
to be skipped inadvertently.

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


  Commit: 9cd13c7355d9427edcc1a6bf1908bc852fe95ee7
      https://github.com/oracle/dtrace-utils/commit/9cd13c7355d9427edcc1a6bf1908bc852fe95ee7
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-19 (Tue, 19 Apr 2022)

  Changed paths:
    M test/unittest/dtrace-util/man.ListProbesWithModules
    R test/unittest/dtrace-util/tst.InvalidModule4.r
    R test/unittest/dtrace-util/tst.InvalidModule4.sh
    A test/unittest/dtrace-util/tst.ListProbesModuleClause.r
    A test/unittest/dtrace-util/tst.ListProbesModuleClause.sh
    A test/unittest/dtrace-util/tst.ListProbesModuleEmpty.r
    A test/unittest/dtrace-util/tst.ListProbesModuleEmpty.sh

  Log Message:
  -----------
  test: Fix -lm tests

Test tst.InvalidModule4.sh was introduced as part of the DTrace port to
Linux.  It assumed that including a predicate and clause would invalidate
the module name, but that is not the case.  Rather, the module name was not
recognized in the legacy port simply because the named module did not exist.

This ill-constructed test was XFAIL, but that annotation was lifted in
patch 9574434662d0
"Remove @@xfail markers from tests that should pass with assoc support",
leading to some test failures.  Note that there is no connection between
this test and associative support.

Remove the test.

Add a -lm test for nonexisting names to match corresponding "Empty" tests.

Also add a -lm test to confirm that including a predicate and clause does
not invalidate the module name.

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


  Commit: c92966dc98478ad791378302ae2332a079508e2d
      https://github.com/oracle/dtrace-utils/commit/c92966dc98478ad791378302ae2332a079508e2d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-20 (Wed, 20 Apr 2022)

  Changed paths:
    M test/unittest/actions/exit/tst.kill.sh
    M test/unittest/dtrace-util/tst.ListProbesNameEmpty.sh
    M test/unittest/providers/tst.dtrace_cleanup.sh

  Log Message:
  -----------
  Extend a few test timeouts

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


  Commit: 9f03c5a2e027ed6d9b3c70c244d4fac8d45f7218
      https://github.com/oracle/dtrace-utils/commit/9f03c5a2e027ed6d9b3c70c244d4fac8d45f7218
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M libdtrace/dt_dis.c
    M libdtrace/dt_dis.h

  Log Message:
  -----------
  Add dt_dis_insn() to disassemble a single instruction

Mostly, move BPF ops out of dt_dis_difo(), so that they can
be used for other functions as well.

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


  Commit: ffa26a7235af58f1aa0381355c89e43446aee46a
      https://github.com/oracle/dtrace-utils/commit/ffa26a7235af58f1aa0381355c89e43446aee46a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M test/triggers/Build
    A test/triggers/futex.c
    M test/unittest/fbtprovider/tst.entry.d
    M test/unittest/fbtprovider/tst.entryargs.d
    M test/unittest/fbtprovider/tst.tls.d
    M test/unittest/fbtprovider/tst.tls2.d

  Log Message:
  -----------
  Clean up fbtprovider tests

Specifically, add a futex trigger to the test suite and have tests
match the trigger pid rather than the dtrace pid.

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


  Commit: ff9a0a6724fc1134de4de51775c2fd9a61169b51
      https://github.com/oracle/dtrace-utils/commit/ff9a0a6724fc1134de4de51775c2fd9a61169b51
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M INCOMPATIBILITIES

  Log Message:
  -----------
  Rename members in dtrace_syminfo_t

In patch "6f930f0341a6 Add support for BPF identifiers, functions, and maps"
members of dtrace_syminfo_t were renamed.  Complete the remaining changes,
in INCOMPATIBILITIES.  The required changes in tst.symbols.c are the subject
of another patch.  Note that struct dt_symbol still has a member named
dts_name that does not require renaming.

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


  Commit: 80a539ae86535d681fc54151c8dc38c1b43f4443
      https://github.com/oracle/dtrace-utils/commit/80a539ae86535d681fc54151c8dc38c1b43f4443
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    R test/demo/intro/test.options
    R test/unittest/aggs/test.options
    M test/unittest/aggs/tst.aggmod_full.sh
    M test/unittest/aggs/tst.aggmod_full2.sh
    M test/unittest/aggs/tst.llquantincr.d
    M test/unittest/aggs/tst.llquantize.d
    M test/unittest/aggs/tst.llquantneg.d
    M test/unittest/aggs/tst.llquantstep.d
    M test/unittest/funcs/substr/tst.substrminate.d
    M test/unittest/speculation/tst.SingleCPU.d
    A test/unittest/tick-n/tst.tickquality-100ms.d
    A test/unittest/tick-n/tst.tickquality-10ms.d

  Log Message:
  -----------
  test: Account for unreliable tick firing

As mentioned in commit 3e380b35cbcc "Change trigger for rand() test",
the tick-* probe is unreliable on some kernels, depending on how their
timers subsystem is configured (CONFIG*_HZ*).  Some tests depend on
many probe firings and use tick-* probes.  They are susceptible to
taking unnecessarily long and timing out rather than passing.  Such
intermittent failures have been observed.

Fix tests accordingly.  Specifically, one add bogus-ioctl as a trigger
and then use syscall::ioctl:entry as the probe to fire repeatedly.

For tst.substrminate.d, simply cut down the excessive iteration count.
For the time being, this test XFAILs anyhow.

Add some tick quality-of-service tests to expose the underlying
problem.  For now, mark these tests as "unstable".

Commit
c25036d6f2aa "runtest: automatic reinvocation of specific erratic tests"
introduced the reinvocation of certain failing tests (test/unittest/aggs
and test/demo/intro), though the exact problems are not described.  A
quick survey of some recent test runs indicates that reinvocations are
only used for tests that are fixed with the current patch.  In particular,
reinvocations were observed only for aggs tests with strenuous dependence
on the profile provider.  The demo/intro tests, while not reinvoked in
recent runs, have modest reliance on the profile provider.  If those
tests fail, they can also be reworked.  In short, with the current patch,
remove the reinvocation tags in the test suite.  (The reinvocation
mechanism in runtest.sh can remain untouched for now.)

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


  Commit: 14b51ea1735e2b502cb15491d0b41fb8c36b9db1
      https://github.com/oracle/dtrace-utils/commit/14b51ea1735e2b502cb15491d0b41fb8c36b9db1
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M test/unittest/ustack/tst.ustack_profile.r
    M test/unittest/ustack/tst.ustack_profile.r.p

  Log Message:
  -----------
  test: Detect correct libc "start main" frame depending on glibc version

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


  Commit: ebfecdf55e5704fc34a7eab5e1fc86a7c93ed6b3
      https://github.com/oracle/dtrace-utils/commit/ebfecdf55e5704fc34a7eab5e1fc86a7c93ed6b3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/tst.getmajor.d
    A test/unittest/funcs/tst.getmajor.r
    A test/unittest/funcs/tst.getminor.d
    A test/unittest/funcs/tst.getminor.r

  Log Message:
  -----------
  Add support for getmajor() and getminor() subroutines

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


  Commit: 51494091c05e0c8a47dc9ed9a48f593c1d143610
      https://github.com/oracle/dtrace-utils/commit/51494091c05e0c8a47dc9ed9a48f593c1d143610
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M bpf/Build
    A bpf/progenyof.S
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    R test/unittest/funcs/err.D_FUNC_UNDEF.progenyofbad1.d
    R test/unittest/funcs/err.D_FUNC_UNDEF.progenyofbad1.r
    A test/unittest/funcs/err.D_PROTO_ARG.progenyofbad1.d
    A test/unittest/funcs/err.D_PROTO_ARG.progenyofbad1.r
    A test/unittest/funcs/err.D_PROTO_ARG.progenyofbad2.d
    A test/unittest/funcs/err.D_PROTO_ARG.progenyofbad2.r
    R test/unittest/funcs/err.D_PROTO_LEN.progenyofbad2.d
    R test/unittest/funcs/err.D_PROTO_LEN.progenyofbad2.r
    A test/unittest/funcs/err.D_PROTO_LEN.progenyoftoofew.d
    A test/unittest/funcs/err.D_PROTO_LEN.progenyoftoofew.r
    A test/unittest/funcs/err.D_PROTO_LEN.progenyoftoomany.d
    A test/unittest/funcs/err.D_PROTO_LEN.progenyoftoomany.r
    M test/unittest/funcs/tst.progenyof.d

  Log Message:
  -----------
  Add support for progenyof() subroutine

Also, clean up err*progeny*.d tests.  In particular,

*)  err.D_FUNC_UNDEF.progenyofbad1.d was failing because it had always
    been wrong:  the test was mislabeled.  The test was introduced in patch
        c17a42e11dba "Add the OpenSolaris dtrace testsuite."
    with a .r results file that explicitly indicates D_PROTO_LEN,
    even though the test name expects D_FUNC_UNDEF.  However, runtest.sh
    did not check the error tag.  Though runtest.sh was eventually fixed,
    the test fail was simply dismissed XFAIL.

*)  err.D_PROTO_LEN.progenyofbad2.d was passing, but for reasons unrelated
    to progenyof() or its argument checks.  The test used progenyof(trace())
    and therefore did not test progenyof() at all;  rather, it failed on
    trace(), which is missing its argument.

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


  Commit: 160341afd2116d851e63847c5300065fdacab675
      https://github.com/oracle/dtrace-utils/commit/160341afd2116d851e63847c5300065fdacab675
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M bpf/get_bvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_state.h

  Log Message:
  -----------
  Pass load-time constants to BPF programs in a consistent way

In bpf/, there are .c and .S programs that are cross-compiled at
build time, but they sometimes rely on constants that are not known
until the programs are loaded.  Two ways were being used to provide
those constants.  One was to put them in the state map.  Another was
to set the values during relocation.

Use one consistent method for providing these constants.

Specifically, set the constants during relocation rather than using
the state map:

*)  These constants do not change during execution.

*)  Avoiding a map lookup saves a function call, saving BPF
    instructions, simplifying BPF programming, and reducing
    register pressure.

*)  The constants' values are made known to the BPF verifier.

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


  Commit: 0cccfc6f2648adf6d5a96a83f4e3cf842ffa7ce2
      https://github.com/oracle/dtrace-utils/commit/0cccfc6f2648adf6d5a96a83f4e3cf842ffa7ce2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    A test/unittest/offsetof/err.D_SYNTAX.badmemb.d
    A test/unittest/offsetof/err.D_SYNTAX.badmemb.r
    R test/unittest/offsetof/err.D_UNKNOWN.badmemb.d
    R test/unittest/offsetof/err.D_UNKNOWN.badmemb.r

  Log Message:
  -----------
  test: Fix error tag in test name

A number of err.D_*.d tests had the wrong error tag in the test
name, which escaped detection for a long time because runtest.sh
did not check the error tags.  A number of such cases were fixed.
This appears to be the last case.  The test encounters D_SYNTAX,
both in legacy DTrace on Linux and in the current version.  Rename
the test appropriately.

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


  Commit: 4e5539c98e52152175d47631a56a4aa64b302bef
      https://github.com/oracle/dtrace-utils/commit/4e5539c98e52152175d47631a56a4aa64b302bef
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    R test/unittest/dif/tst.DisSubrNames.sh
    R test/unittest/dif/tst.DisVarNames.r
    R test/unittest/dif/tst.DisVarNames.sh
    A test/unittest/disasm/tst.ann-sub.sh
    A test/unittest/disasm/tst.ann-tvar.r
    A test/unittest/disasm/tst.ann-tvar.sh
    A test/unittest/disasm/tst.ann-var.r
    A test/unittest/disasm/tst.ann-var.sh
    R test/unittest/variables/tvar/tst.dis-ann.r
    R test/unittest/variables/tvar/tst.dis-ann.sh

  Log Message:
  -----------
  test: Consolidate disassembly-annotation tests to new directory

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


  Commit: f72a4ff966dd0b3b122c62f7862fcd61bfcc1ed3
      https://github.com/oracle/dtrace-utils/commit/f72a4ff966dd0b3b122c62f7862fcd61bfcc1ed3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-21 (Thu, 21 Apr 2022)

  Changed paths:
    M bpf/substr.S
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Minor edits

Jump to Lempty for zero-length source strings.  Remove dead code
claiming to reuse register for dnp->dn_reg.

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


  Commit: 192d12cc4db22d6767b2a1f39779aee5b8b58dd7
      https://github.com/oracle/dtrace-utils/commit/192d12cc4db22d6767b2a1f39779aee5b8b58dd7
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M bpf/Build
    A bpf/mutex_owned.S
    A bpf/mutex_owner.S
    A bpf/rw_iswriter.S
    A bpf/rw_read_held.S
    A bpf/rw_write_held.S
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    A test/unittest/funcs/err.D_PROTO_ARG.mtabadarg.d
    A test/unittest/funcs/err.D_PROTO_ARG.mtabadarg.r
    M test/unittest/funcs/err.D_PROTO_LEN.motoofew.d
    A test/unittest/funcs/err.D_PROTO_LEN.motoofew.r
    M test/unittest/funcs/err.D_PROTO_LEN.motoomany.d
    M test/unittest/funcs/err.D_PROTO_LEN.motoomany.r
    R test/unittest/funcs/err.D_PROTO_LEN.mtabadarg.d
    R test/unittest/funcs/err.D_PROTO_LEN.mtabadarg.r
    M test/unittest/funcs/err.D_PROTO_LEN.mtatoofew.d
    A test/unittest/funcs/err.D_PROTO_LEN.mtatoofew.r
    M test/unittest/funcs/err.D_PROTO_LEN.mtatoomany.d
    M test/unittest/funcs/err.D_PROTO_LEN.mtatoomany.r
    M test/unittest/funcs/tst.mutex_owned.d
    M test/unittest/funcs/tst.mutex_owner.d
    M test/unittest/funcs/tst.mutex_type_adaptive.d
    M test/unittest/funcs/tst.mutex_type_spin.d
    A test/unittest/funcs/tst.rw_.r
    A test/unittest/funcs/tst.rw_.sh
    A test/unittest/funcs/tst.rw_.x

  Log Message:
  -----------
  Add support for mutex-related subroutines

Implement the relevant subroutines.  Clean up the tests.

A few tests were broken in ways that were not being detected:
early on because runtest.sh was not checking error tags and later
because the tests were marked XFAIL.  Clean these tests up.

Changes include not using kmutex_t any longer in the tests.  This
type was not recognized even in legacy DTrace.  The documentation
needs a corresponding update.

Similarly, probe lockstat:genunix:mutex_enter:adaptive-acquire was
not recognized, even by legacy DTrace, and it was not needed for the
tests in question.

There were no rw_* tests.  One has been added, but it remains
unclear how stable the test is -- specifically, whether enough
write-lock events are generated.

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


  Commit: bbf2ebd36b8e05d0996583631a6dd95b8871f10a
      https://github.com/oracle/dtrace-utils/commit/bbf2ebd36b8e05d0996583631a6dd95b8871f10a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M test/unittest/dtrace-util/tst.ZeroFunctionProbes.r
    M test/unittest/dtrace-util/tst.ZeroFunctionProbes.sh
    M test/unittest/dtrace-util/tst.ZeroProviderProbes.r
    M test/unittest/dtrace-util/tst.ZeroProviderProbes.sh

  Log Message:
  -----------
  test: Handle concurrent firing probes with exit()

A few tests have profile probes that emit an expected message and then
exit.  The problem with this is that it is possible for two such probes,
on different CPUs, to fire "concurrently."  DTrace says that when exit()
occurs, other actions already in progress on other CPUs complete.

Fix the tests to allow for more than one instance of the expected
message.  Note that this is a race condition.  The problem being fixed
was observed only intermittently.  In some test runs, the failure was
seen only 3% of the time with tst.ZeroProviderProbes.sh and only 0.06%
of the time with tst.ZeroFunctionProbes.sh.

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


  Commit: b27bdde9d6492e7547e2d517a4026a4acccae5f8
      https://github.com/oracle/dtrace-utils/commit/b27bdde9d6492e7547e2d517a4026a4acccae5f8
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Rename subroutine helper (arg to tstring)

When the code generator sets up a call to a precompiled BPF function,
it emits a lot of boilerplate code.  The implementations of DTrace
subroutines typically make such calls.  So there is potential for
much code reuse.

The "path" helper is one such attempt.  Since its usefulness is
broader than just for a "path name" argument, rename this helper to
suggest its broader usage more clearly.

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


  Commit: 42f9bc2e96c9e7d68df694a8599c4a1a3a3e0716
      https://github.com/oracle/dtrace-utils/commit/42f9bc2e96c9e7d68df694a8599c4a1a3a3e0716
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M bpf/lltostr.S
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Change lltostr() to use arg-to-tstring helper

Switch the order of arguments in bpf/lltostr.S to accommodate
this change.

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


  Commit: f424f44b5562143b3250f03465a128aec5692eee
      https://github.com/oracle/dtrace-utils/commit/f424f44b5562143b3250f03465a128aec5692eee
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M bpf/Build
    A bpf/inet_ntoa.S
    M libdtrace/dt_cg.c
    M libdtrace/dt_open.c
    M test/unittest/funcs/tst.inet_ntoa.d

  Log Message:
  -----------
  Add support for inet_ntoa() subroutine

For the time being, there is no definition of ipaddr_t, which
traditionally has been defined in the kernel portion of DTrace.  So
for now, the prototype for the subroutine is not string(ipaddr_t*)
but string(void*) and the test defines ipaddr_t itself.

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


  Commit: 0a9fe35aba6445db2c565519854f244ddeb31f01
      https://github.com/oracle/dtrace-utils/commit/0a9fe35aba6445db2c565519854f244ddeb31f01
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    R test/unittest/buffering/tst.alignring.d

  Log Message:
  -----------
  test: remove tst.alignring.d

This test produces excessive output, writing 100Ks of lines to runtest.log.
It tests nothing, in that the output is not checked.  Also, it targets ring
buffering, which means something entirely different in the current
implementation than it did in Solaris.

Remove the test.

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


  Commit: c62dc0df8b30a7ed145428ab302b5b89bc112b15
      https://github.com/oracle/dtrace-utils/commit/c62dc0df8b30a7ed145428ab302b5b89bc112b15
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M test/unittest/variables/bvar/tst.walltimestamp2.r.p

  Log Message:
  -----------
  test: Allow walltimestamp not to progress on successive calls

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


  Commit: b5540c21afa63bdb6ec2c1c502b9faa80bfdbc50
      https://github.com/oracle/dtrace-utils/commit/b5540c21afa63bdb6ec2c1c502b9faa80bfdbc50
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-22 (Fri, 22 Apr 2022)

  Changed paths:
    M test/unittest/usdt/tst.dlclose1.r
    A test/unittest/usdt/tst.dlclose1.r.p
    M test/unittest/usdt/tst.dlclose1.sh

  Log Message:
  -----------
  test: Improve tst.dlclose1.sh test for USDT probes

This test has been failing on aarch64/OL8 ever since its XFAIL was removed
in 8359ab81fa5e "tests: fix usdt/tst.dlclose1.sh".

That patch changed the problematic bufsize setting in the test, but it
could have removed the unnecessary bufsize setting altogether.

The test was then passing gratuitously.  As expected, it failed to find
USDT probes after the dlclose() call, but the reason was that there were
no USDT probes at all simply because they are not yet supported in DTrace
on BPF.

Meanwhile, the test was failing on aarch64/OL8 because no probes were
firing in the pause() call.

Fix the test so that it first confirms there are USDT probes before the
dlclose() call and second that there are no such probes after the call.

Use a different mechanism to synchronize between user program and test
script given the increased synchronization.

Eliminate the unnecessary bufsize setting.

When checking for USDT probes, make sure they are for the expected
process and not for any other test_prov* (e.g. an orphaned process from
an earlier test run).

Set @@xfail since USDT probes are not yet fully implemented.  (This new
version of the test has been checked on legacy DTrace.)

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


  Commit: beeb93e06f3571f6a150213c4168573f7a88ccd8
      https://github.com/oracle/dtrace-utils/commit/beeb93e06f3571f6a150213c4168573f7a88ccd8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-26 (Tue, 26 Apr 2022)

  Changed paths:
    M NEWS
    M dtrace.spec

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

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


  Commit: 10899c5cadb401cb1b6f78be548c0c05f14a365c
      https://github.com/oracle/dtrace-utils/commit/10899c5cadb401cb1b6f78be548c0c05f14a365c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-04-27 (Wed, 27 Apr 2022)

  Changed paths:
    M cmd/Build
    M test/triggers/Build

  Log Message:
  -----------
  Disable building USDT test triggers due to linker failures

Disable the EXTERNAL_64BIT_SDT_TRIGGERS targets.  Also add run-dtrace
as an explicit dependency for the "all" target so it gets built.  It
is very frequently used for development testing and was previously
created as a dependency for USDT triggers.

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


  Commit: ba7fd1aa6a126f2bd0f05abd2a57444a938610a2
      https://github.com/oracle/dtrace-utils/commit/ba7fd1aa6a126f2bd0f05abd2a57444a938610a2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M test/unittest/ustack/tst.ustack_profile.r.p

  Log Message:
  -----------
  Clean up the post-processing of ustack() frames

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


Compare: https://github.com/oracle/dtrace-utils/compare/ce6bb1ed4631...ba7fd1aa6a12



More information about the DTrace-devel mailing list