[DTrace-devel] [oracle/dtrace-utils] 5c50bc: Eliminate no-longer-needed DT_CG_ALLOCA_NULLPTR wo...

euloh noreply at github.com
Mon Mar 6 16:13:28 UTC 2023


  Branch: refs/heads/2.0-branch-dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 5c50bcd916b3d7d6963d9c917c4f2d61e9a2d24c
      https://github.com/oracle/dtrace-utils/commit/5c50bcd916b3d7d6963d9c917c4f2d61e9a2d24c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-04-29 (Fri, 29 Apr 2022)

  Changed paths:
    M bpf/inet_ntoa.S

  Log Message:
  -----------
  Eliminate no-longer-needed DT_CG_ALLOCA_NULLPTR workaround

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


  Commit: 392a444110cb29d05355f439b3f21f82f5f103c8
      https://github.com/oracle/dtrace-utils/commit/392a444110cb29d05355f439b3f21f82f5f103c8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M libdtrace/dt_parser.c

  Log Message:
  -----------
  Do not set NONALLOCA taint on VAR[IDX]

The logic for setting a NONALLOCA taint on an identifier for stores of
non-alloca, non-literal-0 values in the DT_OP_LBRAC handling in
dt_node_op2() is incorrect.  We are removing it with this patch.
Further analysis is necessary to determine whether it can be applied to
the underlying array variable identifier and how.

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


  Commit: 515b27be1db2a33d59c3827701f98cf6ce4f9256
      https://github.com/oracle/dtrace-utils/commit/515b27be1db2a33d59c3827701f98cf6ce4f9256
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

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

  Log Message:
  -----------
  Make dt_cg_ldsize() available to provider implementations

Code generation for probe program trampolines will need dt_cg_ldsize()
(formetly known as dt_cg_load()) to generate the correct load
instructions when populating the probe argument data.

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


  Commit: 8ceddedbbe8466e732bc40eddfef1ea8a8c5065a
      https://github.com/oracle/dtrace-utils/commit/8ceddedbbe8466e732bc40eddfef1ea8a8c5065a
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M bpf/get_bvar.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dis.c

  Log Message:
  -----------
  Add support for indexed built-in variables lookup

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


  Commit: fb10fadd9dadb8e43b035638f3f0137dc3398508
      https://github.com/oracle/dtrace-utils/commit/fb10fadd9dadb8e43b035638f3f0137dc3398508
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_ident.c
    A test/unittest/disasm/tst.ann-bvar.r
    A test/unittest/disasm/tst.ann-bvar.sh
    A test/unittest/variables/bvar/err.D_ARGS_IDX.args-neg-idx.d
    A test/unittest/variables/bvar/err.D_ARGS_IDX.args-no-args.d
    A test/unittest/variables/bvar/err.D_ARGS_IDX.args-too-many.d
    A test/unittest/variables/bvar/err.D_IDENT_BADREF.args-no-idx.d
    A test/unittest/variables/bvar/err.D_PROTO_ARG.args-non-scalar-idx.d
    A test/unittest/variables/bvar/tst.args-match-argN.d
    R test/unittest/variables/bvar/tst.args.d

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

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


  Commit: 2d1059f979ee7edf65d53ce1012778b5281ab8db
      https://github.com/oracle/dtrace-utils/commit/2d1059f979ee7edf65d53ce1012778b5281ab8db
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M include/dtrace/dif_defines.h
    M libdtrace/dt_dis.c
    M libdtrace/dt_parser.c
    A test/unittest/disasm/tst.vartab-bvar.r
    A test/unittest/disasm/tst.vartab-bvar.sh

  Log Message:
  -----------
  Add disassembler support for dynamic type vars

The args[] built-in variable is a special array where each element has
its own datatype.  The overall datatype is considered the 'dynamic type'
which is expressed as 'any'.

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


  Commit: 28767377460678c2b3b1648f970887c5c93844fd
      https://github.com/oracle/dtrace-utils/commit/28767377460678c2b3b1648f970887c5c93844fd
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

  Changed paths:
    M libdtrace/dt_prov_sdt.c
    M test/unittest/sdt/tst.args.d
    M test/unittest/sdt/tst.args.r

  Log Message:
  -----------
  Populate sdt probe argument data based on argument types

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


  Commit: 48c0305ba8feb53930ee582c2ca66b03d850edf7
      https://github.com/oracle/dtrace-utils/commit/48c0305ba8feb53930ee582c2ca66b03d850edf7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-06-07 (Tue, 07 Jun 2022)

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

  Log Message:
  -----------
  Remove obsolete (dead) code

- Remove old (obsolete) implementation of dt_cg_ldsize()
- Remove old (obsolete) implementation of dtrace_work()

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


  Commit: b2d25b17b16928b5aaa1cc9391915c74d42223a1
      https://github.com/oracle/dtrace-utils/commit/b2d25b17b16928b5aaa1cc9391915c74d42223a1
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-06-16 (Thu, 16 Jun 2022)

  Changed paths:
    M libdtrace/dt_prov_dtrace.c
    M test/unittest/variables/bvar/tst.arg0.d
    M test/unittest/variables/bvar/tst.arg1.d
    M test/unittest/variables/bvar/tst.arg2.d
    M test/unittest/variables/bvar/tst.arg3.d
    M test/unittest/variables/bvar/tst.arg4.d
    M test/unittest/variables/bvar/tst.arg5.d
    M test/unittest/variables/bvar/tst.arg6.d
    M test/unittest/variables/bvar/tst.arg7.d
    M test/unittest/variables/bvar/tst.arg8.d
    M test/unittest/variables/bvar/tst.arg9.d

  Log Message:
  -----------
  Clean up dtrace::: arg handling and testing

Currently, the dtrace provider trampoline sets probe arguments to the
values being passed in some function call.  However:

*)  The BEGIN and END probes have no arguments defined.  This
    point is documented explicitly.  The probe arguments are
    certainly not the arguments passed into internal functions
    BEGIN_probe() and END_probe() -- no such arguments are passed!

*)  The ERROR probe does have defined arguments, but they are
    set up in clause code, not in the trampoline.

Therefore, do not copy probe args in the dtrace-provider trampoline.
Just zero the BEGIN and END probe arguments.

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


  Commit: 2c49a224697f19a40b6253089ed7cfa1f29309d9
      https://github.com/oracle/dtrace-utils/commit/2c49a224697f19a40b6253089ed7cfa1f29309d9
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M libdtrace/dt_prov_syscall.c
    A test/unittest/syscall/tst.return_args.d
    A test/unittest/syscall/tst.return_args.r

  Log Message:
  -----------
  Fix syscall:::return args

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


  Commit: cad6af29be35a136e39d7bc055cfa8e8e9f287db
      https://github.com/oracle/dtrace-utils/commit/cad6af29be35a136e39d7bc055cfa8e8e9f287db
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_pid.c
    M libdtrace/dt_pt_regs.h
    M test/unittest/fbtprovider/tst.return0.d
    A test/unittest/fbtprovider/tst.return0.r
    A test/unittest/fbtprovider/tst.return1.d
    A test/unittest/fbtprovider/tst.return1.r
    M test/unittest/pid/tst.ret1.d
    M test/unittest/pid/tst.ret2.d

  Log Message:
  -----------
  Fix fbt:::return and pid:::return arg1

Meanwhile, set fbt:::return arg0=-1 to indicate we do not know the
real value.

Also, remove the unused PT_REGS_BPF_*().

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


  Commit: c2be27a79d84232b23f62083945269e6030f89a4
      https://github.com/oracle/dtrace-utils/commit/c2be27a79d84232b23f62083945269e6030f89a4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-11 (Mon, 11 Jul 2022)

  Changed paths:
    M libdtrace/dt_dctx.h

  Log Message:
  -----------
  Tidy up a copyright notice

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


  Commit: 2479ce96993197c22b789dd0b4c348dce2d46bb3
      https://github.com/oracle/dtrace-utils/commit/2479ce96993197c22b789dd0b4c348dce2d46bb3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M cmd/Build
    M libdtrace/Build
    M libdtrace/dt_consume.c
    M libdtrace/dt_dis.c
    M libdtrace/dt_handle.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_link.c
    M libdtrace/dt_parser.c
    M libdtrace/dt_pid.c
    M libdtrace/dt_printf.c
    M libdtrace/dt_subr.c
    M libproc/Build
    M uts/common/sys/dtrace_types.h

  Log Message:
  -----------
  Extirpate longlong_t and u_longlong_t from C

These constants have to stay in the D layer (like all the other
obsolescent integral *_t constants, people might be relying on them) but
on the C layer DTrace builds with -std=gnu99, so we can absolutely
guarantee that both long long and unsigned long long already exist (and
the codebase already uses them, and GCC has supported them for many
years longer in any case).

So drop them as redundant.

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


  Commit: 70c8d23565a68a1265983319ead173adcf6abbc3
      https://github.com/oracle/dtrace-utils/commit/70c8d23565a68a1265983319ead173adcf6abbc3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libproc/rtld_db.c

  Log Message:
  -----------
  proc: refactor find_link_maps out of find_l_searchlist

I originally thought I'd be using this in the dl_nns search;
after doing it, it was so much clearer than what was there before that I
left it refactored out even though I ended up not using it in the dl_nns
search after all.

A purely mechanical transformation other than varible-name changes
(because 'loadobj' is a terrible name I've long wanted to change).

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


  Commit: 1274bb28da31c4e5073b846f57ae7a35fa8a5ed1
      https://github.com/oracle/dtrace-utils/commit/1274bb28da31c4e5073b846f57ae7a35fa8a5ed1
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libproc/Pcontrol.h
    M libproc/mkoffsets.sh
    M libproc/rtld_db.c

  Log Message:
  -----------
  libproc: dynamically search for elements of the rtld_global structure

On glibc < 2.35 (with r_version 1), there is no rtld support for
multiple lmids, so rtld_db needs to fish the necessary data directly out
of glibc internal data structures.  However, as with link_map (see
commit d1d38404d44ff000) this is not at all ABI-stable. After many
decades of total stability the struct link_namespaces at the head of
this structure changed repeatedly in the 2.31 -- 2.34 timeframe, mostly
to fix race conditions, and it's an array[DL_NNS] so even small changes
have large consequences for offsets of elements beyond this structure:
so we have to hunt for everything we need in this structure dynamically
(because even elements at the start, like _ns_nloaded, are going to
have the offsets of subsequent elements in the array move around when
struct link_namespaces grows, and elements after that array in
rtld_global will move even more).

This is quite hard to scan for because (unlike find_l_searchlist) we can
rely on hardly anything for verification: the first lmid tells us almost
nothing, since most of the elements we need lie above the point of
change, and subsequent lmids are almost (but not entirely) certain to be
uninitialized and thus all-zero.

But we can cheat!  As the code comments note, the field we are
interested in (dl_nns) immediately follows a pointer in all versions of
glibc we care about: and pointers in struct link_namespace are either
value 0 in uninitialized lmids or huge (definitely greater than value of
DL_NNS, which is a fixed 16 in all supported glibc versions): and the
integral fields therein are also nonzero only when the lmid is
initialized.  If the last lmid is initialized we can't really do
anything: there are lots of fields with a pointer followed by a small
integral value.  But this is massively unlikely: glibc < 2.35 cannot
even start that many lmids without having some of them entirely detached
from libc because of in-glibc TLS consumption overflowing the space
allocated for it, and there is no supported way to start an lmid
detached from glibc. So we can rely on looking for a pair of
pointer-aligned fields satisfying (0, 0 < dl_nns < DL_NNS): the second
such field is the dl_nns.  We can then figure out both the offset of all
the other fields after it by offsetting them from the computed dl_nns
offset, and the size of struct link_namespace (which has no padding
following the structure in any supported glibc version, and glibc relies
on this property); and thus determine both the offsets of fields late in
struct link_namespace and the offsets of fields in nonzero lmids.

Unfortunately because most of these fields (other than dl_nns == 1) only
go nonzero when multiple lmids are in use (which is rare) or when
dlopen() is being called in the child (also rare), we can't really
verify our guesses the way we could for l_searchlist.  The existing
verification that when we look up a symbol in a nonzero lmid it actually
comes from a nonzero lmid will have to do.  This will almost certainly
be good enough, particularly given that all this machinery will be
disabled in favour of documented facilities when the victim is a binary
running against glibc 2.35+.

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


  Commit: be97c241c3a66bef514f8d0c33cf60a2d78468c3
      https://github.com/oracle/dtrace-utils/commit/be97c241c3a66bef514f8d0c33cf60a2d78468c3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  memcpy: error-check

This FIXME is pretty easy to implement.

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: 905a1b699bba0e2be873f7a5cd6b6ccfe2979c7a
      https://github.com/oracle/dtrace-utils/commit/905a1b699bba0e2be873f7a5cd6b6ccfe2979c7a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: comment typo fix

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


  Commit: 4bfeea99b45b9dc9d2599027c5f5c9437e97d3bb
      https://github.com/oracle/dtrace-utils/commit/4bfeea99b45b9dc9d2599027c5f5c9437e97d3bb
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_cc.c

  Log Message:
  -----------
  bpf: don't throw away CTF errors when doing relocations

The first type lookup done after translators are parsed is the set done
to relocate CTF-related offsets.  If something is wrong with the CTF and
the translators are missing, these lookups are likely to fail -- but
since most of these lookups don't set dt_ctferr, the actual error is
discarded and the only thing reported to the user is "unknown CTF
error".  Not even CTF debugging helps.

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


  Commit: fa86bcce583ce0a8efaf49433074005df46bc66b
      https://github.com/oracle/dtrace-utils/commit/fa86bcce583ce0a8efaf49433074005df46bc66b
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  tests: always check expected results as text, not binary

Even if we get \0 in results, we want to see the output, not helpful
"binary files differ" messages.

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


  Commit: d1d4ea8aeb620d344e1d9a61b75c682de938c550
      https://github.com/oracle/dtrace-utils/commit/d1d4ea8aeb620d344e1d9a61b75c682de938c550
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M test/unittest/error/tst.fault-location.sh

  Log Message:
  -----------
  tests: add descriptive comment to fault-location.sh

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


  Commit: d69076cea83af4c4612e9290ea7eea6e78509c7e
      https://github.com/oracle/dtrace-utils/commit/d69076cea83af4c4612e9290ea7eea6e78509c7e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_dlibs.c

  Log Message:
  -----------
  dlibs: improve load-time errors

This corrects errors you get at BPF dlib load time from

dtrace: failed to compile script X: Success

to e.g.

dtrace: failed to compile script X: undefined symbol DTRACEFLT_BADADDR in BPF dlib

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


  Commit: fa9f01031260e2e2c9da1280d4da7e780f7ec880
      https://github.com/oracle/dtrace-utils/commit/fa9f01031260e2e2c9da1280d4da7e780f7ec880
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/procfs.d.in

  Log Message:
  -----------
  translators: procfs.d: rename projid_t

The Linux kernel already has a type named projid_t, with a definition
that conflicts with that in use (for an unused field) by this
translator.  libctf correctly diagnoses this as a conflict (where
libdtrace-ctf didn't): rename the type in the translator.

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


  Commit: 3743a5260e3eee8a65054729185d80c61f6d8594
      https://github.com/oracle/dtrace-utils/commit/3743a5260e3eee8a65054729185d80c61f6d8594
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M runtest.sh
    M test/unittest/providers/tst.dtrace_cleanup.sh

  Log Message:
  -----------
  runtest: pass timeouts down to tests: use it in one test

A few tests implement their own timeouts to let them see whether dtrace
has started up properly.  This is less than ideal when valgrind is in
use, since that routinely causes startup to slow down by an order of
magnitude.  The runtest script adapts the script-wide timeout, but
this is not passed down to tests so they cannot do the same even if
they wanted to.

So pass down $timeout, and adjust one test that spuriously fails.

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


  Commit: 5f9f704080fdd40c35212e92ddaba61dc7a9cf59
      https://github.com/oracle/dtrace-utils/commit/5f9f704080fdd40c35212e92ddaba61dc7a9cf59
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_module.c

  Log Message:
  -----------
  modules: fix can-never-fail comparison

Spotted by GCC 11.

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


  Commit: f861581e658fcfd89585b8e92bc738fdd41b6065
      https://github.com/oracle/dtrace-utils/commit/f861581e658fcfd89585b8e92bc738fdd41b6065
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dtrace.h

  Log Message:
  -----------
  drop obsolete GCC bug workaround

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


  Commit: 3a1181f9ff6c05affb4142682007cc1dd47c0c3c
      https://github.com/oracle/dtrace-utils/commit/3a1181f9ff6c05affb4142682007cc1dd47c0c3c
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M runtest.sh
    A test/unittest/dtrace-util/tst.runopt-e.d
    A test/unittest/dtrace-util/tst.runopt-e.r

  Log Message:
  -----------
  test: allow test options to be set to "-e"

The curse of echo caught us again.  Using printf keeps the -e, but even
then we have to doble-quote the argument because one layer of quotes
will be eaten by the eval, and printf with more args than format string
args reuses the format string over and over again: if it's %s, this
effectively squashes the args together with intervening spaces removed.

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: 63a1ab5c2dfd18bc85d3bfc745cc840582e76267
      https://github.com/oracle/dtrace-utils/commit/63a1ab5c2dfd18bc85d3bfc745cc840582e76267
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M cmd/dtrace.c
    A test/unittest/dtrace-util/err.MultipleNonOptFlags.d

  Log Message:
  -----------
  cmd: fix multiple args after --

The existing options-parsing machinery in cmd/dtrace.c uses getopt
inside a for loop, with the loop governed by optind.  The purpose of
this is opaque to me: the getopt is *already* in a while loop which
won't terminate until the job is done... but if more than one arg is
found after that (say, if argv contains a -- so getopt terminates
early), the next iteration of the loop will call getopt again, which
will *reset* optind and restart parsing.  Because extra arguments are
pasted into g_argv, which is sized suitably for argc to start with, this
leads to an infloop, a rapid buffer overflow, and a segfault.

(This is probably non-exploitable because a) it's dying in main()
itself, which is rather special and b) it never returns.)

The handling of getopt has changed repeatedly in the course of
development. In the Solaris days, the getopt string did not start with
+, so the argument string was permuted and when getopt terminated all
remaining entries were non-options -- but the loop still consumes only
one of them before restarting getopt, so the crash is still present.  in
commit e46e2e15d270aba3f78a904be7a76c8e9fc66c17 in 2010, we switched to
POSIXLY_CORRECT for unclear reasons; this had no obviouspositive
effects, but prevented things like -i 10 20 -n ... from working; we then
switched to using + in the optstring instead, which fixed that but left
this bug still present.

DTrace is not sensitive to the relative order of options and non-options
(only to the relative order of non-options with other non-options), so
we don't need + (or -), and indeed this is harmful because if the inner
loop spots a non-option it emits a usage message (so it relies on getopt
doing permutation of non-options to appear after options, which +
prevents).

Fix by doing what almost everything else that uses getopt does, dropping
the overrun-inducing outer for loop, and doing the storage of trailing
non-option arguments in a subsequent loop after the getopt, relying on
getopt's permutation of argc and setting of optind.

(Redo the other two getopt loops similarly, even though they don't
overrun. Nearly all the diff here is indentation changes.  There is no
code change: they both process only options, so the permutation carried
out by the first getopt has no effect on them.)

Add a test for this.  No other tests are affected.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_parser.c
    M libdtrace/dt_parser.h
    M test/unittest/arrays/tst.ctf-bounds.d
    M test/unittest/arrays/tst.ctf-bounds.oob-cast.d
    M test/unittest/arrays/tst.declared-bounds.oob-cast.d
    M test/unittest/builtinvar/tst.hpriority.d
    M test/unittest/builtinvar/tst.lwpsinfo.d
    M test/unittest/builtinvar/tst.lwpsinfo1.d
    A test/unittest/codegen/tst.kernel_read_deref_indirect_scalar.d
    A test/unittest/codegen/tst.kernel_read_deref_indirect_str.d
    A test/unittest/codegen/tst.kernel_read_deref_struct.d
    A test/unittest/codegen/tst.kernel_read_index_indirect_str.d
    A test/unittest/codegen/tst.kernel_read_indirect_scalar.d
    A test/unittest/codegen/tst.kernel_read_mixed.d
    A test/unittest/codegen/tst.kernel_read_neg_small_scalar.aarch64.x
    A test/unittest/codegen/tst.kernel_read_neg_small_scalar.d
    A test/unittest/codegen/tst.kernel_read_neg_small_scalar.r
    A test/unittest/codegen/tst.kernel_read_scalar.d
    A test/unittest/codegen/tst.kernel_read_scalar_regspill.d
    A test/unittest/codegen/tst.kernel_read_scalar_regspill.r
    A test/unittest/codegen/tst.kernel_read_scalar_regspill.r.p
    A test/unittest/codegen/tst.kernel_read_str.d
    A test/unittest/codegen/tst.kernel_read_str.r.p
    A test/unittest/codegen/tst.read_index_indirect_str.d
    M test/unittest/funcs/tst.bcopy.d
    M test/unittest/inline/tst.InlineTypedef.d
    M test/unittest/lexer/tst.keyword-member.d
    M test/unittest/pointers/tst.ArrayPointer2.d
    M test/unittest/pointers/tst.ArrayPointer3.d
    M test/unittest/pointers/tst.GlobalVar.d
    M test/unittest/pointers/tst.IntegerArithmetic1.d
    M test/unittest/pointers/tst.PointerArithmetic2.d
    M test/unittest/pointers/tst.VoidCast.d
    M test/unittest/pointers/tst.basic1.d
    M test/unittest/printf/tst.str.d
    M test/unittest/sched/tst.var-curcpu.d
    M test/unittest/trace/tst.misc.d
    M test/unittest/translators/tst.TestTransStability.d
    M test/unittest/vars/tst.gid.d

  Log Message:
  -----------
  Support loading scalars from kernel addresses

Data access for non-scalar datatypes was implemented using the
probe_read() BPF helper while scalar datatypes were accessed using
load and store instructions.  When loading scalar data from kernel
addresses, a load instruction cannot be used.  This patch ensures
that such accesses use the probe_read() BPF helper.  (Storing to
kernel addresses is not supported by DTrace so that case does not
need special handling.)

The new dt_cg_load_scalar() function implements the scalar kernel
access.

A new node flag is introduced: DT_NF_DPTR.  It is set for any pointer
that is known to be an internal pointer (i.e. address of a location
in a BPF map managed by DTrace).  Such pointers can be dereferenced
with a load instruction.  All other cases use dt_cg_load_scalar().
The DT_NF_DPTR is propagated across =, +, and -.

Comments and code about DT_NF_USERLAND save/restore across dt_cg_ldsize()
have been removed - they are no longer relevant.

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


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

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Remove obsolete register allocation

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


  Commit: 7fc281025a7a7b1f84c26f01565aca1978f2f0ff
      https://github.com/oracle/dtrace-utils/commit/7fc281025a7a7b1f84c26f01565aca1978f2f0ff
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/alloca/err.alloca-too-large.d

  Log Message:
  -----------
  Fix alloca() non-constant size check

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


  Commit: 9c76750205d928f5aac85e87aaf20ff91177b878
      https://github.com/oracle/dtrace-utils/commit/9c76750205d928f5aac85e87aaf20ff91177b878
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M libdtrace/dt_cc.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dtrace.h
    A test/unittest/options/err.D_PRAGCTL_INVAL.no-cpp.d
    A test/unittest/options/tst.cpp.d

  Log Message:
  -----------
  Fix the -xcpp option

The -xcpp option should be equivalent to the -C option.  The -xcpp
option set DTRACE_C_CPP in the dt_cflags, but the compiler only
ever checked the cflags passed from the command line program for
the DTRACE_C_CPP flag.  As a result, only -C had the intended
behaviour whereas -xcpp was essentially ignored.

When a non-D library script is compiled and the DTRACE_C_CPP flag is
set in dt_cflags, it is also set in the cflags used by the compiler.

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


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

  Changed paths:
    M cmd/dtrace.c
    M libdtrace/dt_cc.c
    M libdtrace/dt_open.c
    M libdtrace/dtrace.h
    M libdtrace/libdtrace.ver
    A test/unittest/options/err.ctfpath.d
    A test/unittest/options/err.ctfpath.r
    A test/unittest/options/tst.ctfpath.r
    A test/unittest/options/tst.ctfpath.sh

  Log Message:
  -----------
  Fix the -xctfpath option

The -xctfpath option was (along with all other options) being processed
after dtrace_open().  But the implementation of dtrace_open() included
the instantiation of providers and probes that triggers the loading of
the CTF archive.  As such, this option had no effect.

Instantiation of providers and probes has been moved to a new function:
dtrace_init().  This function is called after all command line options
have been processed, ensuring that -xctfpath sets the pathname to the
CTF archive before it is loaded.

If the CTF rchive specified with -xctfpath (or the default one) is not
valid, a core dump would result.  Nick Alcock submitted a patch that
solved 70% of that problen by properly checking the return value of
ctf_lookup_by_name() during program linking and flagging EDT_NOCTF if
there is an issue.  This has been incorporated into this patch.

In addition, link failure resulted in the constructed DIFO to be free'd
but upon termination, dtrace was walking the identifier hash and freeing
all DIFO and we ended up freeing the same DIFO twice.  This is fixed here
also.

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


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

  Changed paths:
    M libdtrace/dt_cc.c

  Log Message:
  -----------
  Fix type of variables holding result of ctf_member_info()

The return type of ctf_member_info() is int, but is being assigned to
variables that are declared as ctf_id_t and initialized as CTF_ERR.
The type has been corrected (int), and the initialization is removed
because it is not necessary.

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


  Commit: 380e08c3802be177a5be01a4b59ad172eb5bc2b7
      https://github.com/oracle/dtrace-utils/commit/380e08c3802be177a5be01a4b59ad172eb5bc2b7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cc.c
    A test/unittest/options/tst.S.sh
    A test/unittest/options/tst.verbose.sh

  Log Message:
  -----------
  Fix the -xverbose option

The -xverbose option should be equivalent to the -S option.  The
-xverbose option sets DTRACE_C_DIFV in the dt_cflags, but the compiler
only ever checked the cflags passed from the command line program for
the DTRACE_C_DIFV flag.  As a result, only -S had the intended
behaviour whereas -xverbose was essentially ignored.

Note that -xdisasm=N does not modify the -xverbose behaviour because the
-xverbose option is specifically defined to providw clause disassembly
(equivalent with -S without -xdisasm=N being specified).

When a D script is compiled that is not a library script or the builtin
ERROR probe, and the DTRACE_C_DIFV flag is set in dt_cflags, it is also
set in the cflags used by the compiler.

The support for -xcpp is also updated with this patch to set DTRACE_C_CPP
under the same circumstances.

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


  Commit: 85be8d813526bff01445ef66fa14a420dbda7d55
      https://github.com/oracle/dtrace-utils/commit/85be8d813526bff01445ef66fa14a420dbda7d55
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    R test/unittest/misc/tst.bpflog-cmdline.sh
    R test/unittest/misc/tst.bpflog-pragma.sh
    R test/unittest/misc/tst.bpflogsize-cmdline.sh
    R test/unittest/misc/tst.bpflogsize-pragma.sh
    A test/unittest/options/err.D_ASRELO.kdefs.d
    A test/unittest/options/err.D_ASRELO.kdefs.r
    A test/unittest/options/err.D_EMPTY.errtags.d
    A test/unittest/options/err.D_EMPTY.errtags.r
    A test/unittest/options/err.D_EMPTY.no-empty.d
    A test/unittest/options/err.D_MACRO_UNDEF.no-defaultargs.d
    A test/unittest/options/err.D_MACRO_UNDEF.no-defaultargs.r
    A test/unittest/options/err.D_MACRO_UNDEF.no-defaultargs2.d
    A test/unittest/options/err.D_MACRO_UNDEF.no-defaultargs2.r
    A test/unittest/options/err.D_MACRO_UNUSED.no-argref.d
    A test/unittest/options/err.D_PDESC_ZERO.no-Z-or-zdefs.d
    A test/unittest/options/err.D_PDESC_ZERO.no-Z-or-zdefs.r
    A test/unittest/options/err.b-too-low.d
    A test/unittest/options/err.b-too-low.r
    A test/unittest/options/err.bufsize-too-low.d
    A test/unittest/options/err.bufsize-too-low.r
    A test/unittest/options/err.empty.d
    A test/unittest/options/err.empty.r
    A test/unittest/options/err.no-errtags.d
    A test/unittest/options/err.no-errtags.r
    A test/unittest/options/err.no-w-or-destructive.d
    A test/unittest/options/err.no-w-or-destructive.r
    A test/unittest/options/tst.D.d
    A test/unittest/options/tst.F.d
    A test/unittest/options/tst.F.r
    A test/unittest/options/tst.U.d
    A test/unittest/options/tst.Z.d
    A test/unittest/options/tst.argref.d
    A test/unittest/options/tst.b.d
    A test/unittest/options/tst.bpflog-cmdline.sh
    A test/unittest/options/tst.bpflog-pragma.sh
    A test/unittest/options/tst.bpflogsize-cmdline.sh
    A test/unittest/options/tst.bpflogsize-pragma.sh
    A test/unittest/options/tst.bufsize.d
    A test/unittest/options/tst.core.sh
    A test/unittest/options/tst.cppargs.sh
    A test/unittest/options/tst.cpphdrs.sh
    A test/unittest/options/tst.cpppath.r
    A test/unittest/options/tst.cpppath.sh
    A test/unittest/options/tst.ctypes.sh
    A test/unittest/options/tst.debug.sh
    A test/unittest/options/tst.defaultargs.d
    A test/unittest/options/tst.defaultargs2.d
    A test/unittest/options/tst.define.d
    A test/unittest/options/tst.destructive.d
    A test/unittest/options/tst.dtypes.sh
    A test/unittest/options/tst.flowindent.d
    A test/unittest/options/tst.flowindent.r
    A test/unittest/options/tst.knodefs.sh
    A test/unittest/options/tst.undef.d
    A test/unittest/options/tst.w.d
    A test/unittest/options/tst.zdefs.d

  Log Message:
  -----------
  Add tests for various options and tunables

Tests added for:
    -xargref
    -xbufsize (and -b)
    -xcore
    -xcppargs
    -xcpphdrs
    -xcpppath
    -xctypes
    -xdebug
    -xdefaultargs
    -xdefine (and -D)
    -xdestructive (and -w)
    -xdtypes
    -xempty
    -xerrtags
    -xflowindent (and -F)
    -xkdefs
    -xknodefs
    -xundef (and -U)
    -xzdefs (and -Z)

Tests moved for:
    -xbpflog
    -xbpflogsize

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


  Commit: e100caf321485b11a32a8dcb54624da12ac62c5e
      https://github.com/oracle/dtrace-utils/commit/e100caf321485b11a32a8dcb54624da12ac62c5e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M CODING-STYLE
    R libbpf/Build
    R libbpf/GNUmakefile
    R libbpf/bpf.c
    R libbpf/bpf.h
    R libbpf/bpf_prog_linfo.c
    R libbpf/btf.c
    R libbpf/btf.h
    R libbpf/btf_dump.c
    R libbpf/hashmap.c
    R libbpf/hashmap.h
    R libbpf/include/linux/bpf.h
    R libbpf/include/linux/bpf_common.h
    R libbpf/include/linux/btf.h
    R libbpf/include/linux/compiler-gcc.h
    R libbpf/include/linux/compiler.h
    R libbpf/include/linux/err.h
    R libbpf/include/linux/filter.h
    R libbpf/include/linux/kernel.h
    R libbpf/include/linux/list.h
    R libbpf/include/linux/overflow.h
    R libbpf/include/linux/poison.h
    R libbpf/include/linux/types.h
    R libbpf/include/tools/libc_compat.h
    R libbpf/libbpf.c
    R libbpf/libbpf.h
    R libbpf/libbpf_errno.c
    R libbpf/libbpf_internal.h
    R libbpf/libbpf_probes.c
    R libbpf/netlink.c
    R libbpf/nlattr.c
    R libbpf/nlattr.h
    R libbpf/str_error.c
    R libbpf/str_error.h
    M libdtrace/Build
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h

  Log Message:
  -----------
  Remove libbpf dependency

Use direct bpf() syscalls for map creation and program loading.

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


  Commit: d91f091c4639aeaf7b26ac70e85275a8b45edc09
      https://github.com/oracle/dtrace-utils/commit/d91f091c4639aeaf7b26ac70e85275a8b45edc09
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    A include/linux/bpf.h
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  Add BPF helper mapping

BPF helpers can be very specific to kernel versions, and the set of
available helpers may differ between the system where DTrace was
compiled and the system where it is being used.

We add runtime checking of specific BPF helpers, with support for
possible fallback helpers.  E.g. if probe_read_user() is not found,
we can use probe_read() instead (though that may not guarantee
successful execution).

This can also be used to check whether certain helpers exist.  By
convention, when the BPF helper function id maps to 0 (BPF_FUNC_unspec),
the helper is known not to be supported on the runtime system.

We include bpf.h from a kernel recent enough to support all the BPF
features that DTrace can make use of.

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


  Commit: d97c8fa78cd2f4db8cfca2568cf114bacb41eabb
      https://github.com/oracle/dtrace-utils/commit/d97c8fa78cd2f4db8cfca2568cf114bacb41eabb
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/copyin/err.D_ALLOCA_SIZE.d
    A test/unittest/funcs/copyin/err.D_PROTO_ARG.non_scalar_arg1.d
    A test/unittest/funcs/copyin/err.D_PROTO_ARG.non_scalar_arg2.d
    A test/unittest/funcs/copyin/err.D_PROTO_LEN.missing_arg.d
    A test/unittest/funcs/copyin/err.D_PROTO_LEN.too_few_args.d
    A test/unittest/funcs/copyin/err.D_PROTO_LEN.too_many_args.d
    A test/unittest/funcs/copyin/err.badaddr.d
    A test/unittest/funcs/copyin/err.badaddr.r
    A test/unittest/funcs/copyin/err.badsize.d
    A test/unittest/funcs/copyin/err.null_arg1.d
    A test/unittest/funcs/copyin/err.null_arg1.r
    A test/unittest/funcs/copyin/tst.copyin.d
    A test/unittest/funcs/copyin/tst.copyin.r
    R test/unittest/funcs/tst.copyin.d

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

The copyin() subroutine makes use of the alloca() subroutine to allocate
the needed scratch space to copy data to.

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


  Commit: c26e2e5f279a0fd22c99437666e0483d29aab766
      https://github.com/oracle/dtrace-utils/commit/c26e2e5f279a0fd22c99437666e0483d29aab766
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_alloca_arg3-2.d
    A test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_alloca_arg3.d
    A test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_ptr_arg3.d
    A test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_scalar_arg1.d
    A test/unittest/funcs/copyinto/err.D_PROTO_ARG.non_scalar_arg2.d
    A test/unittest/funcs/copyinto/err.D_PROTO_LEN.missing_arg.d
    A test/unittest/funcs/copyinto/err.D_PROTO_LEN.too_few_args.d
    A test/unittest/funcs/copyinto/err.D_PROTO_LEN.too_many_args.d
    A test/unittest/funcs/copyinto/err.badaddr.d
    A test/unittest/funcs/copyinto/err.badaddr.r
    A test/unittest/funcs/copyinto/err.badsize.d
    A test/unittest/funcs/copyinto/err.badsize.r
    A test/unittest/funcs/copyinto/err.null_arg1.d
    A test/unittest/funcs/copyinto/err.null_arg1.r
    A test/unittest/funcs/copyinto/tst.copyinto.d
    A test/unittest/funcs/copyinto/tst.copyinto.r
    R test/unittest/funcs/tst.copyinto.d

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

The copyinto() subroutine is a near-identical copy of bcopy() other
than that the arguments are ordered differently, and it reads from
userspace addresses rather than kernel addresses.  A new function is
added to implement the shared functionality (dt_cg_subr_bcopy_impl).

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


  Commit: dee44bc6caeeda3f80b6d47eccb6220859452de6
      https://github.com/oracle/dtrace-utils/commit/dee44bc6caeeda3f80b6d47eccb6220859452de6
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/copyinstr/err.D_ALLOCA_SIZE.d
    A test/unittest/funcs/copyinstr/err.D_PROTO_ARG.non_scalar_arg1.d
    A test/unittest/funcs/copyinstr/err.D_PROTO_ARG.non_scalar_arg2.d
    A test/unittest/funcs/copyinstr/err.D_PROTO_LEN.missing_arg.d
    A test/unittest/funcs/copyinstr/err.D_PROTO_LEN.too_many_args.d
    A test/unittest/funcs/copyinstr/err.badaddr.d
    A test/unittest/funcs/copyinstr/err.badaddr.r
    A test/unittest/funcs/copyinstr/err.badsize.d
    A test/unittest/funcs/copyinstr/err.null_arg1.d
    A test/unittest/funcs/copyinstr/err.null_arg1.r
    A test/unittest/funcs/copyinstr/tst.copyinstr-low-maxsize.d
    A test/unittest/funcs/copyinstr/tst.copyinstr-low-maxsize.r
    A test/unittest/funcs/copyinstr/tst.copyinstr-no-maxsize.d
    A test/unittest/funcs/copyinstr/tst.copyinstr-no-maxsize.r
    A test/unittest/funcs/copyinstr/tst.copyinstr.d
    A test/unittest/funcs/copyinstr/tst.copyinstr.r

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

The copyinstr() subroutine is very similar to the copyin() subroutine.
The differences are:
 - the 2nd argument (max size) is optional (default is strsize)
 - if a size is given, it is capped at strsize
 - data is copied using bpf_probe_read_user_str (or bpf_probe_read_str)

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


  Commit: c89eb968b659d819c83187625f89074844a8dfb7
      https://github.com/oracle/dtrace-utils/commit/c89eb968b659d819c83187625f89074844a8dfb7
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/pid/tst.args1.aarch64.x

  Log Message:
  -----------
  Fix copying of pid entry probe args from stack

The pid-provider "entry" probes must access function arguments -- at
first from registers and, if there are many args, then also from the
stack.  We copied these stack locations using the BPF probe_read()
helper function.  Early versions of this function, however, were only
reliable for copying from kernel space.  Apparently, this issue was
irrelevant on x86_64, but caused probe_read() to return an error
code on aarch64 when copying from user space.

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


  Commit: 45da9141da2f59b8b2fbd91cc2e3ee7483b14b28
      https://github.com/oracle/dtrace-utils/commit/45da9141da2f59b8b2fbd91cc2e3ee7483b14b28
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_cc.c

  Log Message:
  -----------
  Initialize variable explicitly

Compilation can otherwise complain with
"‘dp’ may be used uninitialized in this function [-Wmaybe-uninitialized]".
It is easy to eliminate such a sensitivity to compiler.

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


  Commit: 96d4dfeb5353a51fd24cbd837fcc9447512af011
      https://github.com/oracle/dtrace-utils/commit/96d4dfeb5353a51fd24cbd837fcc9447512af011
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  Eliminate obsolete dt_last*

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


  Commit: 0f0c35cda8c6706ba89d68a2ab8be2d9ef91fb95
      https://github.com/oracle/dtrace-utils/commit/0f0c35cda8c6706ba89d68a2ab8be2d9ef91fb95
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M include/dtrace/metadesc.h

  Log Message:
  -----------
  Get rid of obsolete DTRACE_SIZEOF_* macros

These macros were for when records were at the end of the descriptor.
With commit ecbe2271e2bb ("Implementation of the printa() action"),
the array is replaced with a pointer, and the DTRACE_SIZEOF_* macros
become obsolete.  Actually, dtrace_eprobedesc_t no longer even exists.

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


  Commit: 1a9239d0e370797914230f0deb20f762e1253718
      https://github.com/oracle/dtrace-utils/commit/1a9239d0e370797914230f0deb20f762e1253718
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M test/unittest/funcs/tst.rw_.sh

  Log Message:
  -----------
  test: tst.rw_.sh is known to be unstable, tag it so

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


  Commit: bb699e7ec1aaf17088c1d3cd20ea8dbf9c587324
      https://github.com/oracle/dtrace-utils/commit/bb699e7ec1aaf17088c1d3cd20ea8dbf9c587324
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M test/unittest/aggs/tst.clearlquantize.r
    R test/unittest/aggs/tst.clearlquantize.r.p

  Log Message:
  -----------
  test: Make tst.clearlquantize.d more discriminating

This test exercises both aggregation keys and the clear() action.
It has a .r.p postprocessing script that makes it insensitive to
whether clear() actually works.

Remove the .r.p file to simplify the test and make it more stringent.

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


  Commit: 701a02e869ed92a8c8e42c8a9d279b7f7ec1371c
      https://github.com/oracle/dtrace-utils/commit/701a02e869ed92a8c8e42c8a9d279b7f7ec1371c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M test/unittest/aggs/tst.clear.r.p

  Log Message:
  -----------
  test: Fix search string

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


  Commit: 8b989703b4429f358465132c337de935bfe65b12
      https://github.com/oracle/dtrace-utils/commit/8b989703b4429f358465132c337de935bfe65b12
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    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/tst.rand_inter.sh
    M test/unittest/funcs/tst.rand_intra.sh
    M test/unittest/speculation/tst.SingleCPU.d

  Log Message:
  -----------
  test: Fix race condition in many-fire tests

Some tests that expect probes to fire many times had been using tick-*
for this purpose.  Unfortunately, tick-* quality can be poor, depending
on how the kernel is configured.  Therefore, commit 80a539ae8653
("test: Account for unreliable tick firing") addressed this problem
by replacing tick-* probes with syscall::ioctl:entry probes and with
bogus-ioctl as a trigger.

The problem with this solution is that the actions also involved some
global variables.  The ioctl:entry probes could fire on multiple CPUs
concurrently, overwriting each other.  Test runs were erratic.

Add "pid==$target" to the probe predicates.  This includes both the
the tests in the aforementioned patch but also two rand() tests.

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


  Commit: 2474e83e26e4896160fc93ce5fd876be12695e38
      https://github.com/oracle/dtrace-utils/commit/2474e83e26e4896160fc93ce5fd876be12695e38
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

  Changed paths:
    M bpf/get_dvar.c

  Log Message:
  -----------
  Remove extraneous tab

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


  Commit: be2bd546ef321225c9b62e5f3ecf2b91035ccf26
      https://github.com/oracle/dtrace-utils/commit/be2bd546ef321225c9b62e5f3ecf2b91035ccf26
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-28 (Thu, 28 Jul 2022)

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

  Log Message:
  -----------
  Handle high-order bits of rand() properly

The D rand() function is declared to be "int" -- a 4-byte, signed
integer.  Internally, D represents integers as 64-bit quantities.
Therefore, after calling the BPF helper function to get 32 random
bits, we should sign-extend the upper bits.

Meanwhile, the rand_intra test was checking if the uppermost 32 bits
of "x = rand()" were 0.  This makes no sense since x is a signed,
4-byte integer and should be populated with 0xffffffff half of the
time.  The test would fail once x is correctly sign-extended (by a
future patch).  Eliminate the check on the upper bits.

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


  Commit: e437349fc256ad528593b069d3312f26b5d95352
      https://github.com/oracle/dtrace-utils/commit/e437349fc256ad528593b069d3312f26b5d95352
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-07-29 (Fri, 29 Jul 2022)

  Changed paths:
    M libdtrace/dt_parser.c
    A test/unittest/bitfields/tst.bitfield-is-integer.d
    A test/unittest/bitfields/tst.slices.d

  Log Message:
  -----------
  parser: support slices of typedefs, etc

Slices in CTF are almost totally transparent to the user, *except* that
ctf_type_resolve will halt when it encounters a slice and will drill no
further, since going further would lose information about the encoding
of the slice.  Since you can have slices of typedefs, this means you
can't rely on ctf_type_resolve getting rid of all typedefs any more.

This change drills through to base types where necessary.  We have to do
it by hand in every place it's needed, which is fairly unpleasant.  I
think I caught them all (most are covered by the tests added here).  If
we find other places where spurious errors citing bitfields which should
have been treated as integral types appear, we can fix them as they crop
up.

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


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

  Changed paths:
    M include/dtrace/options_defines.h
    M libdtrace/dt_bpf.c
    M libdtrace/dt_open.c
    M libdtrace/dt_options.c
    M libdtrace/dt_work.c
    M runtest.sh
    A test/unittest/misc/tst.lockmem-cmdline.r
    A test/unittest/misc/tst.lockmem-cmdline.sh
    A test/unittest/misc/tst.lockmem-cmdline.x
    A test/unittest/misc/tst.lockmem-envvar.r
    A test/unittest/misc/tst.lockmem-envvar.sh
    A test/unittest/misc/tst.lockmem-envvar.x
    A test/unittest/misc/tst.lockmem-pragma.r
    A test/unittest/misc/tst.lockmem-pragma.sh
    A test/unittest/misc/tst.lockmem-pragma.x
    A test/unittest/misc/tst.lockmem-x.r
    A test/unittest/misc/tst.lockmem-x.sh
    A test/unittest/misc/tst.lockmem-x.x

  Log Message:
  -----------
  Locked-memory limit

Locked memory is needed for BPF operations such as creating maps and
loading programs.  Therefore, dt_vopen() sets RLIMIT_MEMLOCK to 32 Mbytes,
an amount that seems sufficient for many tests in our suite.  On the other
hand, the value is somewhat arbitrary, excessive for many D scripts yet
insufficient for others, including some of our tests.  Further, it is
silently modifying a resource limit.

Remove dt_vopen()'s silent modification of the locked-memory limit.

Explicitly set "ulimit -l" in runtest.sh to accommodate the tests in our
suite.

While users can similarly set "ulimit -l" explicitly, it would be more
convenient if there were alternative mechanisms, especially when using
"sudo dtrace".  Therefore, add a D option lockmem.  Notice that ulimit
allows the value "unlimited" for users who simply want to ignore any limit.

Add some more verbose error messages that explain that encountering
EPERM during BPF map creation or BPF program load may be solved by
adjusting the locked-memory limit.

With UEKR7, the locked-memory limit seems to be ignored for root.

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


  Commit: 173361ff5a3502391bb79dc2099f14c4bc729cba
      https://github.com/oracle/dtrace-utils/commit/173361ff5a3502391bb79dc2099f14c4bc729cba
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-07-29 (Fri, 29 Jul 2022)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: Report unexpected results for unstable tests as xfail

Generally, tests are deterministically expected to pass or xfail.

Some tests fail intermittently, however, and are tagged "unstable".
Either pass or fail is acceptable, but one has to check manually
to see if the test is unstable.

If a test xpasses or fails, then if it is unstable, just report it
as xfail and unstable.

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


  Commit: 7e9ce1eee47540fb1d22c5cf4603de1301ab880b
      https://github.com/oracle/dtrace-utils/commit/7e9ce1eee47540fb1d22c5cf4603de1301ab880b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

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

  Log Message:
  -----------
  Promote integers to 64 bits when loaded

DTrace internally implements integers with 64-bit registers.  This
makes the manipulation of integers of different sizes simpler, by
avoiding a number of typecast operations.  But DTrace has also
loaded integers without promoting them appropriately.  E.g.,
((short)0xffff) has been treated as 0xffff rather than -1.

Promote signed integers to 64 bits when loading (if needed).

Add tests.  Specifically, typecasting should typically not be needed.
Therefore, operations such as x=y and x+y (of different types) should
work properly if integers are correctly represented in 64-bit registers.

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: 9f9931214aff7f4613017dfa2f5912abfcb9cc59
      https://github.com/oracle/dtrace-utils/commit/9f9931214aff7f4613017dfa2f5912abfcb9cc59
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_parser.c
    A test/unittest/arithmetic/tst.cast-exp.d
    A test/unittest/arithmetic/tst.cast-exp.r

  Log Message:
  -----------
  Fix typecast

DTrace internally keeps integers basically in a 64-bit format.  Shorter,
signed integers are already sign-extended.

The current logic makes an error when an integer is extended and the
signedness changes.  It truncates the source and then extends.  E.g.,
consider a 1-byte source and 2-byte destination:

    signed?
    src dst  input  expected  currently

     N   Y    0xff   0x00ff       -1
     Y   N    0xff   0xffff      0xff

Note:

*) In the first case, no casting is even necessary.  If the integer
is being extended and it is unsigned, then higher-order bits can simply
be left alone.

*) In the second case, the signed input is supposed to be sign-extended
before truncating to the new size.  We currently truncate first, at the
smaller size.

Fix.  Add tests.

Notice that:

*) Casting constants like "var = (type) constant" is handled
   in the parser.

*) Casting variables like "var1 = (type) var2" is handled
   in the code generator.

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


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

  Changed paths:
    M test/unittest/aggs/tst.neglquant.d
    M test/unittest/aggs/tst.negquant.d

  Log Message:
  -----------
  test: Need wider variables to hold 1<<63

DTrace has some peculiar -- arguably incorrect -- semantics for
integer types dating back to Solaris.  Consider 1<<63.  Normal C
rules would say this is a 4-byte int whose value is 0.  The DTrace
parser, however, treats it as the 8-byte integer 0x8000000000000000.
Subsequently, D uses the 8-byte value when assigning to an 8-byte
variable.  E.g.,
    long long x;
    x = 1 << 63;
stores 1<<63.  Nevertheless, D treat 1<<63 as a 4-byte expression.
E.g.,
    x = 1 << 63;
    trace(1 << 63);
will use a default 4-byte int for x and trace a 4-byte value of 0.

The tests addressed by this patch expect 8-byte increments but
use default-width int this->val variables.  There is no way a
4-byte int could produce a, say, 9223372036854775801 increment.

Declare this->val to be 8 bytes and properly set it to the intended
values.

The tests will still XFAIL, since support for aggregation keys
is missing.

The D semantics should perhaps be examined further, but this
patch at least fixes these particular tests.

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


  Commit: 69a55492a9461f9bf721fb36d6ca37fe8a723fe9
      https://github.com/oracle/dtrace-utils/commit/69a55492a9461f9bf721fb36d6ca37fe8a723fe9
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    A test/unittest/arithmetic/tst.bug-casting.d
    A test/unittest/arithmetic/tst.bug-casting.r

  Log Message:
  -----------
  test: Add XFAIL placeholder: DTrace internal integer representation

When DTrace performs integer operations, it assumes integers (of
all widths and signedness) are internally represented in 64 bits
and do not need frequent typecasting.  This breaks the documented
behavior.  Recent patches have addressed a number of these problems.

A few problems remain.  Notably, arithmetic operations can change
the sign bit of a narrow integer.  This should result in the high
bits of the 64-bit representation changing.  The DTrace code generator
should typecast appropriately.

Add a placeholder test that XFAILs to indicate that work remains.

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


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

  Changed paths:
    A test/unittest/aggs/tst.goodkey.r
    A test/unittest/aggs/tst.goodkey.r.p

  Log Message:
  -----------
  test: check goodkey results

This test was failing due to lack of support for aggregation keys.
The test was tagged XFAIL.

Support for aggregation keys would cause the test to XPASS.
Unfortunately, the crucial probe action does not even execute since it
depends on vtimestamp, which is not yet implemented.  The XPASS would
be spurious since results were simply not being checked.

Add .r and .r.p files for a sanity check on results.

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


  Commit: 44ee4861045cd822ce28c234297539c4956da4b6
      https://github.com/oracle/dtrace-utils/commit/44ee4861045cd822ce28c234297539c4956da4b6
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M test/unittest/rates/tst.aggrate.d

  Log Message:
  -----------
  test: needs aggrate and agg drop support

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


  Commit: 85a9998446dbeaf31848a924b7d30f12603a867d
      https://github.com/oracle/dtrace-utils/commit/85a9998446dbeaf31848a924b7d30f12603a867d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M test/unittest/actions/printf/err.D_PRINTF_ARG_TYPE.agg.d

  Log Message:
  -----------
  test: Remove XFAIL tag that was messing up a line number

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


  Commit: 7e6f19af53994077a2daa8482515f0231fc6d17a
      https://github.com/oracle/dtrace-utils/commit/7e6f19af53994077a2daa8482515f0231fc6d17a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M include/dtrace/actions_defines.h
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_cc.c
    M libdtrace/dt_printf.c

  Log Message:
  -----------
  Complete the conversion of DTRACEAGG_* enums to DT_AGG_* enums

In commit 85c8512318e3
("Implement the support code for generating aggregation data"),
the enums DT_AGG_* were introduced.

In commit ecbe2271e2bb
("Implementation of the printa() action"),
the DT_AGG_* were rebased to be offset from DTRACEACT_AGGREGATION.

In commit ecbe2271e2bb
("Implementation of the printa() action"),
the older DTRACEAGG_* enums that remained were said to be replaced
by the newer DT_AGG_*.

In fact, however, instances of DTRACEAGG_* remained.  This was an
issue since the enums were defined in different orders, causing
corresponding values such as DT_AGG_QUANTIZE and DTRACEAGG_QUANTIZE
to disagree.  These problems were in code that was not yet active --
e.g., to print two quantize() results for the same aggregation variable
but with different keys.

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


  Commit: 7b443eddcd213e78235fa36d5001ef0e85a569e3
      https://github.com/oracle/dtrace-utils/commit/7b443eddcd213e78235fa36d5001ef0e85a569e3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Clean up BPF map creation in anticipation of more changes

Adding or removing a BPF map to this function requires changes in
different parts of the function.  Reorganize the function slightly
so that adding or removing a BPF map can be done with simpler, more
localized changes.

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


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

  Changed paths:
    M bpf/get_bvar.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_ident.h
    M libdtrace/dt_open.c
    M libdtrace/dt_parser.c
    A test/unittest/arithmetic/tst.cast-alloca.d
    A test/unittest/arithmetic/tst.cast-curcpu.d

  Log Message:
  -----------
  Ensure curcpu values are scalarized when typecast

The 'curcpu' built-in variable is special because its value is a
pointer to a map value.  This means that the verifier will impose
strict limitations on what can be done with that pointer value.
By scalarizing it when it is typecast we ensure that the verifier
will treat the value as a regular scalar.

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


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

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Eliminate an unneeded instance of strsize

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


  Commit: 28261a25e77e00a61e7ea7910ea54bab93b675bb
      https://github.com/oracle/dtrace-utils/commit/28261a25e77e00a61e7ea7910ea54bab93b675bb
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-04 (Thu, 04 Aug 2022)

  Changed paths:
    M include/dtrace/metadesc.h

  Log Message:
  -----------
  Clean up some comments

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


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

  Changed paths:
    R include/arm64/asm/barrier.h
    R include/i386/asm/barrier.h
    R include/linux/compiler-gcc.h
    R include/linux/compiler.h
    R include/linux/ring_buffer.h
    M libdtrace/dt_consume.c

  Log Message:
  -----------
  Simplify the ring buffer consumption loop

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


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

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  Add a block of zeroes to use to initialize BPF maps

There are cases in BPF code where we want to read a contiguous block of
zeroes.  Since the block is read-only, it can be shared among all CPUs and
among multiple purposes to save BPF map space (locked memory).  Create such
a block.

The 'strtab' map is a BPF_MAP_TYPE_ARRAY map that already reserves a block
memory at the end of its value to placate the BPF verifier, so we can just
use that (and enlarge it if needed).

For code generation, we need to know the offset of this region in the
strtab.  The offset cannot be known until after compilation, so the
relocation mechanism is used to patch in its value..

The dt_cg_zerosptr() function should be called to obtain the pointer value
to the memory block of zeros.  It will be stored in the given register.

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: 4f2286e8acf4d2dc936bfb20ef9b3816a568c558
      https://github.com/oracle/dtrace-utils/commit/4f2286e8acf4d2dc936bfb20ef9b3816a568c558
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M bpf/get_dvar.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dis.c
    M test/unittest/disasm/tst.ann-tvar.r
    M test/unittest/disasm/tst.ann-tvar.sh

  Log Message:
  -----------
  Convert dvars to use the default block of zeros

The code sequence for retrieving dynamic variables (TLS variables and
associative arrays) is modified, so the disassembler annotation code is
updated to reflect this.  As a useful side effect, relocation symbols
are now reported for mov and arithmetic intructions as well.

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


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

  Changed paths:
    M libdtrace/Build
    R libdtrace/mknames.sh
    R test/unittest/disasm/tst.ann-sub.sh

  Log Message:
  -----------
  Remove obsolete mknames.sh and related test

The id-to-name mapping in dt_names.c (generated by mknames.sh from a
Build rule) is no longer needed.  We therefore no longer need the test
for it either.

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


  Commit: 59d8f9dd149febea0e8f0d44da4e5620bfae9c48
      https://github.com/oracle/dtrace-utils/commit/59d8f9dd149febea0e8f0d44da4e5620bfae9c48
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

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

  Log Message:
  -----------
  Remove the "default tuple" area

All we need is a bunch of zeroes, which are available from the newly
introduced block of zeroes.  Using that block is better because:

1)  The new block is global, while the older area was per-CPU.
    We only need one copy of this read-only memory.

2)  The new block will be overlapped with other uses of zeroes.

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


  Commit: 2240e0c81b31530841a30e4a4530531237878118
      https://github.com/oracle/dtrace-utils/commit/2240e0c81b31530841a30e4a4530531237878118
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Assemble tuple components at predictable offsets

We concatenate tuple components in the tuple assembly area.  When a
component is a string, we place the following component immediately
after the terminating NUL byte.

We will use this same tuple-assembly code to support aggregation keys,
however, and for printing aggregation keys it would be nice for each
key to start at a predictable offset.  Make that change in dt_cg_arglist().

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


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

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

  Log Message:
  -----------
  Implement dt_bpf_map_next_key()

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


  Commit: 1fe17cc22305a2e2c71a07a316c3b70f384572d2
      https://github.com/oracle/dtrace-utils/commit/1fe17cc22305a2e2c71a07a316c3b70f384572d2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M libdtrace/dt_map.c

  Log Message:
  -----------
  Allow aggid check without having to store agg description

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


  Commit: 397113673a6671ad4ee7571c2826e3fe9426d9e3
      https://github.com/oracle/dtrace-utils/commit/397113673a6671ad4ee7571c2826e3fe9426d9e3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-05 (Fri, 05 Aug 2022)

  Changed paths:
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  Fix obsolete comment regarding agg latch seq number

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


  Commit: 62417688c502a1018300c15af6600cfa00be0087
      https://github.com/oracle/dtrace-utils/commit/62417688c502a1018300c15af6600cfa00be0087
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-09 (Tue, 09 Aug 2022)

  Changed paths:
    M include/dtrace/metadesc.h
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_map.c
    M libdtrace/dt_printf.c
    M libdtrace/dtrace.h

  Log Message:
  -----------
  Move normalization value to aggregation descriptions

This change is being made in anticipation of adding support for
aggregation keys, which create the possibility of an aggregation
appearing many times (with different keys) in dt_aggregate.

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


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

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Improve error checking and reporting for BPF map creation

Eugene Loh found that when BPF creation fails due to too big a map,
E2BIG is returned.  This got reported as "Argument list too long"
(using strerror()).  That is not very helpful.  It will now report
"Too big".

In addition, the key and value sizes are size_t entities in the main
caller (dt_bpf_gmap_create()), while create_map() accepts ints for
these values.  And the maximum number of map entries is an int in
dt_bpf_gmap_create() but is at times calculated based on size_t values.
And the bpf(BPF_MAP_CREATE) syscall expects uint32_t values for all
three.  That is now cleaned up.

The debug output in create_gmap() also got a small modification to no
longer report sizes in the success report since it is already reported
at the beginning of the function.

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


  Commit: 739785f13770b5c1538ea0c53c8a97de4a7a73cc
      https://github.com/oracle/dtrace-utils/commit/739785f13770b5c1538ea0c53c8a97de4a7a73cc
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-25 (Thu, 25 Aug 2022)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_printf.c

  Log Message:
  -----------
  Fix error reporting for agg walk functions

Callback functions for aggregation walkers were not correctly returning
DTRACE_AGGWALK_* values, causing "invalid return value from callback"
errors to be reported rather than the actual error.  This is only seen
when the consumer code has a bug in it (e.g. record description
mismatches).

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


  Commit: 270cc86d22e85c94ba9531302ef159a6fbefdaa5
      https://github.com/oracle/dtrace-utils/commit/270cc86d22e85c94ba9531302ef159a6fbefdaa5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M cmd/dtrace.c
    M include/dtrace/metadesc.h
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_map.c
    M libdtrace/dt_printf.c

  Log Message:
  -----------
  Fix records for aggregation descriptions

The implementation of aggregations erroneously registered the value of
an aggregation as a series of 64-bit values, each with their own record
description.  However, aggregations in their most generic form should
comprise the following records:

(1) variable ID
(2) keys (values of the index tuple, if any)
(3) latch sequence number
(4) aggregation data

(1) and (2) are records that identify the aggregation, whereas (3) and
(4) are data that is generated by the producer.

Change the aggregation record descriptions to match the layout described
above.

Note that the variable ID is now stored as a 32-bit value whereas DTrace
used to store it as a 64-bit value.  This change is valid because the
variable ID is an identifier ID and therefore cannot exceed the range of
a 32-bit integer,

Support for aggregation keys will be added in later patches.

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


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

  Changed paths:
    M libdtrace/dt_aggregate.c

  Log Message:
  -----------
  Clear dt_aggregate each snapshot

The producer (kernel) gathers aggregation data.  The consumer
(user space) snapshots (reads) the kernel data and maintains
its own copy in dt_aggregate.

In legacy DTrace, the consumer would snapshot incremental kernel
data and either initialize or update an entry in dt_aggregate,
depending on whether the corresponding entry already existed.

In the port to BPF, the kernel data is kept in BPF maps that are
up-to-date, not incremental since the last snapshot.  So a second
mechanism was added to decide whether to initialize or update a
dt_aggregate entry:  for the first CPU, even if an entry has been
found, new data is copied (rather than aggregated) in.

When we support aggregation keys, the new mechanism will not help.
It will be possible for a key to appear on some other CPU than
the first.

Nevertheless, we cannot blindly keep re-aggregating data that
is already in dt_aggregate.

Therefore, clear aggregation data in dt_aggregate's hash entries
at each snapshot.  Use dtrace_aggregate_clear() for this purpose.
Note that this function is apparently unused in both legacy DTrace
as well as the port to BPF.  Note also that the function needs to
be corrected to account for for min() and max()

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


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

  Changed paths:
    M include/dtrace/metadesc.h
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_map.c

  Log Message:
  -----------
  Add aggregation description records for aggregation keys

Introduce and use the new dt_aggid_rec_add() function.

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


  Commit: 9fec684c6ef420be1e67e45f4d2a43f3684d3cb8
      https://github.com/oracle/dtrace-utils/commit/9fec684c6ef420be1e67e45f4d2a43f3684d3cb8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M libdtrace/dt_aggregate.c

  Log Message:
  -----------
  Eliminate fun since it is always dt_agg_one_agg now

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


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

  Changed paths:
    M libdtrace/dt_aggregate.c

  Log Message:
  -----------
  Clean up latch sequence number checks

We were checking multiple times whether it was 0.

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


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

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

  Log Message:
  -----------
  Introduce dt_maxaggdsize

We are moving to an implementation in which dt_aggregate tracks varID,
keys, and aggregation data for each aggregation found by the consumer.
For sizing purposes, dt_maxaggdsize will track the maximum size for
any aggregation.

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


  Commit: f7efadce6f6300547e7906209e8c24d91c2bd2bc
      https://github.com/oracle/dtrace-utils/commit/f7efadce6f6300547e7906209e8c24d91c2bd2bc
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M test/stress/buffering/err.resize2.d
    A test/stress/buffering/err.resize2.r

  Log Message:
  -----------
  test: Add results file for err.resize2.d

The err.resize2.d test PASSes.  Since this is an err.* test, that
means that the D script fails.  It fails, however, not because the
aggsize limit was excessive (which is the point of the test) but
simply because there is not yet support for aggregation keys.

Add a .r results file to ensure that if the D script fails,
it fails for the expected reason.

The real point of the test is to check the manual resizing option.
For now, however, we settle for reasonable behavior vis-a-vis
support for aggregation keys.

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


  Commit: 2b71d6e334bbcad51a7d215541470ccbe317b0d4
      https://github.com/oracle/dtrace-utils/commit/2b71d6e334bbcad51a7d215541470ccbe317b0d4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_map.c

  Log Message:
  -----------
  Remove DT_AGG_NUM_COPIES

Originally, the DTrace port to BPF used two copies of aggregations,
to allow lockless access to aggregation data for producer and consumer.

Then DT_AGG_NUM_COPIES was introduced and set to 1 since the consumer
could not mmap BPF maps;  rather, it read data atomically using bpf()
system calls.  The use of twice as much locked memory for aggregations
was not justified.

Eliminate DT_AGG_NUM_COPIES, committing to the single-copy approach
and simplifying the code.

The dual-copy version used a latch sequence number.  It is now simply
a data counter;  importantly, a nonzero value indicates the presence
of data.

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


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

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c

  Log Message:
  -----------
  Allow dt_cg_arglist() to handle the NULL case

Even if an argument is empty, we might want to call dt_cg_arglist() to
construct a pointer to a tuple.

Callers can use the following pseudo-code to accomplish this:

	dt_node_t	noargs = {
				dnp->dn_ctfp,
				dtp->dt_type_void,
			};

	...

	if (dnp->dn_aggtup == NULL)
		dnp->dn_aggtup = &noargs;

	dt_cg_arglist(aid, dnp->dn_aggtup, dlp, drp);

	... <use dnp->dn_aggtup->dn_reg> ...

	if (dnp->aggtup == &noargs)
		dnp->aggtup = NULL;

	... <dnp->dn_aggtup->dn_reg is not used anympre> ...

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


  Commit: 4eed25e694c5a69dfb9971fa866bee3174dd6259
      https://github.com/oracle/dtrace-utils/commit/4eed25e694c5a69dfb9971fa866bee3174dd6259
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Split out gmap creation into their own functions

A lot of BPF maps are created for DTrace.  Rather than creating them all
in one big function, implement them as individual functions.

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


  Commit: 1c4f17d76dd59a6d9ca6fa3d2df12021b1cba896
      https://github.com/oracle/dtrace-utils/commit/1c4f17d76dd59a6d9ca6fa3d2df12021b1cba896
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Implement dt_bpf_map_create_meta() and create_gmap_of_maps()

The indexed aggregation support will make use of the map-of-maps
structure that BPF supports.  The dt_bpf_map_create_meta() function
provides the low level implementation and create_gmap_of_maps()
provides a function with argument checking and error reporting.

This patch also cleans up some coding style issues with bpf_*()
functions (and it declares local-use-only functions static).

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


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

  Changed paths:
    M libdtrace/dt_bpf.c

  Log Message:
  -----------
  Allow NULL as map name in dt_bpf_map_create()

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


  Commit: 0595e1d35609f35cc85a5db195d1aee71303b0ce
      https://github.com/oracle/dtrace-utils/commit/0595e1d35609f35cc85a5db195d1aee71303b0ce
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

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

  Log Message:
  -----------
  Implement dt_bpf_map_lookup_inner() and dt_bpf_map_update_inner()

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


  Commit: a04427e6015e8f38c3a6643f55e0a052c1a8cd80
      https://github.com/oracle/dtrace-utils/commit/a04427e6015e8f38c3a6643f55e0a052c1a8cd80
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_impl.h
    M test/stress/buffering/err.resize2.r

  Log Message:
  -----------
  Use array-of-maps as storage for aggregations

In preparation for indexed aggregations and the clear() and trunc()
operations, the storage for aggregations is moving from a per-CPU
array map to an array of maps, indexed by CPU id.

The existing storage solution for aggregations stored all data in a
singleton map value, i.e. all CPUs were writing to their own portion
of a block of memory that the consumer retrieved in its entirety in
a single system call.

The new storage solution allocates a memory block for each CPU so
that data retrieval by the consumer can be done per CPU.  This sets
the stage for future development where the consumer may need to
update the aggregation buffers.

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


  Commit: 54773403335fdc39061a97ed7478a2cee8f4adad
      https://github.com/oracle/dtrace-utils/commit/54773403335fdc39061a97ed7478a2cee8f4adad
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Move freeing %r0 to a more consistent place

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


  Commit: 76710ff19c331ab112da379deffa0dea3776c2fa
      https://github.com/oracle/dtrace-utils/commit/76710ff19c331ab112da379deffa0dea3776c2fa
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Implement dt_cg_push_stack() and dt_cg_pop_stack()

Use dt_cg_push_stack() in dt_cg_arglist().  The dt_cg_pop_stack() will
be used in a subsequent patch.

This patch is based on two patches from Eugene Loh.

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


  Commit: 2f1b10cee104f3acc4e98a66ec96cddcadb81bb5
      https://github.com/oracle/dtrace-utils/commit/2f1b10cee104f3acc4e98a66ec96cddcadb81bb5
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

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

  Log Message:
  -----------
  Implement dt_bpf_map_lookup_fd()

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


  Commit: 2dd92c0202ad8b92104d3a69ab850b47ed876fdd
      https://github.com/oracle/dtrace-utils/commit/2dd92c0202ad8b92104d3a69ab850b47ed876fdd
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M bpf/Build
    A bpf/get_agg.c
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_ident.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_map.c
    M libdtrace/dt_printf.c
    M libdtrace/dtrace.h
    M test/demo/intro/countdown-multiple.d
    M test/demo/intro/countdown-quant.d
    M test/demo/out/printa.d
    M test/demo/script/syscall.d
    M test/demo/user/libc.d
    M test/stress/buffering/err.resize2.d
    M test/unittest/actions/printa/err.D_PRINTA_AGGKEY.d
    M test/unittest/actions/printa/err.D_PRINTA_AGGPROTO.d
    M test/unittest/aggs/tst.count2.d
    M test/unittest/aggs/tst.count3.d
    M test/unittest/aggs/tst.denormalizeonly.d
    M test/unittest/aggs/tst.fmtnormalize.d
    M test/unittest/aggs/tst.forms.d
    M test/unittest/aggs/tst.keysort.d
    M test/unittest/aggs/tst.lquantize.d
    M test/unittest/aggs/tst.lquantrange.d
    M test/unittest/aggs/tst.lquantzero.d
    M test/unittest/aggs/tst.multiaggs1.d
    M test/unittest/aggs/tst.multinormalize.d
    M test/unittest/aggs/tst.neglquant.d
    M test/unittest/aggs/tst.negorder.d
    M test/unittest/aggs/tst.negquant.d
    M test/unittest/aggs/tst.order.d
    M test/unittest/aggs/tst.quantize.d
    M test/unittest/aggs/tst.quantmany.d
    M test/unittest/aggs/tst.quantzero.d
    M test/unittest/aggs/tst.signedkeyspos.d
    M test/unittest/aggs/tst.valsortkeypos.d
    M test/unittest/funcs/substr/tst.substrminate.d
    M test/unittest/grammar/tst.stmts.d
    M test/unittest/misc/tst.haslam.d
    M test/unittest/multiaggs/err.D_PRINTA_AGGKEY.d
    M test/unittest/multiaggs/err.D_PRINTA_AGGPROTO.d
    M test/unittest/multiaggs/tst.many.d
    M test/unittest/multiaggs/tst.sort.d
    M test/unittest/multiaggs/tst.sortpos.d
    M test/unittest/multiaggs/tst.zero.d
    M test/unittest/multiaggs/tst.zero2.d
    M test/unittest/multiaggs/tst.zero3.d
    M test/unittest/printa/tst.dynwidth.d
    M test/unittest/printa/tst.tuple.d

  Log Message:
  -----------
  Add support for aggregation keys

In the DTrace port to BPF, the initial support for aggregations
had the kernel maintaining aggregations in a per-CPU BPF map that
was statically allocated and managed.  Each aggregation had its
own region of per-CPU memory.  That is, run-time aggregation keys
were not supported.

To support aggregation keys, switch to a per-CPU BPF hash map.
The hash map key comprises:

*)  the aggregation variable ID

*)  the aggregation keys (if any)

*)  a 64-bit zero (to conform to dynamic variable "tuples")

On the producer (dt_cg.c) side:

*)  Use the existing dt_cg_arglist() to process the
    aggregation keys and produce the BPF hash map key.

*)  Call the new dt_get_agg() to get a pointer to the
    aggregation data in the BPF hash map.  The function call
    will create the element if needed, increment the data
    counter, and advance the pointer to the actual data.

*)  Push this pointer to the stack.

*)  Call the aggregation function: compute the value
    to be aggregated and pop the stack for the pointer
    to where the aggregation data is.

*)  Record the aggregation description (e.g., sizes of
    keys and data) if not already done.  This step is
    performed during code generation, though it does not
    generate code per se.

On the consumer (dt_aggregate.c) side, to snapshot aggregation data:

*)  Use dt_bpf_map_next_key() to walk the keys of the
    BPF hash map.

*)  For each hash map key, read the aggregation data on all CPUs.

*)  For each CPU with a nonzero data counter value, check
    dt_aggregate's user-space hash table for this key-specific
    aggregation.  Initialize or aggregate the user-space data
    accordingly.

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: 268d3e5f8b68bc1e6bd877823461307b3e1d9979
      https://github.com/oracle/dtrace-utils/commit/268d3e5f8b68bc1e6bd877823461307b3e1d9979
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M test/unittest/aggs/tst.llquantize_sort.d
    M test/unittest/aggs/tst.llquantsortkey.d
    M test/unittest/aggs/tst.llquantsortsum.d
    M test/unittest/aggs/tst.llquantsortzero.d

  Log Message:
  -----------
  Pass signatures into dt_aggregate_[l]lquantized[sum|zero]()

In legacy DTrace, aggregation signatures for lquantize() and llquantize()
were prepended to the aggregation data.  In the BPF port, this is no
longer the case.  New mechanisms were put in place.

Nevertheless, functions dt_aggregate_[l]lquantized[sum|zero]() still
expected the legacy behavior.

Have dt_aggregate_valcmp() extract the signatures and pass them to
dt_aggregate_[l]lquantizedcmp(), which then relay the signatures to
dt_aggregate_[l]lquantized[sum|zero](), which now expect the signatures
as explicit arguments.

The associated tests used to XFAIL because aggregations keys were not
supported.  Once support was introduced, the tests would XFAIL due to
core dumps due to extracting aggregation signatures from bogus data.

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


  Commit: 1cfcd917398861035bbb9ac2d20178c809fc322a
      https://github.com/oracle/dtrace-utils/commit/1cfcd917398861035bbb9ac2d20178c809fc322a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M cmd/dtrace.c
    M include/dtrace/metadesc.h
    M libdtrace/dt_map.c
    M libdtrace/dt_printf.c

  Log Message:
  -----------
  Eliminate dtagd_id

In the port to BPF, dtagd_varid and dtagd_id are identical.
The longer name better reflects the current meaning.

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


  Commit: 488f582b82330b5056052b657d67e94bc9fe7e6f
      https://github.com/oracle/dtrace-utils/commit/488f582b82330b5056052b657d67e94bc9fe7e6f
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M test/unittest/multiaggs/tst.tuplecompat.d

  Log Message:
  -----------
  test: Relieve some strsize pressure

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


  Commit: 737104bd03b08f04c101e1c2c1867095286c29b2
      https://github.com/oracle/dtrace-utils/commit/737104bd03b08f04c101e1c2c1867095286c29b2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

  Changed paths:
    M libdtrace/dt_impl.h

  Log Message:
  -----------
  Eliminate dtahe_aggregate

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


  Commit: 0f01ddbc2ffc8c044f42d240248f8d04e358c2c5
      https://github.com/oracle/dtrace-utils/commit/0f01ddbc2ffc8c044f42d240248f8d04e358c2c5
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

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

  Log Message:
  -----------
  Make sure disassembly distinguishes between gvars and agg vars

When the disassembler recognizes access of a variable by value,
it looks up a variable name that matches the offset and scope.
The scope of aggregation variables is also "global", however,
and so the presence of aggregations can lead to incorrect
disassembly of global variables.

Check the variable "kind" when looking up variables accessed
by value.

When the disassembler recognizes aggregation names, a similar
test for them can be introduced.

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


  Commit: 98f14ba4734be0968e3e0c734d0655d5d4a98612
      https://github.com/oracle/dtrace-utils/commit/98f14ba4734be0968e3e0c734d0655d5d4a98612
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

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

  Log Message:
  -----------
  Add disassembly for aggregation variables

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: b0644dc4b2321a5512f42b1f6f0a2ceefe5be263
      https://github.com/oracle/dtrace-utils/commit/b0644dc4b2321a5512f42b1f6f0a2ceefe5be263
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-06 (Tue, 06 Sep 2022)

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

  Log Message:
  -----------
  test: Fix trace((char)-1) in agg test

Legacy DTrace idiosyncratically printed (char)-1 and (short)-1 as
unsigned.  In the BPF port, the old .r file made the test fail.

Fix the .r results file to show negative values.

While it is assumed that char is signed, strictly speaking char's
signedness is platform-dependent.  So make (char) explicitly signed.

Rewrite the comment block.

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


  Commit: f256db8fd572999c72e33017f386dfe0d03bfc04
      https://github.com/oracle/dtrace-utils/commit/f256db8fd572999c72e33017f386dfe0d03bfc04
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    A test/unittest/actions/setopt/err.D_PROTO_ARG.d
    A test/unittest/actions/setopt/err.D_PROTO_ARG.r
    A test/unittest/actions/setopt/err.D_PROTO_LEN.missing_arg.d
    A test/unittest/actions/setopt/err.D_PROTO_LEN.missing_arg.r
    A test/unittest/actions/setopt/err.D_PROTO_LEN.too_many_args.d
    A test/unittest/actions/setopt/err.D_PROTO_LEN.too_many_args.r
    A test/unittest/actions/setopt/tst.badopt.d
    A test/unittest/actions/setopt/tst.badopt.r
    R test/unittest/misc/tst.badopt.d
    R test/unittest/misc/tst.badopt.r
    R test/unittest/setopt/err.D_PROTO_LEN.toomany.d
    R test/unittest/setopt/err.D_PROTO_LEN.toomany.r

  Log Message:
  -----------
  Implement setopt()

The basic mechanics of the setopt() action are implemented in this
patch.  Each dynamic runtime option that can be set using setopt()
must provide support for it.

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: 79112e2988e80b1a4fcdf991299a18e1fbf69688
      https://github.com/oracle/dtrace-utils/commit/79112e2988e80b1a4fcdf991299a18e1fbf69688
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: Add support for a @@nosort tag

By default, we sort test results before comparing with a .r results
file, since test results often do not have a well-defined order.
For example, probes firing on different CPUs emit output in varying
order.

Some tests, however, check for particular ordering.

Add a tag to suppress the default sort behavior.

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


  Commit: f98d9a5476da13b846e239816bc036466512d8bd
      https://github.com/oracle/dtrace-utils/commit/f98d9a5476da13b846e239816bc036466512d8bd
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M test/unittest/aggs/tst.keysort.d
    M test/unittest/aggs/tst.llquantize_sort.d
    M test/unittest/aggs/tst.llquantsortkey.d
    M test/unittest/aggs/tst.llquantsortsum.d
    M test/unittest/aggs/tst.llquantsortzero.d
    M test/unittest/aggs/tst.neglquant.d
    M test/unittest/aggs/tst.signedkeys.d
    M test/unittest/aggs/tst.signedkeyspos.d
    M test/unittest/aggs/tst.valsortkeypos.d

  Log Message:
  -----------
  test: Add @@nosort tag to agg tests that check sort order

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


  Commit: fb264ec9f1d5bbc97ebfc296473b72a08b062e2f
      https://github.com/oracle/dtrace-utils/commit/fb264ec9f1d5bbc97ebfc296473b72a08b062e2f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M test/unittest/aggs/tst.clear.d
    M test/unittest/aggs/tst.clearavg.d
    M test/unittest/aggs/tst.clearavg2.d
    M test/unittest/aggs/tst.cleardenormalize.d
    M test/unittest/aggs/tst.clearlquantize.d
    M test/unittest/aggs/tst.clearnormalize.d
    M test/unittest/aggs/tst.negtrunc.d
    M test/unittest/aggs/tst.negtruncquant.d
    M test/unittest/aggs/tst.trunc.d
    M test/unittest/aggs/tst.trunc0.d
    M test/unittest/aggs/tst.truncquant.d

  Log Message:
  -----------
  test: Annotate tests that require missing features

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


  Commit: 8e73aac9ed76dcffdf8a9269dc08643ac9e9f932
      https://github.com/oracle/dtrace-utils/commit/8e73aac9ed76dcffdf8a9269dc08643ac9e9f932
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

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

  Log Message:
  -----------
  test: Fix tst.goodkey.d

The test uses vtimestamp which is not implemented yet.  It is valid to
substitute i instead.

The post-processor also needs tweaking because it was not properly
substituting numbers in the output with only a single space between them.

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


  Commit: 8e48e84c7fa227887682bc11d367e5390f5c4842
      https://github.com/oracle/dtrace-utils/commit/8e48e84c7fa227887682bc11d367e5390f5c4842
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/aggs/tst.typecast-key.d
    A test/unittest/aggs/tst.typecast-key.r

  Log Message:
  -----------
  Fix size for typecast tuple (and aggregation key) components

Components of a tuple (or aggregation key) were being typecast where
needed but if narrowing or widening took place, the storage size to store
the value was never updated.

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


  Commit: 0520b27e4765f9c07305ab1f1e08c85e0e124363
      https://github.com/oracle/dtrace-utils/commit/0520b27e4765f9c07305ab1f1e08c85e0e124363
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M test/demo/user/libc.d

  Log Message:
  -----------
  test: fix test/demo/user/libc.d

It seems that /bin/date is more likely to exist than /usr/bin/date.
Also, the test needs a '@@trigger: none' marker to ensure it actually
gets executed.

The probe range is limited to functions that match m* to reduce the
resource needs for this test.  Since this includes functions like
malloc() it does not affect the operation of the test.

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


  Commit: 1e3a49d19df3fd98083dadf65bdc1423e750acac
      https://github.com/oracle/dtrace-utils/commit/1e3a49d19df3fd98083dadf65bdc1423e750acac
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    M test/unittest/variables/bvar/tst.probefunc.d
    M test/unittest/variables/bvar/tst.probemod.d
    M test/unittest/variables/bvar/tst.probename.d
    M test/unittest/variables/bvar/tst.probeprov.d

  Log Message:
  -----------
  test: fix probe* builtin variable tests

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


  Commit: fa470e438d7c6dd170ce6c45bc8a718a4fa35b2a
      https://github.com/oracle/dtrace-utils/commit/fa470e438d7c6dd170ce6c45bc8a718a4fa35b2a
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-08 (Thu, 08 Sep 2022)

  Changed paths:
    A test/unittest/pid/tst.probefunc.d

  Log Message:
  -----------
  test: add test for probe* bvar support for pid probes

This test exercises the correct support for probefunc for pid probes.
The test is marked @@xfail until probefunc works for pid probes.

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


  Commit: 672c4532b1581e0802e3776783f5a9921ad4ed6e
      https://github.com/oracle/dtrace-utils/commit/672c4532b1581e0802e3776783f5a9921ad4ed6e
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-09-09 (Fri, 09 Sep 2022)

  Changed paths:
    M test/unittest/misc/tst.lockmem-cmdline.sh
    M test/unittest/misc/tst.lockmem-envvar.sh
    M test/unittest/misc/tst.lockmem-pragma.sh
    M test/unittest/misc/tst.lockmem-x.sh

  Log Message:
  -----------
  test: Bump up locked memory in lockmem tests

The default aggsize is 4M.  This is the dominant drain on locked
memory for a simple script like "BEGIN { @ = avg(1) }".

The lockmem tests check behavior when the lockmem limit is too
small; anything less than 4M is suitable.

They also check when the lockmem limit is large enough.  We were
using a lockmem limit of 16M, which is clearly inadequate even
for only a few CPUs.

Bump the "large enough" sizes up to 256M, which should be sufficient
even for dozens of CPUs.

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


  Commit: d08cc97aecfc9aff9a17171e8f51b951b8739073
      https://github.com/oracle/dtrace-utils/commit/d08cc97aecfc9aff9a17171e8f51b951b8739073
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-13 (Tue, 13 Sep 2022)

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

  Log Message:
  -----------
  Clean up error reporting in the BPF progran load process

The return value for the attach() provider hook was being passed to
the dtrace_go() through dt_bpf_load_progs(), confusing the dtrace
command line utility which was expecting 0 or -1 (with the proper
error code being set).

It turns out return values were misused in a few other places.  The
code will now explicitly check for -1 as failure indication (and return
-1 explicitly where needed) for dt_aggregate_go(), dt_bpf_gmap_create(),
dt_bpf_load_prog(), and dt_bpf_load_progs().

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


  Commit: ea1a50cf06d977ec7fb48b3ea8097c592caa26cd
      https://github.com/oracle/dtrace-utils/commit/ea1a50cf06d977ec7fb48b3ea8097c592caa26cd
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-13 (Tue, 13 Sep 2022)

  Changed paths:
    M libdtrace/dt_pid.c

  Log Message:
  -----------
  pid: ignore compiler-generated internal function names

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


  Commit: 16a526d6d9a80c1670be058b2c5dacf6eeefce94
      https://github.com/oracle/dtrace-utils/commit/16a526d6d9a80c1670be058b2c5dacf6eeefce94
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-09-13 (Tue, 13 Sep 2022)

  Changed paths:
    M test/unittest/dif/bcopy.d
    M test/unittest/dif/copyin.d
    M test/unittest/dif/loadX.d
    M test/unittest/syscall/tst.openret.sh
    M test/unittest/vars/tst.ppid.d
    M test/unittest/vars/tst.uid.d

  Log Message:
  -----------
  test: remove @@xfail marker from some tests

Commit dee44bc6 "Add support for copyinstr() subroutine"
	Fixed test/unittest/dif/bcopy.d
	Fixed test/unittest/syscall/tst.openret.sh

Commit d97c8fa7 "Add support for copyin() subroutine"
	Fixed test/unittest/dif/copyin.d
	Fixed test/unittest/dif/loadX.d

Commit febf4570 "Support loading scalars from kernel addresses"
	Fixed test/unittest/vars/tst.ppid.d
	Fixed test/unittest/vars/tst.uid.d

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


  Commit: af3b57bb1067180a558edf8f0f8cf13f9a135bef
      https://github.com/oracle/dtrace-utils/commit/af3b57bb1067180a558edf8f0f8cf13f9a135bef
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-25 (Tue, 25 Oct 2022)

  Changed paths:
    M Makefunctions
    M libdtrace/Build
    A libdtrace/drti-vers
    A libdtrace/drti.c
    M libdtrace/dt_link.c

  Log Message:
  -----------
  Revert "Remove drti.o and related support code."

We're going to start using drti again, so bring it back.

This reverts commit 1e45252a1e1c9a2ab35e03558dc4e5bbf63ad0d8.

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


  Commit: 95024ee9b015628e6b14672856c96626066cda33
      https://github.com/oracle/dtrace-utils/commit/95024ee9b015628e6b14672856c96626066cda33
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-25 (Tue, 25 Oct 2022)

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_link.c

  Log Message:
  -----------
  drti: emit into a subdirectory

The BPF library loader in dt_dlibs.c assumes that ${libdir}/dtrace/*.o
are all BPF object files.  drti*.o is not, and its presence causes the
initial BPF code load to fail at DTrace startup time.

Move it into a subdirectory to keep it out of trouble.

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: c54acadad06d44f25c57beb3ce7cbab28b418131
      https://github.com/oracle/dtrace-utils/commit/c54acadad06d44f25c57beb3ce7cbab28b418131
  Author: David P. McLean <david.mclean at oracle.com>
  Date:   2022-10-25 (Tue, 25 Oct 2022)

  Changed paths:
    M libdtrace/drti.c

  Log Message:
  -----------
  drti: reference first loaded segment of object containing dtrace_dof_init

Any ELF executable or shared library (object) that contains USDT probes
contains a DOF section which describes the probes and also contains a copy
of the dtrace_dof_init() function.  This dtrace_dof_init() function is used
to register the DOF data of the object with the kernel.

The dtrace_dof_init() function needs to identify what type of object it is
being invoked for because the address representation varies (for ELF object
file type ET_DYN the symbol values in the DOF are relative to the load
address of the object rather than absolute values).  The ELF object file
type is obtained from the ELF header and the ELF header is found in the
first mapping (or segment) of the object.

The implementation used previous to this commit was to loop through all
mappings looking for one that contains the address of the dtrace_dof_init()
function.  The assumption was that the executable code mapping with the
dtrace_dof_init() function would always be the first mapping, and since the
ELF header is in the first mapping, the mapping with the dtrace_dof_init()
function would also contain the ELF header.

The assumption was proven wrong where sometimes the dtrace_dof_init()
function is not in the first mapping, and this commit updates the code to:
First loop over the mappings to determine the name of the object containing
the executing dtrace_dof_init() instance and record this object name.
Then a second loop is run over the mappings to determine the mapping with
the lowest start address (which is in fact the first mapping whose name
matches the one recorded from the first loop).

This first mapping of the object contains the ELF header (this ELF header is
used to determine the ELF object file type) and the first mapping start
address is the base address to be passed to the kernel along with the DOF
data.

Signed-off-by: David  Mc Lean <david.mclean at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: d7077ab3168f0101218c819c17ca0037fb2addd1
      https://github.com/oracle/dtrace-utils/commit/d7077ab3168f0101218c819c17ca0037fb2addd1
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-25 (Tue, 25 Oct 2022)

  Changed paths:
    M libdtrace/dt_pid.c

  Log Message:
  -----------
  pid: drop dpp_stret

These structure-return thunks in the Solaris libc have never existed on
Linux, nor anything like them, so these calls will always fail.

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: 0811eb4fad43249974d18cc1c8980e268ec43fb9
      https://github.com/oracle/dtrace-utils/commit/0811eb4fad43249974d18cc1c8980e268ec43fb9
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-25 (Tue, 25 Oct 2022)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  runtest: make ZAPTHESE an array

This lets us reliably have multiple elements in ZAPTHESE, removing those
that have died naturally without disturbing the others that might still
be running.

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


  Commit: 3753d677444576eb7bf409586ac9a43c1a874286
      https://github.com/oracle/dtrace-utils/commit/3753d677444576eb7bf409586ac9a43c1a874286
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M include/dtrace/actions_defines.h
    M include/dtrace/dof_defines.h
    M test/Build
    A test/internals/headers/tst.header-endianness.sh

  Log Message:
  -----------
  uapi headers: include <sys/dtrace_types> as needed

This is needed for _LITTLE_ENDIAN and _BIG_ENDIAN.

Add a new internals test to identify this class of failure: add a
tag 'uninstalled' which is disabled in the installed tree to prevent it
from being executed as part of the installed testsuite (since it is not
particularly useful outside the installed set, and making it work in
both places would be complicated and annoying).

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


  Commit: 79a4245beb82997bf63cb1ca9ea9140e725b7e41
      https://github.com/oracle/dtrace-utils/commit/79a4245beb82997bf63cb1ca9ea9140e725b7e41
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_link.c

  Log Message:
  -----------
  dt_link: finish backing out varint, fixing dt_link-generated object files

For a while now, linking dtrace -G-generated object files has been
saying

/usr/bin/ld: .../build/test-triggers--usdt-tst-special.o: error adding symbols: no error

This is more than slightly confusing.  For starters, collect2 is
corrupting the error message: the actual error is

/usr/bin/ld: .../build/test-triggers--usdt-tst-special.o: error adding symbols: file format not recognized

This is not much more helpful.  The actual cause is in
elf_link_add_object_symbols:

      name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link,
					      isym->st_name);

where the symbol name comes out as NULL.  This is because we are hitting
a sanity check in bfd_elf_string_from_elf_section:

      /* PR 24273: The string section's contents may have already
	 been loaded elsewhere, eg because a corrupt file has the
	 string section index in the ELF header pointing at a group
	 section.  So be paranoid, and test that the last byte of
	 the section is zero.  */
      if (hdr->sh_size == 0 || hdr->contents[hdr->sh_size - 1] != 0)
	return NULL;

This paranoia has won out! We are generating string tables with
hdr->sh_size one too small, pointing at the last byte of the last
string.

The cause is somewhat gross.  dt_link.c:process_obj computes the length
of the new strtab it's constructing by adding all the symbol names to a
dt_strtab, asking it for its size, subtracting one for the \0 at the
first byte, and then throwing the strtab away and directly editing the
strtab in the object file, using the strtab it generated earlier only
for its size.  Doing things in two stages like this is a bit risky: it's
riskier yet because it's using a dt_strtab, which is not a model of an
ELF strtab at all but rather of a DTrace string table.  No harm, they're
the same: except that when varints landed the format of a string
naturally changed to gain an extra length byte at the start. The size
computation was changed to subtract two bytes rather than one (itself
buggy: *every string in the strtab* had an extra byte on the front of
it, so the wrong number of bytes was being subtracted and the resulting
sh_size was too large).  But when the varint code was backed out (in
29e3f422 "Remove the string length prefix"), this size computation was
not changed back, leading to a sh_size that is one byte too low,
triggering this failure.

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


  Commit: 943fb84ab31c70ff01a0121960378a1138d7d60e
      https://github.com/oracle/dtrace-utils/commit/943fb84ab31c70ff01a0121960378a1138d7d60e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

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

  Log Message:
  -----------
  providers: allow providers with no trampoline

Such providers can be enabled just like any other, but generate no code.

Meant for use by providers like pid which have some probes without
trampolines (but which enable other probes which do contain trampolines
that execute on their behalf).  Both such probes need enabling because
we want to ensure their names are interned, etc: we only want to avoid
trying to execute their trampoline when there is none.

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


  Commit: d2ea2f7d1354439676b53b46b268097bccd9fc03
      https://github.com/oracle/dtrace-utils/commit/d2ea2f7d1354439676b53b46b268097bccd9fc03
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M Makeconfig

  Log Message:
  -----------
  build: add header+symbol checking

The new check-header-symbol-rule Makeconfig rule allows checking to see
whether a header #inclusion plus a symbol usage plus a given -l library
usage compiles and links successfully.  It's analogous to the Autoconf
AC_TRY_COMPILE macro.

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


  Commit: 64a37fb8b8e0252bd38e831abc1ab38287cf90c8
      https://github.com/oracle/dtrace-utils/commit/64a37fb8b8e0252bd38e831abc1ab38287cf90c8
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M Makeconfig
    M include/port.h
    M libport/Build
    A libport/close_range.c
    A libport/daemonize.c

  Log Message:
  -----------
  port: add daemonization support code

This assists in writing reliable daemons, providing a close_range() that
works on older glibc/kernel combinations, and a daemonize() which
provides a synchronization pipe down which error messages can also be
sent, so that errors occurring after daemonize() is called but before
the daemon is fully working can be reliably reported.

(This uses the check-header-symbol-rule feature just added to let us
verify not only that close_range() is present in libc, but that it's
present in the headers and has the right prototype.  The history of
close_range is a right tangled mess... as usual with glibc features,
linking isn't required to work unless the header is included too, so
we test both at once.)

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


  Commit: e46168272e8574f4cf75978356d7973a0c09ffc3
      https://github.com/oracle/dtrace-utils/commit/e46168272e8574f4cf75978356d7973a0c09ffc3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M include/sys/sol_procfs.h
    M libproc/Pcontrol.h
    M libproc/Psymtab.c
    M libproc/libproc.h

  Log Message:
  -----------
  libproc: add Pinode_to_file_map()

This lets you rapidly look up the prmap_file_t that corresponds to a
(dev, ino) pair in a given process's mappings.  This is useful when
dealing with uprobes, which work on an *inode* basis, not a process
basis or even a mapping basis: we can use this to see whether a process
we are otherwise interested in has ownership of a given (dev, ino)
mapping rapidly, and what the details of the mapping are.

Do it with a hash table rather than linear iteration because these days
it is getting increasingly common to have processes with a great many
mappings.  Chromium has 1638 mappings on my system, of which 411 are
file-backed, but the real mapping king these days is Emacs with native
compilation, which maps every Lisp file as a separate shared object:
3618 mappings, of which 3135 are file-backed!

While we're at it, rename the (Psymtab.c-private) Pprmap_file_by_name
to Pfilename_to_file_map, so that all prmap_file_t functions have
consistent names (and names less terrible than Pprmap_file_by_name).

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


  Commit: 164fe6f04bbd18c77906e7d127785da19890f14a
      https://github.com/oracle/dtrace-utils/commit/164fe6f04bbd18c77906e7d127785da19890f14a
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libproc/Psymtab.c

  Log Message:
  -----------
  libproc: fix double-free on error path

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


  Commit: ec5254b2fff2327b0c2c61d208dd47052a8fef5d
      https://github.com/oracle/dtrace-utils/commit/ec5254b2fff2327b0c2c61d208dd47052a8fef5d
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    A libcommon/Build
    A libcommon/GNUmakefile
    A libcommon/dt_list.c
    A libcommon/dt_list.h
    M libdtrace/Build
    R libdtrace/dt_list.c
    R libdtrace/dt_list.h
    M libproc/Build
    M libproc/Pcontrol.c
    M test/triggers/Build
    M test/utils/Build

  Log Message:
  -----------
  usdt: common infrastructure

USDT will include a daemon that implements a CUSE device that programs
containing USDT probes issue ioctl()s to.  This daemon needs to create
uprobes, and this needs to use libproc to extract information about the
processes (like mapping addresses, etc).  This is something the rest of
DTrace can already do: so split out infrastructure needed by libproc and
infrastructure needed to create uprobes into a new libcommon (static)
library that the daemon can use.  Make tiny adjustments to libproc and
triggers that use it so that libproc can stand independent of libdtrace
(it was very nearly there already: only one debugging statement change
and a move of dt_list into the common library is needed).

A future commit will adjust DTrace to use this library to create uprobes
too.

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


  Commit: 5b43ff17f839195a29cadf255a947514d15aa478
      https://github.com/oracle/dtrace-utils/commit/5b43ff17f839195a29cadf255a947514d15aa478
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    A include/tracefs.h
    M libcommon/Build
    A libcommon/uprobes.c
    A libcommon/uprobes.h
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  libcommon: move uprobes creation into the common library

This commit adds functions in the libcommon library to create uprobes
given a pid and address, create uprobes given more detailed info (a
(dev, ino, addr) triplet, a spec for the uprobe_events file, and a
DTrace probe name), and compute a spec. We also provide
encoding/decoding functions to allow the uprobe to contain the DTrace
probe name as part of its args even though DTrace probes can contain
characters that are not allowed in uprobe names or arg names, and even
though probe arg names must be unique while DTrace probe name components
need not be.

The DTrace provider is rejigged to use this code to generate the
BEGIN/END/ERROR probes, to make sure this code works.

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


  Commit: 75ed17e6822ab7bae6827b19ed2364d1bc9159cd
      https://github.com/oracle/dtrace-utils/commit/75ed17e6822ab7bae6827b19ed2364d1bc9159cd
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M Makeoptions
    M libcommon/Build
    A libcommon/dof_parser.c
    A libcommon/dof_parser.h
    A libcommon/dof_parser_host.c

  Log Message:
  -----------
  libcommon: DOF parsing

This commit adds a DOF parser, derived from DTrace v1 but simplified.
The parser is intended to run in a strict-mode seccomp jail, and does no
I/O except via pre-provided file descriptors.  The host side should do
I/O using the functions in dof_parser_host.h.

The seccomp parser child returns output as a stream of dof_parsed_t
records, which are variable-length records with an early size member
(the reader code in dof_parser_host.c takes care of reading the right
amount of data).  Errors are returned as PIT_ERR records in this stream,
or signified by a simple crash (in which case the invoker can simply
restart it).

The parser has a notably noisy debugging mechanism which can be turned
on via make dof_dbg=yes (it is separate from make debugging=yes because
it makes the daemon emit lots of stuff on stderr, which you're unlikely
to want unless you're actually debugging USDT itself).

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


  Commit: a79ec6805ecc675354d5cf2994843d027e67881f
      https://github.com/oracle/dtrace-utils/commit/a79ec6805ecc675354d5cf2994843d027e67881f
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M GNUmakefile
    M Makeconfig
    A dtprobed/60-dtprobed.rules
    A dtprobed/Build
    A dtprobed/GNUmakefile
    A dtprobed/dtprobed.c
    A dtprobed/dtprobed.service
    A dtprobed/dtrace-usdt.target
    A dtprobed/rpl_fuse_log.c
    A dtprobed/rpl_fuse_log.h
    M dtrace.spec
    M runtest.sh

  Log Message:
  -----------
  usdt: daemon

This commit adds a daemon, "dtprobed", which usually runs at boot
(monitored by systemd, if possible), providing /dev/dtrace/helper using
CUSE, accepting DOF from processes doing the usual DTrace ioctl()s to
that device, and using infrastructure in prior commits in this series to
pass the DOF to a child jailed with seccomp() for parsing, and accepting
structures containing parsed results back, then emitting uprobes from
these results before allowing the ioctl()ing.  The uprobes created have
stereotyped names and argument lists that include an encoded
representation of the name of the corresponding DTrace USDT probe.  (The
name also contains the address and a number of other things, so that
probes that appear in multiple places in a process still work.)

(The CUSE device is an "unrestricted ioctl" device, which restricts
dtprobed to running only as root, because the ioctl has to pull data --
the DOF -- out of arbitrary places in the client memory according to the
passed-in structure. Since you need to be root to create uprobes at all
this is not any kind of restriction.)

Extra complexity is provided by changes to libfuse.  Recent (> 2018)
libfuse has a nice logging interface, which if available means that
libfuse will log FUSE-side problems into syslog or anywhere else of your
choosing: we emit into syslog if -d or -F (debug, foreground) are not
specified and systemd is not in use (if systemd is in use, we never
daemonize at all).  But older libfuse does not provide this, and
unfortunately OL8 (but not OL7!) has such an older libfuse.  So we add a
compatibility wrapper providing a minimal reimplementation of the
logging interface if built against such an old libfuse.  The wrapper is
named like the header and source file implementing the real thing in
FUSE itself, but prepended with rpl_ to avoid the possibility of
dependencies on header file ordering when the new FUSE code is present.

Testing-wise, in installed mode the running dtprobed daemon is used, but
in in-source-tree mode runtest.sh kicks off a new dtprobed emitting to a
local device file named /dev/dtrace/test-$pid, and uses a new
testing-only environment variable to force drti.c to emit its ioctl()s
to that temporary device.  So in-tree testing always tests the actual
dtprobed in the tree (with any bugfixes), not the system copy.

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


  Commit: 2f069320c3d421e24b8197505650a0ca862e7ef3
      https://github.com/oracle/dtrace-utils/commit/2f069320c3d421e24b8197505650a0ca862e7ef3
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/drti.c

  Log Message:
  -----------
  drti: use /proc/self/maps

This works in conjunction with PID namespaces where using getpid() does
not.

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: 7c37a88221d1168f7a874fcfd6b106dc6c1bb935
      https://github.com/oracle/dtrace-utils/commit/7c37a88221d1168f7a874fcfd6b106dc6c1bb935
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_syscall.c
    M libdtrace/dt_provider_tp.c

  Log Message:
  -----------
  fbt, syscall: use getline(), not fgets()

This lets us drop lots of code to handle too-long lines.  (Done for
consistency with the pid provider, which will do the same thing in a
subsequent commit.)

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: b552dbe3624256f1fbb97d08bdf8765f6c523aac
      https://github.com/oracle/dtrace-utils/commit/b552dbe3624256f1fbb97d08bdf8765f6c523aac
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_dof.c

  Log Message:
  -----------
  dof: don't emit providers with no probes

Without this, you end up with DOF with a lot of zero-probe providers
in.  This not only wastes space but causes the DOF to fail validation
(arguably unnecessarily, but why waste the space in the first place?)

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


  Commit: a28e369c6fcacb324e1fdcf87fd78b621daa488f
      https://github.com/oracle/dtrace-utils/commit/a28e369c6fcacb324e1fdcf87fd78b621daa488f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

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

  Log Message:
  -----------
  libcommon: add uprobe_name() and uprobe_delete()

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


  Commit: 95ac5e2496d13200ff72109f7dbccfc3359fb0c6
      https://github.com/oracle/dtrace-utils/commit/95ac5e2496d13200ff72109f7dbccfc3359fb0c6
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M include/dtrace/pid.h
    M libdtrace/Build
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_pid.c
    M libdtrace/dt_pid.h
    M libdtrace/dt_prov_fbt.c
    R libdtrace/dt_prov_pid.c
    M libdtrace/dt_prov_sdt.c
    A libdtrace/dt_prov_uprobe.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  usdt: DTrace userspace side

This is implemented almost entirely along with the pid provider, which is
reassuringly similar to how it was done in the in-kernel days. They're
really very closely-related beasts, and the same uprobe-based code can
handle both easily enough.  To reflect this, dt_prov_pid.c is renamed to
dt_prov_uprobe.c.

This does several things that are sufficiently intertwined that putting
them in one commit seems most readable:

 - implements USDT probe discovery, ripping out a lot of old ioctl stuff
   and obsolete code handling stuff like structure-copying thunks in the
   Solaris C library and a bunch of obsolete functions around DOF
   acquisition (keeping one which might well be revived in the next
   phase), and adding dt_pid_create_usdt_probes, which scans the
   systemwide uprobe list and creates DTrace-side USDT probes (and their
   associated underlying uprobe-based probes) for any that are relevant
   (see below), using an sscanf-based parser: the uprobe naming scheme
   was designed so that it works with the limitations of such parsers.
   Thanks to the %m conversion specifier there is no risk of buffer
   overrunning if the name components are unexpectedly long.

   Right now this can only create probes for specific processes (those
   named on the command line in probe names, as usual), but in future
   it'll grow the ability to make probes for everything dtprobed has
   spotted probes for.  Because it is driven by the systemwide uprobe
   list, it can create probes for processes that started before DTrace
   did, just like the old in-kernel model.

 - rejigs the pid provider support in dt_prov_uprobe.c (formerly
   dt_prov_pid.c) to use the new uprobe_create mechanism to make pid
   probes, with names consistent with uprobes created by dtprobed for
   USDT probes; the uprobes have names like dt_pid/[pr]_$dev_$ino_$addr.
   USDT probes pass their name components down as encoded uprobe
   arguments, viz:

   p:dt_pid/dt_2d_231d_7fbe933165fd /tmp/runtest.17112/usdt-dlclose1.123064.9010/livelib.so:0x15fd Ptest_prov=\1 Mlivelib__2eso=\2 Fgo=\3 Ngo=\4

   (The [PMFN] prefix is added and stripped off automatically by the
   name en/decoder, and makes sure that no two "args" have the same
   name, even if the probe component is the same, as above.)

 - provides provide_usdt_probe to be called at USDT probe discovery
   time to create USDT probes and their underlying uprobe-based probes.
   The creation of the underlying uprobe-based probes is split off into
   a new funtion create_underlying that is also used for pid probes.
   Probe naming is designed to ensure that USDT probes and pid probes
   that are created at the same offset are associated with the same
   underlying probe.

   The struct dt_uprobe attached to the underlying probe gains a device
   number (which it should always have had) and keeps track of the
   underlying uprobe name from create_uprobe or USDT probe discovery
   and remembers whether or not DTrace created it (if dtprobed created
   it, dtrace must not delete it).

   USDT probes can be associated with more than one underlying probe
   (if the probe appears repeatedly in a program).  Repeated calls to
   provide_usdt_probe for the same probe description but with different
   offsets will cause the USDT probe to be chained into the appropriate
   underlying probes (creating them as needed).

 - enabling gets a little more complex.  We intern both the overlying
   (pid and USDT) probe *and* the associated underlying probe in the
   enablings list (by getting ->enable for the pid/USDT probe to walk
   its list of underlying probes and enable all of them), and to also
   add itself to the enablings list.

 - Trampoline generation has to adapt to this, but also has to use a
   less kludgy way of figuring out the pids the trampoline applies to:
   rather than parsing the name apart on the spot, we ask dt_pid, which
   already has code to *properly* parse apart both pid and usdt names
   and extract the pid from them.

 - stack arg handling needs a bit of a tweak.  USDT probes can take a
   set of arguments that and are implemented as a fake function call.
   The underlying uprobe is placed right after the argument setup and
   therefore should be retrieved without applying PT_REGS_ARGSTKBASE
   for platforms on which PT_REGS_ARGSTKBASE > 0.  The underlying
   probe gets the PP_IS_FUNCALL flag set to indicate this.

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


  Commit: 7ad418c47c7e500dfd2a92c99d50a044c3213da5
      https://github.com/oracle/dtrace-utils/commit/7ad418c47c7e500dfd2a92c99d50a044c3213da5
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M test/triggers/Build
    M test/unittest/pid/tst.provregex3.sh
    A test/unittest/usdt/tst.args-alt.aarch64.x
    M test/unittest/usdt/tst.args-alt.d
    M test/unittest/usdt/tst.args.d
    M test/unittest/usdt/tst.dlclose1.sh
    M test/unittest/usdt/tst.dlclose2.sh
    M test/unittest/usdt/tst.dlclose3.sh
    R test/unittest/usdt/tst.dlclose3.x
    M test/unittest/usdt/tst.eliminate.sh
    M test/unittest/usdt/tst.enable.d
    M test/unittest/usdt/tst.enable_and.d
    M test/unittest/usdt/tst.enable_and_2.d
    M test/unittest/usdt/tst.enable_or.d
    M test/unittest/usdt/tst.enable_or_2.d
    M test/unittest/usdt/tst.enable_return.d
    M test/unittest/usdt/tst.enable_stmt.d
    M test/unittest/usdt/tst.enabled.sh
    M test/unittest/usdt/tst.enabled2.sh
    M test/unittest/usdt/tst.entryreturn.sh
    M test/unittest/usdt/tst.fork.sh
    M test/unittest/usdt/tst.guess32.sh
    M test/unittest/usdt/tst.guess64.sh
    A test/unittest/usdt/tst.lingering.r
    A test/unittest/usdt/tst.lingering.sh
    M test/unittest/usdt/tst.multiple.sh
    M test/unittest/usdt/tst.reeval.sh
    M test/unittest/usdt/tst.static.sh
    M test/unittest/usdt/tst.static2.sh
    M test/unittest/usdt/tst.tailcall.d

  Log Message:
  -----------
  usdt: testsuite updates

A lot of tests can be enabled now, but a lot are still XFAIL: anything
that relies on is-enabled probes, systemwide probing, globbing of USDT
probe names, or args which are non-integral are guaranteed broken.

We add one new test to make sure that you can run a probe-containing
program and then repeatedly probe it from multiple dtraces in turn
without them messing up each others' probes in any way: the probes
linger from one dtrace to the next.  (Doing it from multiple dtraces in
*parallel* may well not work yet, as no specific code has been written
to make it work: that's planned for the next phase.)

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


  Commit: eddac94d22dea7a5165771f77c5f154e3ce3e0c4
      https://github.com/oracle/dtrace-utils/commit/eddac94d22dea7a5165771f77c5f154e3ce3e0c4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M runtest.sh

  Log Message:
  -----------
  test: Signal an error if trigger does not exist

The behavior had been to ignore the trigger silently, leading to
mystifying outcomes.

Clean up a few other minor issues in runtest.sh.

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


  Commit: ec61b196c516403b3ded4c2677b67be66a4489dd
      https://github.com/oracle/dtrace-utils/commit/ec61b196c516403b3ded4c2677b67be66a4489dd
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_pid.c

  Log Message:
  -----------
  pid: drop more Solaris-specific bug workarounds

We definitely don't have any old binaries that exhibit a problem only
observed on old versions of Solaris lacking modern ELF constructors.

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


  Commit: bbf2e42edd42223830aa7c33335c5817c14cb7b0
      https://github.com/oracle/dtrace-utils/commit/bbf2e42edd42223830aa7c33335c5817c14cb7b0
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M test/unittest/pid/tst.probefunc.d
    M test/unittest/pid/tst.weak1.d
    M test/unittest/pid/tst.weak2.d

  Log Message:
  -----------
  pid: a few more tests are now passing

These all depended on probefunc etc working.

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


  Commit: 22786c90f76f7e4bd7307c122aac3f278978fc36
      https://github.com/oracle/dtrace-utils/commit/22786c90f76f7e4bd7307c122aac3f278978fc36
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libproc/Psymtab.c

  Log Message:
  -----------
  libproc: add the dev/ino pair to the mapping debug printout

This helps correlation with usdt probes, which are filtered out (really,
filtered in) by the dev/ino.

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


  Commit: 182688e33c22728f9c65e55d4422ddf1b459328c
      https://github.com/oracle/dtrace-utils/commit/182688e33c22728f9c65e55d4422ddf1b459328c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_parser.c

  Log Message:
  -----------
  String constants should be marked as DT_NF_DPTR

Although string constants are represented using a scalar offset into the
string constant table, the generated BPF code uses actual pointers into
the string constant table.  They are therefore pointers to DTrace-managed
storage (DT_NF_DPTR).

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


  Commit: 0236a08fead014896b7730c7716ed1843f041f37
      https://github.com/oracle/dtrace-utils/commit/0236a08fead014896b7730c7716ed1843f041f37
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M libdtrace/dt_parser.c
    A test/unittest/codegen/tst.execname-idx.d

  Log Message:
  -----------
  Ensure that 'execname' is not marked DPTR

The 'execname' builtin variable is a notable exception to REF-type
variables being DTrace-managed pointers.  It is a pointer into the
task_struct and therefore needs to be explicitly excluded from the
DPTR marking of variable nodes.

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


  Commit: 6d5cf4fb21f9d9938cc2d45bd8837270dd61da8f
      https://github.com/oracle/dtrace-utils/commit/6d5cf4fb21f9d9938cc2d45bd8837270dd61da8f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    M bpf/strcmp.S
    M libdtrace/dt_cg.c
    M test/unittest/builtinvar/tst.execname.d
    A test/unittest/codegen/tst.execname-cmp-bvar_lhs.d
    A test/unittest/codegen/tst.execname-cmp-bvar_rhs.d
    A test/unittest/codegen/tst.execname-cmp-const_lhs.d
    A test/unittest/codegen/tst.execname-cmp-const_rhs.d
    A test/unittest/codegen/tst.kernel_str-cmp-bvar_lhs.d
    A test/unittest/codegen/tst.kernel_str-cmp-bvar_rhs.d
    A test/unittest/codegen/tst.kernel_str-cmp-const_lhs.d
    A test/unittest/codegen/tst.kernel_str-cmp-const_rhs.d

  Log Message:
  -----------
  String args to dt_strcmp() need to be copied if not DPTR

The dt_strcmp() implementation makes use of indirect load instructions
to retrieve characters from either string argument.  That only works for
DTrace-managed storage pointers.  So, any argument that is not marked
DT_NF_DPTR must be copied into a tstring before the indirect loads are
done.

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


  Commit: 7ae3960b933ab3a8be9c67022865d4ec0c21ef18
      https://github.com/oracle/dtrace-utils/commit/7ae3960b933ab3a8be9c67022865d4ec0c21ef18
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-10-27 (Thu, 27 Oct 2022)

  Changed paths:
    A test/unittest/operators/tst.str_comparison-basic-with-NULL.d
    M test/unittest/operators/tst.str_comparison-basic.d

  Log Message:
  -----------
  test: split tst.str_comparison-basic.d into with and without NULL testing

Since NULL strings are not supported yet, the tst.str_comparison-basic.d
test is failing even though the non-NULL case should PASS without any
problem.  The test is now written as two tests: one that exercises the
case of NULL strings and one that does not.

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


  Commit: 147e59eddb624307657f1d9030db0c2d1d63858c
      https://github.com/oracle/dtrace-utils/commit/147e59eddb624307657f1d9030db0c2d1d63858c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M test/unittest/tracemem/tst.init_task.d
    M test/unittest/types/tst.complex.d

  Log Message:
  -----------
  Error out on unrecognized actions

Note that this patch causes a few spuriously passing tests now
to fail.  So, they must be marked XFAIL.

One odd test is tst.clearavg2.d.  It was already marked XFAIL,
with the message made even more specific in patch fb264ec9 ("test:
Annotate tests that require missing features"), indicting clear().
But the test had actually started passing a few patches earlier,
in f256db8f ("Implement setopt()"), when the consumer was modified
to skip over unrecognized DTRACEACT_LIBACT records.  So, the test
had started to XPASS, an indication of its leniency.  With the
current patch, that test now correctly XFAILs:  its behavior is
now in line with its XFAIL.

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


  Commit: 0bd5936069eae6ea63928406aeb75063283bb7b8
      https://github.com/oracle/dtrace-utils/commit/0bd5936069eae6ea63928406aeb75063283bb7b8
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

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

  Log Message:
  -----------
  test: Speed up check for modname-symname duplicates

When we check "lookup by name", a mismatch is allowed if there are
duplicates with the same modname and symname.  So, we must be able
to detect when such duplicates occur.  We were using a linear search.

Add a quick sort by modname/symname and then initialize a field
"is_duplicate" to speed up detection of duplicates.

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


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

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

  Log Message:
  -----------
  Ignore module name __builtin__kprobes in kallmodsyms

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


  Commit: 9ac7fbec3bcb58625411e27f31122afc3f4545dc
      https://github.com/oracle/dtrace-utils/commit/9ac7fbec3bcb58625411e27f31122afc3f4545dc
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

  Changed paths:
    M NEWS
    M dtrace.spec

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

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


  Commit: 286bdb385b7e4a589ec19d951535b29d4985347e
      https://github.com/oracle/dtrace-utils/commit/286bdb385b7e4a589ec19d951535b29d4985347e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

  Changed paths:
    M dtprobed/Build
    M dtprobed/dtprobed.service
    M dtprobed/dtrace-usdt.target
    M dtrace.spec

  Log Message:
  -----------
  dtprobed: start as early as possible

We'd like to start dtprobed *before* multi-user.target so that the
majority of daemons (those started after that point, in parallel)
already find it running and can register any USDT probes they may
contain.

We also need to "systemctl enable" everything at install time, since
dtprobed et al don't appear in the presets, so start disabled by
default.  (In the specfile, we not only need to do that but prod
udev to get the udev rules loaded.  This is peculiar since udev
uses filesystem notifies to do that itself, but if that's in the
packaging standard, so be it... we even need to start the thing
by hand after installation, because the systemd macros rely on
dtprobed being named in the presets, which it is not.)

Also turn off RestrictSUIDSGID: it's a good idea but it relies
on a seccomp filter, which stops us from enabling strict seccomp
later on for dtprobed's parser child.

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


  Commit: d322b7e969909925b0d27f56a787b99b1ce4801d
      https://github.com/oracle/dtrace-utils/commit/d322b7e969909925b0d27f56a787b99b1ce4801d
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

  Changed paths:
    M dtrace.spec

  Log Message:
  -----------
  spec: drop references to dtrace-modules-{shared,provider}-headers

These have been dead for long enough that we no longer need to obsolete
them (fixing a fatal rpmbuild "warning" on OL9).

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


  Commit: 57f2466c80dbf97f5500387de431cdbc35f34cd9
      https://github.com/oracle/dtrace-utils/commit/57f2466c80dbf97f5500387de431cdbc35f34cd9
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-01 (Tue, 01 Nov 2022)

  Changed paths:
    M NEWS

  Log Message:
  -----------
  NEWS: mention the dtprobed daemon

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


  Commit: 9778f6566d117bbb69135cba196abec457516164
      https://github.com/oracle/dtrace-utils/commit/9778f6566d117bbb69135cba196abec457516164
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-11-02 (Wed, 02 Nov 2022)

  Changed paths:
    M test/unittest/consumer/addr2str-null.c
    M test/unittest/consumer/tst.merge_ranges_bug25767469.c
    M test/unittest/consumer/tst.symbols.c

  Log Message:
  -----------
  test: mark dev-only tests with the 'uninstalled' tag

These tests depend on compilation using headers that are not installed.
As such, these tests can never PASS outside the development tree,

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


  Commit: 36aec7112db5ddc1ca3217381bb2f5183eeb9ebd
      https://github.com/oracle/dtrace-utils/commit/36aec7112db5ddc1ca3217381bb2f5183eeb9ebd
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-08 (Tue, 08 Nov 2022)

  Changed paths:
    M Makeconfig

  Log Message:
  -----------
  build: add header-only checking

The check-header-rule Makeconfig macro lets you check if a given
identifier compiles after #including a given header without trying to
link it.  This is useful for things that are distinguished by the
presence of a given identifier in the headers, where that identifier
corresponds to a symbol that won't actually link if used, perhaps
because of symbol versioning.

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


  Commit: c980b01738451765a31ee145b1a5d1fab0233a96
      https://github.com/oracle/dtrace-utils/commit/c980b01738451765a31ee145b1a5d1fab0233a96
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-08 (Tue, 08 Nov 2022)

  Changed paths:
    M dtprobed/dtprobed.c

  Log Message:
  -----------
  daemon: -o allow_other is useless, don't pass it in

The -o allow_other option to FUSE informs the kernel's FUSE-mounting API
that files on a given filesystem can be written to by users other than
the one running the daemon that mounted it.  Without this, not even root
can access it.

This serves to reduce the likelihood that users can attack each other
via badly-secured FUSE filesystems.

Back when I was struggling to get CUSE to work, I added this to the
argv options string passed to cuse_lowlevel_setup().  I never checked
after I got things working to see if it was actually needed, and it
turns out that since CUSE never mounts anything (it only creates a
device) and since CUSE bypasses the parts of FUSE that check whether
users are allowed to write to devices (relying instead on good old
permissions checking), the option is useless and ignored.

This has actually got less strict over time: libfuse 2 actually rejects
it and refuses to initialize.  So drop it entirely.

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


  Commit: c47002cdd7120d43b061d35dac696b7a2f717f38
      https://github.com/oracle/dtrace-utils/commit/c47002cdd7120d43b061d35dac696b7a2f717f38
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-08 (Tue, 08 Nov 2022)

  Changed paths:
    M GNUmakefile
    M Makeconfig

  Log Message:
  -----------
  build: add a mechanism to tell whether the tree is configured yet

This means that bits of makefiles that depend on configure symbols and
might emit noisy errors otherwise can be surrounded with ifdef
CONFIGURED to suppress their execution when the makefile is initially
run (when all it does is configure itself and restart parsing, resetting
all its variables to the configured values).

We fix another noisy error while we're here: the initial build routinely
displays

GNUmakefile:111: /home/oranix/oracle/private/dtrace/build/config.mk: No such file or directory

because the tree is not yet configured and config.mk hasn't been
created.

This buys us nothing and is just noisy: suppress it.

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


  Commit: 7ff38c75d83131c81383ee9688ab936b58bacf42
      https://github.com/oracle/dtrace-utils/commit/7ff38c75d83131c81383ee9688ab936b58bacf42
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-08 (Tue, 08 Nov 2022)

  Changed paths:
    M Makeconfig
    M Makeoptions
    M dtprobed/Build
    M dtprobed/dtprobed.c
    M dtrace.spec

  Log Message:
  -----------
  daemon: support libfuse 2

So it turns out that some people want to use libfuse 2 still, even
though it's been obsoleted by libfuse 3 for nearly a decade.  This turns
out to be not terribly difficult!

There are two major changess that impact us (ignoring the options-
parsing thing fixed in the last commit):

 - libfuse 2 has a 'channel' abstraction in which the fd to the kernel
   is nested.  libfuse 3 dropped it because it turned out there was only
   ever one of them so the abstraction was redundant, but that makes it
   easy for us to pick the fd out: we can grab the fuse_session_next_chan()
   without ever worrying that we might have to call that function more
   than once or deal with more than one channel.

   This changes the main read loop() enough that we can just implement
   it twice.

 - that's good because of another annoying difference: OL carries a
   NUMA-aware API which actually changes the public API of libfuse's
   fuse_session_receive_buf function.  This is hard to check for because
   the extra functions you need to call to actually turn this behaviour
   on were never added to the symbol version file, so you can't link
   with them.  So we detect these functions using the macros just added
   to do straight compilation checking, with no linking, and use their
   presence as a clue that fuse_session_receive_buf has the NUMA-aware
   API change.  (We don't use the NUMA stuff: it's only useful if you're
   using a multithreaded event loop, which we're not.)

We currently handle systems with both libfuse 2 and 3 by checking that
libfuse 3 is available, and if not, falling back to libfuse 2 (and if
that isn't present either you get a link failure).  Thus libfuse 3 is
preferred if both are present.  There is an additional libfuse2=yes
build option if you want to force the use of the old libfuse even when
the newer one is present.

One extra bit of complexity: we call pkg-config on whatever libfuse we
hope is present, and this emits very noisy multi-line error messages if
it isn't present: so suppress execution of all the dtprobed build rules
until the tree is configured and we have some idea of which libfuse is
there.

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


  Commit: a813850382dc734dadd11d6ba90d8ccccfae4c7d
      https://github.com/oracle/dtrace-utils/commit/a813850382dc734dadd11d6ba90d8ccccfae4c7d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M test/unittest/misc/tst.lockmem-cmdline.sh
    M test/unittest/misc/tst.lockmem-envvar.r
    M test/unittest/misc/tst.lockmem-envvar.sh
    M test/unittest/misc/tst.lockmem-pragma.r
    M test/unittest/misc/tst.lockmem-pragma.sh
    M test/unittest/misc/tst.lockmem-x.r
    M test/unittest/misc/tst.lockmem-x.sh

  Log Message:
  -----------
  test: Bump up locked memory in lockmem tests further

In a previous commit --
672c4532 "test: Bump up locked memory in lockmem tests"
-- the lockmem tests bumped up the locked-memory limit for cases where
DTrace is expected to load successfully.  That patch helped the tests
pass under wider conditions, but further increases are warranted.

Increase the lockmem limit for cases expecting successful loads.
Specifically, use 256G, as runtest.sh does for "ulimit -l".

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


  Commit: 0abe6125077ec1e4d84c3ec38a18a7d704ffbedd
      https://github.com/oracle/dtrace-utils/commit/0abe6125077ec1e4d84c3ec38a18a7d704ffbedd
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M NEWS

  Log Message:
  -----------
  NEWS: update to reflect new dependency and limitation

Added info about dependency on libfuse (2 or 3).

Added warning that copyin(), copyinstr(), and copyinto() may not work
on some aarch64 platforms due to limitations in the BPF implementation
at the kernel level.

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


  Commit: 58b76fb43396fc6db9da529b13e568f5599e2921
      https://github.com/oracle/dtrace-utils/commit/58b76fb43396fc6db9da529b13e568f5599e2921
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2022-11-09 (Wed, 09 Nov 2022)

  Changed paths:
    M test/triggers/Build

  Log Message:
  -----------
  install: ensure install-test does not have any dependencies

We went to some care to not depend 'make install' on anything -- with
one exception.  test/triggers/Build contains an install-test rule that
depends on triggers, which pulls in libproc-pldd, which pulls in
libdtrace, and now we're rebuilding everything.

Rip out this dependency.  (If rebuilding was really needed, this rule is
the wrong place to do it from anyway: and if no building has happened at
all the installation will have failed long before now.)

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


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

  Changed paths:
    M README.md

  Log Message:
  -----------
  Update README.md

- Updated the OLx yum channels
- Updated the build and runtime dependency lists

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


  Commit: 11cc63904e1a78bae55fda07d3a343cd9f751294
      https://github.com/oracle/dtrace-utils/commit/11cc63904e1a78bae55fda07d3a343cd9f751294
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M bpf/Build

  Log Message:
  -----------
  bpf: fix linking of include/asm directory

The bpf/Build file contained code to select the appropriate include
directory to link into the DTrace build directory hierarchy, but it
then happily overwrote that with a link to /usr/include/asm.

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


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

  Changed paths:
    M cmd/dtrace.c
    M libdtrace/dt_handle.c
    M libdtrace/dt_printf.c

  Log Message:
  -----------
  cmd, libdtrace: fix potentially unsafe printf-like calls

GCC 12 flagged some calls to printf-style functions for using a dynamic
string as format without arguments.  If the dymanic string somehow can
be made to contain a substitution sequence (%<something>) this would be
unsafe.

Due to some special case handing for error strings ending in a newline
character, the default error, liberr, and drop strings are adjusted as
well.

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


  Commit: 6edf90bdf26fc58489904819149b22d0a1e211cf
      https://github.com/oracle/dtrace-utils/commit/6edf90bdf26fc58489904819149b22d0a1e211cf
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M GNUmakefile
    M cmd/Build
    R cmd/dtrace.1
    A cmd/dtrace.8
    M dtrace.spec

  Log Message:
  -----------
  man: fix manpage

The manpage is moved to section 8 (System Management Commands) since
that is more appropriate.  This also makes it no longer necessary to
handle the conflict with the dtrace manpage provided by systemtap for
its dtrace-lookalike utility.

The formatting macros have been updated to use the simpler (standard)
ones described in groff_man.

References to the Oracle Linux DTrace Guide have been updated.

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


  Commit: 0045dd7e3a730720048cafbfb1dac8143d3e2b46
      https://github.com/oracle/dtrace-utils/commit/0045dd7e3a730720048cafbfb1dac8143d3e2b46
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M include/dtrace/dif_defines.h

  Log Message:
  -----------
  Increase the maximum size of strstab

The strtab size was limited in the legacy version to 0x7fff.  This
was generally sufficient because of how the strtab was implemented.
Now that all strings used in a probe program are stored in a single
strtab (incl. probe description names), a higher limit is needed.

All string offsets (and strtab size calculations) are using ssize_t,
so we use SSIZE_MAX as the upper limit.

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


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

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

  Log Message:
  -----------
  Introduce a 'raw' error reporting mechanism

The error handling mechanism between libdtrace and consumer front-ends
(like dtrace) only allowed the reporting of error messages related to
probing activity.  There is a need to allow libdtrace API functions
the ability to report error conditions to the consumer front-end.
Especially errors encountered while enabling probes can benefit from
this mechanism to report the issues.

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


  Commit: 1e6e48613946b23efe23a0c74edddfa4e4b03a5e
      https://github.com/oracle/dtrace-utils/commit/1e6e48613946b23efe23a0c74edddfa4e4b03a5e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M include/port.h
    M libdtrace/dt_error.c

  Log Message:
  -----------
  Use symbol name for 'not supported' error codes

The kernel uprobes implementation uses ENOTSUPP to indicate that a
uprobe could not be enabled, but this error code is not listed with
a symbolic name in userspace header files.

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


  Commit: 7c655ca914e7291fcf0800d54c0564d518286400
      https://github.com/oracle/dtrace-utils/commit/7c655ca914e7291fcf0800d54c0564d518286400
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

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

  Log Message:
  -----------
  Report an error to the consumer if a probe cannot be enabled

Some probes (esp. uprobes) appear to be useable, but yet the kernel
tracing subsystem reports a failure when trying to enable the probe.
It need not be a fatal error (esp. when probing a set of probes based
on a wildcard specification), but it should get reported.

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


  Commit: d090056fc1427e733b6c4934da993645348f9b91
      https://github.com/oracle/dtrace-utils/commit/d090056fc1427e733b6c4934da993645348f9b91
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-01-18 (Wed, 18 Jan 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/bcopy/err.badbcopy.d
    A test/unittest/funcs/bcopy/err.badbcopy.r
    A test/unittest/funcs/bcopy/err.badbcopy1.d
    A test/unittest/funcs/bcopy/err.badbcopy1.r
    A test/unittest/funcs/bcopy/err.badbcopy2.d
    A test/unittest/funcs/bcopy/err.badbcopy2.r
    A test/unittest/funcs/bcopy/err.badbcopy3.d
    A test/unittest/funcs/bcopy/err.badbcopy3.r
    A test/unittest/funcs/bcopy/err.badbcopy4.d
    A test/unittest/funcs/bcopy/err.badbcopy4.r
    A test/unittest/funcs/bcopy/err.badbcopy5.d
    A test/unittest/funcs/bcopy/err.badbcopy5.r
    A test/unittest/funcs/bcopy/err.badbcopy6.d
    A test/unittest/funcs/bcopy/err.badbcopy6.r
    A test/unittest/funcs/bcopy/err.badbcopy7.d
    A test/unittest/funcs/bcopy/err.badbcopy7.r
    A test/unittest/funcs/bcopy/err.badbcopy8.d
    A test/unittest/funcs/bcopy/err.badbcopy8.r
    A test/unittest/funcs/bcopy/tst.bcopy.d
    A test/unittest/funcs/bcopy/tst.bcopy2.d
    R test/unittest/funcs/err.badbcopy.d
    R test/unittest/funcs/err.badbcopy.r
    R test/unittest/funcs/err.badbcopy1.d
    R test/unittest/funcs/err.badbcopy1.r
    R test/unittest/funcs/err.badbcopy2.d
    R test/unittest/funcs/err.badbcopy2.r
    R test/unittest/funcs/err.badbcopy3.d
    R test/unittest/funcs/err.badbcopy3.r
    R test/unittest/funcs/err.badbcopy4.d
    R test/unittest/funcs/err.badbcopy4.r
    R test/unittest/funcs/err.badbcopy5.d
    R test/unittest/funcs/err.badbcopy5.r
    R test/unittest/funcs/err.badbcopy6.d
    R test/unittest/funcs/err.badbcopy6.r
    R test/unittest/funcs/err.badbcopy7.d
    R test/unittest/funcs/err.badbcopy7.r
    R test/unittest/funcs/err.badbcopy8.d
    R test/unittest/funcs/err.badbcopy8.r
    R test/unittest/funcs/tst.bcopy.d

  Log Message:
  -----------
  cg: lift restriction of 1st arg to bcopy() not being alloca

The documentation states that the source address is not allowed to be
within the scratch memory region, but the legacy implementation does
not actually enforce that restriction, nor does it seem necessary.

This patch also moves bcopy tests into their own directory.

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


  Commit: ca761db74a141cf2b8758575e651320f99dc62bc
      https://github.com/oracle/dtrace-utils/commit/ca761db74a141cf2b8758575e651320f99dc62bc
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-01-18 (Wed, 18 Jan 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_profile.c
    M libdtrace/dt_prov_uprobe.c

  Log Message:
  -----------
  Standardize use of %r7, %r8, and %r9 in trampoline generation

In libdtrace/dt_cg.c, a number of functions generate the trampoline.

After a call to dt_cg_tramp_prologue[_act](), we can expect:
    %r7 contains a pointer to dctx->mst
    %r8 contains a pointer to dctx->ctx
    %r9 contains a pointer to dctx

Most other calls to dt_cg_tramp_*() functions rely on these values.
However,
    dt_cg_tramp_copy_args_from_regs()
    dt_cg_tramp_copy_regs()
    dt_cg_tramp_copy_rval_from_regs()
all pass BPF_REG_8 in via an argument rp.  This is unnecessary.  In fact,
the last two functions don't even use the passed-in argument, already using
the known, hard-wired value BPF_REG_8 instead.

Do not pass BPF_REG_8 in to these functions.  Clean up the comments and
interfaces and switch dt_cg_tramp_copy_args_from_regs() to use BPF_REG_8
explicitly, as the other functions already do.

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


  Commit: 412c5f2be7410e066f86b079b34de1321165f9c8
      https://github.com/oracle/dtrace-utils/commit/412c5f2be7410e066f86b079b34de1321165f9c8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-16 (Thu, 16 Feb 2023)

  Changed paths:
    M libdtrace/dt_probe.c

  Log Message:
  -----------
  probe: ensure probe argument info is retrieved only once per probe

Throughout the compilation process there are multiple points where
probe argument information is requested from the providers.  This
data cannot change during a runtime of DTrace and there is therefore
no reason to go through the process of retrieving it more than once.

The prp->argc (probe argument count) is used to determine if argument
data has been obtained.  It is initially -1, and will be 0 or greater
once argument data has been requested.

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


  Commit: ff2766d56d065171cb34130f1204549e5f2caa80
      https://github.com/oracle/dtrace-utils/commit/ff2766d56d065171cb34130f1204549e5f2caa80
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M test/unittest/funcs/copyin/tst.copyin.d
    M test/unittest/funcs/copyin/tst.copyin.r
    M test/unittest/funcs/copyinstr/tst.copyinstr-low-maxsize.d
    M test/unittest/funcs/copyinstr/tst.copyinstr-low-maxsize.r
    M test/unittest/funcs/copyinstr/tst.copyinstr-no-maxsize.d
    M test/unittest/funcs/copyinstr/tst.copyinstr-no-maxsize.r
    M test/unittest/funcs/copyinstr/tst.copyinstr.d
    M test/unittest/funcs/copyinstr/tst.copyinstr.r
    M test/unittest/funcs/copyinto/tst.copyinto.d
    M test/unittest/funcs/copyinto/tst.copyinto.r

  Log Message:
  -----------
  tests: Use distinct trigger for copyin* tests

Many copyin* tests implement a trigger by running system("echo foo")
in the BEGIN probe.  This requires a destructive action, which is okay
but does make these "unit tests" rely on features unrelated to the
tests.

The main problem, however, is that the check that the corresponding
write:entry probe has fired on the correct process becomes very weak
-- e.g., just checking that a particular char is '-'.  And in the case
of copyinto, this check is unnecessarily complicated.  Finally, if
such a process is not found, the test would hang.

Use @@trigger.  E.g., delaydie will quickly terminate, emiting a simple
message, which is all we need for these tests.

The existing predicates check being able to:
- cast the return value of copyin() to string
- use indexing on the cast value
- use indexing on the return value of copyinstr()
Each such predicate is replaced with a conditionalized printf.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_open.c
    R test/unittest/funcs/copyinstr/err.D_ALLOCA_SIZE.d
    A test/unittest/funcs/copyinstr/tst.copyinstr-high-maxsize.d
    A test/unittest/funcs/copyinstr/tst.copyinstr-high-maxsize.r

  Log Message:
  -----------
  cg, test: fix copyinstr() implementation to use a tstring

Since copyinstr() returns a string, it should be using a temporary
string like other string functions.  Also, semantics needed fixing to
apply strsize as an upper limit to the optional size rather than
triggering a fault if the size is greater than strsize.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_parser.c
    A test/unittest/actions/printf/tst.conv_s_alloca_var.d
    A test/unittest/actions/printf/tst.conv_s_alloca_var.r
    A test/unittest/actions/printf/tst.conv_s_copyin.d
    A test/unittest/actions/printf/tst.conv_s_copyin.r
    A test/unittest/actions/printf/tst.conv_s_copyinstr.d
    A test/unittest/actions/printf/tst.conv_s_copyinstr.r
    A test/unittest/funcs/bcopy/err.bcopy-into-string.d
    A test/unittest/funcs/bcopy/tst.bcopy-into-alloca.d
    A test/unittest/funcs/bcopy/tst.bcopy-into-alloca.r
    A test/unittest/funcs/bcopy/tst.bcopy-into-string-indirect.d
    A test/unittest/funcs/bcopy/tst.bcopy-into-string-indirect.r

  Log Message:
  -----------
  cg, parser: fix handling of alloca()'d string values

When alloca()'d memory is used as a string, special handling is needed
to ensure variable assignment and storing in the output buffer works
correctly.

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


  Commit: 35900cb0025e5e8fabc844230ba4c3aa4f0675fc
      https://github.com/oracle/dtrace-utils/commit/35900cb0025e5e8fabc844230ba4c3aa4f0675fc
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M libdtrace/dt_open.c

  Log Message:
  -----------
  Mark subroutines with appropriate ALLOCA and DPTR flags

Clearly, alloca() should be marked ALLOCA.

We also return copyin() in scratch memory.

These and other subroutines return results in DTrace-managed storage.

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


  Commit: a7ee5e88f06d71cb65febe5e33299a06d35eb866
      https://github.com/oracle/dtrace-utils/commit/a7ee5e88f06d71cb65febe5e33299a06d35eb866
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/codegen/tst.ALLOCA.d
    A test/unittest/codegen/tst.ALLOCA.r
    A test/unittest/codegen/tst.ALLOCA.r.p

  Log Message:
  -----------
  test: Add test to check ALLOCA flag propagation

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


  Commit: 8e0b0fe41d1a68d6cda9a7c6e1d885106fa3a35a
      https://github.com/oracle/dtrace-utils/commit/8e0b0fe41d1a68d6cda9a7c6e1d885106fa3a35a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/codegen/tst.DPTR.d
    A test/unittest/codegen/tst.DPTR.r
    A test/unittest/codegen/tst.DPTR.r.p

  Log Message:
  -----------
  test: Add test to check DPTR flag propagation

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


  Commit: 850eb0d0a12e7d25114e434b4a5d115670d082ec
      https://github.com/oracle/dtrace-utils/commit/850eb0d0a12e7d25114e434b4a5d115670d082ec
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/basename.S
    A test/unittest/funcs/tst.basename_nonDPTR.d
    A test/unittest/funcs/tst.basename_nonDPTR.r

  Log Message:
  -----------
  Support basename() for addresses that are not DTrace pointers

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


  Commit: 500a825cf1fe3ec8efa13e4f24dcffeaa04933d4
      https://github.com/oracle/dtrace-utils/commit/500a825cf1fe3ec8efa13e4f24dcffeaa04933d4
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/dirname.S
    A test/unittest/funcs/tst.dirname_nonDPTR.d
    A test/unittest/funcs/tst.dirname_nonDPTR.r

  Log Message:
  -----------
  Support dirname() for addresses that are not DTrace pointers

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


  Commit: 0903985768bc950c5e36f96d36ac3311542c7c5c
      https://github.com/oracle/dtrace-utils/commit/0903985768bc950c5e36f96d36ac3311542c7c5c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/strrchr.S
    A test/unittest/funcs/tst.strchr_nonDPTR.d
    A test/unittest/funcs/tst.strchr_nonDPTR.r

  Log Message:
  -----------
  Support strrchr() for addresses that are not DTrace pointers

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/copyin/tst.copyin-retval-ok.d

  Log Message:
  -----------
  cg: fix return value of copyin()

The copyin() function was returning the resolved alloca pointer rather
than the offset into scratchmem (as it should have).  Now that the
function is correctly marked as returning an alloca-pointer, it needs
to return the native representation of an alloca-pointer, i.e. as an
offset into scratchmem.

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


  Commit: 5d0d980181d179f444445792dc13b2cfcf0015d7
      https://github.com/oracle/dtrace-utils/commit/5d0d980181d179f444445792dc13b2cfcf0015d7
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/inet_ntoa.S
    A test/unittest/funcs/tst.inet_ntoa_alloca.d
    A test/unittest/funcs/tst.inet_ntoa_alloca.r
    A test/unittest/funcs/tst.inet_ntoa_copyin.d
    A test/unittest/funcs/tst.inet_ntoa_copyin.r
    A test/unittest/funcs/tst.inet_ntoa_nonDPTR.d
    A test/unittest/funcs/tst.inet_ntoa_nonDPTR.r

  Log Message:
  -----------
  Support inet_ntoa() for addresses that are not DTrace pointers

If the input argument to inet_ntoa() is not a DTrace pointer, the
BPF verifier cannot confirm it is safe.  So first copy the input
data to the BPF stack using the probe_read() helper function.

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


  Commit: c6efccb6003c41180526ef23a715360dc1175067
      https://github.com/oracle/dtrace-utils/commit/c6efccb6003c41180526ef23a715360dc1175067
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/funcs/tst.index_nonDPTR.d
    A test/unittest/funcs/tst.index_nonDPTR.r

  Log Message:
  -----------
  test: Check index() for addresses that are not DTrace pointers

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


  Commit: 1718548746d7224bc4da91c42564bd6de2f8dba2
      https://github.com/oracle/dtrace-utils/commit/1718548746d7224bc4da91c42564bd6de2f8dba2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/funcs/tst.rindex_nonDPTR.d
    A test/unittest/funcs/tst.rindex_nonDPTR.r

  Log Message:
  -----------
  test: Check rindex() for addresses that are not DTrace pointers

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


  Commit: 832db07c8b74693dda40be9a6dfb6697c500af55
      https://github.com/oracle/dtrace-utils/commit/832db07c8b74693dda40be9a6dfb6697c500af55
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d
    A test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r

  Log Message:
  -----------
  test: Check strjoin() for addresses that are not DTrace pointers

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


  Commit: 542807fcaa6c9e3d6913a5f8210c3bd4ff1fb4cf
      https://github.com/oracle/dtrace-utils/commit/542807fcaa6c9e3d6913a5f8210c3bd4ff1fb4cf
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/funcs/substr/tst.substr_nonDPTR.d
    A test/unittest/funcs/substr/tst.substr_nonDPTR.r

  Log Message:
  -----------
  test: Check substr() for addresses that are not DTrace pointers

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


  Commit: 469268ed206b19374ab5cdc2a83f0735ca0a564a
      https://github.com/oracle/dtrace-utils/commit/469268ed206b19374ab5cdc2a83f0735ca0a564a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    A test/unittest/funcs/strtok/tst.strtok_nonDPTR.d
    A test/unittest/funcs/strtok/tst.strtok_nonDPTR.r

  Log Message:
  -----------
  test: Check strtok() for addresses that are not DTrace pointers

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


  Commit: 61ddca479f4a8cfb287f0ca5e1bf112447a01755
      https://github.com/oracle/dtrace-utils/commit/61ddca479f4a8cfb287f0ca5e1bf112447a01755
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/strcmp.S

  Log Message:
  -----------
  Clean up comments and remove unneeded code in strcmp.S

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


  Commit: 2bbcf5802b13dc0b2b28eb645d36a66deb8b51a2
      https://github.com/oracle/dtrace-utils/commit/2bbcf5802b13dc0b2b28eb645d36a66deb8b51a2
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-20 (Mon, 20 Feb 2023)

  Changed paths:
    M bpf/strcmp.S

  Log Message:
  -----------
  Simplify strcmp.S

The code branched depending on whether the first string is known
to be a pointer to D-managed storage.  If we simply assume that
the storage is never D-managed, we can save two instructions as
well as a conditional jump (the bane of the BPF verifier).  The
execution path ends up a couple of instructions either longer or
shorter depending on the case.  The resulting implementation is
closer to that of other string subroutines.

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


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

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: use indirect load instructions for scalar DPTR and ALLOCA pointers

Both ALLOCA and DPTR pointers can use indirect load instructions rather
than requiring bpf_probe_read().

The DT_TOK_DOT case can benefit from this also (and is included in this
patch) even though that code path is not currently possible due to a
bug in the ALLOCA flag propagation.  Once that is fixed, code generation
for DT_TOK_DOT for ALLOCA pointers will use indirect load instructions.

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


  Commit: 293cb09da894d431809ac7b76a0de10b0d830e9f
      https://github.com/oracle/dtrace-utils/commit/293cb09da894d431809ac7b76a0de10b0d830e9f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_bpf.c
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_impl.h
    M test/stress/buffering/err.resize2.r

  Log Message:
  -----------
  bpf: add 'agggen' BPF map

The 'agggen' BPF map associates a generation counter with an aggregation
ID.  It will be used to determine whether the aggregation data in the
'aggs' map for aggregations associated with a given aggregation ID is
valid or stale.

The initial generation counter for each aggregation is 1 (because 0 is
used to indicate a no-data condition).

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


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

  Changed paths:
    M bpf/get_agg.c

  Log Message:
  -----------
  bpf: add agggen handling to dt_get_agg()

The dt_get_agg() function will now consult the generation value for the
aggregation id.  If existing data is of an earlier generation, the data
is reset.

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


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

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

  Log Message:
  -----------
  agg: split clearing of one aggregation into its own function

The new dt_aggregate_clear_one() function is designed to allow it to be
passed to a callback function to the aggregation walk functions.  It
will be used in that manner in future patches.

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


  Commit: 448adfc3a9e750b1248fa46b025471931a1688c4
      https://github.com/oracle/dtrace-utils/commit/448adfc3a9e750b1248fa46b025471931a1688c4
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M cmd/dtrace.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_work.c

  Log Message:
  -----------
  Implement switchrate-based consumer loop

The switchrate option was not implemented in the BPF-based DTrace
implementation.  And commit 96d4dfeb (" Eliminate obsolete dt_last*")
removed the dtp->dt_lastswitch member from struct dtrace_hdl.  This
patch brings dt_lastswitch back and implements the switchrate option
as a way to limit the frequency of buffer polls.

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


  Commit: 21763e1375c9d44cb9916ddddabd777452b7a21f
      https://github.com/oracle/dtrace-utils/commit/21763e1375c9d44cb9916ddddabd777452b7a21f
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_open.c
    M libdtrace/dt_work.c

  Log Message:
  -----------
  Implement aggrate-based aggregation snapshots

Some aggregation operations like clear() depend on aggregation snapshot
frequency.

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


  Commit: 4091f50eb492c85a62339912bde8234048b903ea
      https://github.com/oracle/dtrace-utils/commit/4091f50eb492c85a62339912bde8234048b903ea
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_aggregate.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dtrace.h
    M test/unittest/aggs/tst.clear.d
    M test/unittest/aggs/tst.clearavg.d
    M test/unittest/aggs/tst.clearavg2.d
    M test/unittest/aggs/tst.cleardenormalize.d
    M test/unittest/aggs/tst.clearlquantize.d
    M test/unittest/aggs/tst.clearnormalize.d

  Log Message:
  -----------
  Implement clear()

The clear() action is implemented by incrementing the global generation
counter for an aggregation name and clearing the data for matching
aggregations within the consumer.  If aggregation data in a snapshot is
found to have an older generation, it is discarded.  The producer side
will already clear its data when the generation counter is found to be
higher than the generation of the data in a CPU's agg buffer.

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


  Commit: 2ba7c3bd76fbbbfadd07adcffd21560aa5f2aeb3
      https://github.com/oracle/dtrace-utils/commit/2ba7c3bd76fbbbfadd07adcffd21560aa5f2aeb3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M dtrace.spec
    M libdtrace/Build
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_cpc.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  Add a CPC provider

Use libpfm to populate CPC probes.

The PC is placed into arg0 (if kernel) or arg1 (if user-space),
the other arg being 0.  This initialization is in a new function
dt_cg_tramp_copy_PC_from_regs() so that it can be used by any other
provider (like profile) that needs it.

Current limitations include:

*)  no support for optional attributes

*)  no support for raw events

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


  Commit: dc265528fdf9730cbaf31d90781856b7b13777a6
      https://github.com/oracle/dtrace-utils/commit/dc265528fdf9730cbaf31d90781856b7b13777a6
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/cpc/tst.cpu_clock.d
    A test/unittest/cpc/tst.cpu_clock2.d
    A test/unittest/cpc/tst.cpu_clock2.r
    A test/unittest/cpc/tst.cpu_clock2.r.p
    A test/unittest/cpc/tst.list_cpc.sh

  Log Message:
  -----------
  cpc: Add simple tests

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


  Commit: 1cc9866e1ac0b0e78b586c7e5d8141e0c1750ba1
      https://github.com/oracle/dtrace-utils/commit/1cc9866e1ac0b0e78b586c7e5d8141e0c1750ba1
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M dtrace.spec
    A test/unittest/cpc/tst.branches.sh
    A test/unittest/cpc/tst.branches.x
    A test/unittest/cpc/tst.instructions.sh
    A test/unittest/cpc/tst.instructions.x
    M test/utils/.gitignore
    M test/utils/Build
    A test/utils/check_result.sh
    A test/utils/workload_analyze_loop.sh
    A test/utils/workload_get_iterations.sh
    A test/utils/workload_user.c

  Log Message:
  -----------
  cpc: Add some hardware-counter tests

Test hardware counters using both "branches" and "instructions" events.
Use "perf list hw" to check if these events are supported on the test
system.

A few utilities are introduced for these and future tests:

  * workload_user.c is a simple, user-space-intensive
    workload with very simple performance behavior:

      * one branch per iteration

      * a number of instructions per iteration that
        is easily determined from its disassembly

  * workload_get_iterations.sh estimates how many iterations
    to use to run the desired number of seconds

  * workload_analyze_loop.sh analyzes the disassembly of
    the innermost loop of something like workload_user.c;
    reporting the number of instructions per iteration and
    which PCs are in the loop

  * check_result.sh checks an actual count against
    an expected count to within some margin

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


  Commit: a7c14837f818729d67e766b1c8d41e8b53234b9b
      https://github.com/oracle/dtrace-utils/commit/a7c14837f818729d67e766b1c8d41e8b53234b9b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/cpc/tst.args_kernel.sh
    A test/unittest/cpc/tst.args_user.sh
    M test/utils/.gitignore
    M test/utils/Build
    A test/utils/perf_count_event.sh
    A test/utils/workload_kernel.c

  Log Message:
  -----------
  cpc: Add probe-args tests

A few additional utilities are added to support these and future tests:

  * workload_kernel.c is a simple, kernel-intensive workload

  * perf_count_event.sh uses "perf stat" to count some event for
    some executable

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


  Commit: e379031c9b94d545e2d9f6c9335817bcc64f819b
      https://github.com/oracle/dtrace-utils/commit/e379031c9b94d545e2d9f6c9335817bcc64f819b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/cpc/tst.mode_kernel.sh
    A test/unittest/cpc/tst.mode_user.sh
    M test/utils/Build
    A test/utils/cpc_get_events.sh

  Log Message:
  -----------
  cpc: Add mode tests

CPC probes can specify modes: all, user, and kernel.  These tests check
"all" against "perf stat" results.  They check "user" and "kernel" by
using workloads that are known to be user-space- or kernel-intensive.

An extra utility is added to support these tests:

  * cpc_get_events.sh composes a list of events to test on
    the current system

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


  Commit: 5ff65f467554b76efdbfc7d38021b8c1148395bf
      https://github.com/oracle/dtrace-utils/commit/5ff65f467554b76efdbfc7d38021b8c1148395bf
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/tst.branches.x
    M test/unittest/cpc/tst.instructions.x
    M test/utils/Build
    M test/utils/cpc_get_events.sh
    A test/utils/cpc_temp_skip_bug.sh

  Log Message:
  -----------
  cpc: Put in a temporary safeguard against some mystery bug

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


  Commit: 51535a1f0834c8a88db8b20dc981d11149617be0
      https://github.com/oracle/dtrace-utils/commit/51535a1f0834c8a88db8b20dc981d11149617be0
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/cpc/err.D_PDESC_ZERO.lowfrequency.d
    A test/unittest/cpc/err.D_PDESC_ZERO.malformedoverflow.d
    A test/unittest/cpc/err.D_PDESC_ZERO.nonexistentevent.d
    A test/unittest/cpc/err.cpcvscpustatpart1.ksh
    A test/unittest/cpc/err.cpcvscpustatpart2.ksh
    A test/unittest/cpc/err.cputrackfailtostart.ksh
    A test/unittest/cpc/err.cputrackterminates.ksh
    A test/unittest/cpc/err.toomanyenablings.d
    A test/unittest/cpc/tst.allcpus.ksh
    A test/unittest/cpc/tst.genericevent.d
    A test/unittest/cpc/tst.platformevent.ksh

  Log Message:
  -----------
  cpc: Import tests from Solaris

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


  Commit: 8653d23565d0763d58652885c511abf91bac8333
      https://github.com/oracle/dtrace-utils/commit/8653d23565d0763d58652885c511abf91bac8333
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/err.D_PDESC_ZERO.lowfrequency.d
    M test/unittest/cpc/err.D_PDESC_ZERO.malformedoverflow.d
    M test/unittest/cpc/err.D_PDESC_ZERO.nonexistentevent.d
    M test/unittest/cpc/err.cpcvscpustatpart1.ksh
    M test/unittest/cpc/err.cpcvscpustatpart2.ksh
    M test/unittest/cpc/err.cputrackfailtostart.ksh
    M test/unittest/cpc/err.cputrackterminates.ksh
    M test/unittest/cpc/err.toomanyenablings.d
    M test/unittest/cpc/tst.allcpus.ksh
    M test/unittest/cpc/tst.genericevent.d
    M test/unittest/cpc/tst.platformevent.ksh

  Log Message:
  -----------
  cpc: Fix copyrights on tests imported from Solaris

See these commits:
    e384b684cc77 Fix up copyrights
    1b911cea0f52 UPL relicensing, stage 2: automated modifications.
    4187a7baf76c Add missing copyright headers.

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


  Commit: e209984e3ef82b24be93abb1e82a8cdca2d9a3ad
      https://github.com/oracle/dtrace-utils/commit/e209984e3ef82b24be93abb1e82a8cdca2d9a3ad
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/err.D_PDESC_ZERO.lowfrequency.d
    M test/unittest/cpc/err.D_PDESC_ZERO.malformedoverflow.d
    M test/unittest/cpc/err.D_PDESC_ZERO.nonexistentevent.d

  Log Message:
  -----------
  cpc: Clean up err.D_PDESC_ZERO* tests imported from Solaris

Among other things, change the Solaris generic event PAPI_tot_ins
to cpu_clock.

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


  Commit: e80ad92871914fabca8c0944b0a38bc678dac13b
      https://github.com/oracle/dtrace-utils/commit/e80ad92871914fabca8c0944b0a38bc678dac13b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    R test/unittest/cpc/err.cpcvscpustatpart1.ksh
    A test/unittest/cpc/err.cpcvscpustatpart1.sh
    R test/unittest/cpc/err.cpcvscpustatpart2.ksh
    A test/unittest/cpc/err.cpcvscpustatpart2.sh
    R test/unittest/cpc/err.cputrackfailtostart.ksh
    A test/unittest/cpc/err.cputrackfailtostart.sh
    R test/unittest/cpc/err.cputrackterminates.ksh
    A test/unittest/cpc/err.cputrackterminates.sh
    R test/unittest/cpc/tst.allcpus.ksh
    A test/unittest/cpc/tst.allcpus.sh
    R test/unittest/cpc/tst.platformevent.ksh
    A test/unittest/cpc/tst.platformevent.sh

  Log Message:
  -----------
  cpc: Change Solaris-imported *.ksh tests to *.sh

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


  Commit: f9c405614f7172a176110c291e7fd5f945277895
      https://github.com/oracle/dtrace-utils/commit/f9c405614f7172a176110c291e7fd5f945277895
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/err.cpcvscpustatpart1.sh
    M test/unittest/cpc/err.cpcvscpustatpart2.sh
    M test/unittest/cpc/err.cputrackfailtostart.sh
    M test/unittest/cpc/err.cputrackterminates.sh

  Log Message:
  -----------
  cpc: Skip cputrack and cpustat tests

Also, the default event should be changed from PAPI_tot_ins to
cpu-clock.  At this point, there is no need to do so (after all,
the tests are being skipped), but the new comment is a reminder
that this is needed.

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


  Commit: 4734ef302cf78b41a9481259d1f2d9da88a08cef
      https://github.com/oracle/dtrace-utils/commit/4734ef302cf78b41a9481259d1f2d9da88a08cef
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/tst.genericevent.d

  Log Message:
  -----------
  cpc: Update the Solaris generic-event test

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


  Commit: dad6beb015b87338e7e3ef9ea74fa5156993f1b3
      https://github.com/oracle/dtrace-utils/commit/dad6beb015b87338e7e3ef9ea74fa5156993f1b3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/tst.allcpus.sh

  Log Message:
  -----------
  cpc: Update Solaris allcpus test

Replace psrinfo calls with info from /proc/cpuinfo.

Replace PAPI_tot_ins with cpu_clock.

Eliminate the spinner processes.

Add reinvoke since, for some as yet unknown reason, not every CPU shows
up every time.

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


  Commit: 16c18d1c76e1a1be12d650b9754d22286f42fcc3
      https://github.com/oracle/dtrace-utils/commit/16c18d1c76e1a1be12d650b9754d22286f42fcc3
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/codegen/tst.tstring_asgn_expr.d
    M test/unittest/codegen/tst.tstring_ternary.d

  Log Message:
  -----------
  test: Fix a tiny typo

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


  Commit: 2997f4bf48a6b3656f9bc72c169bbea908261422
      https://github.com/oracle/dtrace-utils/commit/2997f4bf48a6b3656f9bc72c169bbea908261422
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/cpc/tst.platformevent.sh

  Log Message:
  -----------
  cpc: Skip platform-specific test for now

It needs to be ported from cpustat, but we also have to decide what
a "platform-specific event" means now.

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


  Commit: ea6f170d2519311ab69fd42bae24ea68791a7107
      https://github.com/oracle/dtrace-utils/commit/ea6f170d2519311ab69fd42bae24ea68791a7107
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_prov_profile.c
    A test/unittest/profile-n/tst.args_kernel.sh
    A test/unittest/profile-n/tst.args_user.sh

  Log Message:
  -----------
  Fix profile-provider probe args arg0 and arg1

Set arg0 and arg1 for the profile provider.

Note that arg2 is still not unimplemented.

Add stronger tests for profile-* probe args.  (Since the new tests use
a target process that might be running on a different CPU from where
a tick-* probe fires, we do not add corresponding tick-* tests.
On the other hand, testing arg0 and arg1 for profile-* ought to be
sufficient.)

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


  Commit: 3bc04c20c2543e97a970d9da587e71a47b85535b
      https://github.com/oracle/dtrace-utils/commit/3bc04c20c2543e97a970d9da587e71a47b85535b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

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

  Log Message:
  -----------
  test: Add test for incdir option

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


  Commit: d26c97e47146175e2f7d0761e4bd2e484b2609e8
      https://github.com/oracle/dtrace-utils/commit/d26c97e47146175e2f7d0761e4bd2e484b2609e8
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/pcap/tst.pcap.stdout-fork-error.sh
    M test/unittest/pcap/tst.pcap.stdout.sh

  Log Message:
  -----------
  test: Check DTrace return status in pcap stdout tests

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


  Commit: bbc7f1466793361a9cee032c77904038a0c5ff38
      https://github.com/oracle/dtrace-utils/commit/bbc7f1466793361a9cee032c77904038a0c5ff38
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M test/unittest/tracemem/err.D_TRACEMEM_ADDR.badaddr.d
    M test/unittest/tracemem/err.D_TRACEMEM_SIZE.negsize.d
    M test/unittest/tracemem/err.D_TRACEMEM_SIZE.zerosize.d
    M test/unittest/tracemem/tst.init_task.d
    R test/unittest/tracemem/tst.three_arg.sh
    A test/unittest/tracemem/tst.tracemem.d
    A test/unittest/tracemem/tst.tracemem.r
    A test/unittest/tracemem/tst.tracemem.r.p
    M test/unittest/types/tst.complex.d

  Log Message:
  -----------
  Add tracemem support

Also, replace tst.three_arg.sh with tst.tracemem.d:
- to avoid the problematic profile probe (fires irregularly)
- for cleaner post processing
- to check both 2-arg and 3-arg results

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


  Commit: 279196b58663b04d19276ff58ca67350f28fd483
      https://github.com/oracle/dtrace-utils/commit/279196b58663b04d19276ff58ca67350f28fd483
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Alternative handling of tracemem's dynamic size.

The tracemem() action takes a constant size argument that gives the size
of the buffer used.

Optionally, it also takes another size argument that is dynamically
computed.  Currently, in this DTrace port, this dsize is used only by the
consumer, to limit how much data is displayed.  The documentation is
unclear if dsize should also limit how much data is written into the
buffer in the first place.  Arguably, it should:

*)  Copying less data might mean faster run time, although the
    savings would be very small and would incur the cost of extra
    BPF instructions.

*)  Copying less data might protect against accessing memory
    illegally.

Using dsize to cap how much data is written into the buffer is
implemented in this patch.

Since any changes in behavior would not be seen in our testing, no test
changes are made.

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: 27a7d5f513adc49898020c229e5359a5e585ab4d
      https://github.com/oracle/dtrace-utils/commit/27a7d5f513adc49898020c229e5359a5e585ab4d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.d
    A test/unittest/options/err.D_PRAGMA_OPTSET.ldpath.r
    A test/unittest/options/err.ldpath.d
    A test/unittest/options/err.ldpath.r
    A test/unittest/options/err.ldpath.r.p
    A test/unittest/options/tst.ldpath.sh

  Log Message:
  -----------
  test: Add tests for ldpath

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


  Commit: 4256450824fd158b0886845b01b75ea442c140f0
      https://github.com/oracle/dtrace-utils/commit/4256450824fd158b0886845b01b75ea442c140f0
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

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

  Log Message:
  -----------
  test: Add test for libdir

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


  Commit: 9fd37fb3392bde01ad00e32afd32129fab6303b1
      https://github.com/oracle/dtrace-utils/commit/9fd37fb3392bde01ad00e32afd32129fab6303b1
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/options/err.D_PRAGMA_OPTSET.modpath.d
    A test/unittest/options/err.D_PRAGMA_OPTSET.modpath.r
    A test/unittest/options/tst.modpath.r
    A test/unittest/options/tst.modpath.sh

  Log Message:
  -----------
  test: Add test for modpath

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


  Commit: 8dc870ff7cb2b2e34f1ab71863f77f73c6a09f41
      https://github.com/oracle/dtrace-utils/commit/8dc870ff7cb2b2e34f1ab71863f77f73c6a09f41
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    R test/unittest/dif/copyout.aarch64.x
    M test/unittest/dif/copyout.d
    A test/unittest/funcs/copyout/err.D_PROTO_ARG.copyoutbadarg.d
    A test/unittest/funcs/copyout/err.D_PROTO_ARG.copyoutbadarg.r
    A test/unittest/funcs/copyout/err.D_PROTO_LEN.copyouttoofew.d
    A test/unittest/funcs/copyout/err.D_PROTO_LEN.copyouttoofew.r
    A test/unittest/funcs/copyout/err.D_PROTO_LEN.copyouttoomany.d
    A test/unittest/funcs/copyout/err.D_PROTO_LEN.copyouttoomany.r
    A test/unittest/funcs/copyout/err.copyout.aarch64.x
    A test/unittest/funcs/copyout/err.copyout.d
    A test/unittest/funcs/copyout/err.copyoutbadaddr.aarch64.x
    A test/unittest/funcs/copyout/err.copyoutbadaddr.sh
    A test/unittest/funcs/copyout/tst.copyout.r
    A test/unittest/funcs/copyout/tst.copyout.sh
    R test/unittest/funcs/err.D_PROTO_ARG.copyoutbadarg.d
    R test/unittest/funcs/err.D_PROTO_ARG.copyoutbadarg.r
    R test/unittest/funcs/err.D_PROTO_LEN.copyouttoofew.d
    R test/unittest/funcs/err.D_PROTO_LEN.copyouttoofew.r
    R test/unittest/funcs/err.D_PROTO_LEN.copyouttoomany.d
    R test/unittest/funcs/err.D_PROTO_LEN.copyouttoomany.r
    R test/unittest/funcs/err.copyout.aarch64.x
    R test/unittest/funcs/err.copyout.d
    R test/unittest/funcs/err.copyoutbadaddr.aarch64.x
    R test/unittest/funcs/err.copyoutbadaddr.sh
    M test/unittest/funcs/err.copyoutstrbadaddr.sh
    M test/unittest/speculation/err.D_ACT_SPEC.SpeculateWithCopyOut.d

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

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


  Commit: d1227225301df82c09c9843cd424e2a9bd7322b5
      https://github.com/oracle/dtrace-utils/commit/d1227225301df82c09c9843cd424e2a9bd7322b5
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/bcopy/tst.bcopy_arg_order.d
    A test/unittest/funcs/bcopy/tst.bcopy_arg_order.r
    A test/unittest/funcs/copyinto/tst.copyinto_arg_order.d
    A test/unittest/funcs/copyinto/tst.copyinto_arg_order.r

  Log Message:
  -----------
  Restore order of bcopy() arg evaluations

In c26e2e5f279a ("Add support for copyinto() subroutine"), the order
of arg evaluations for bcopy() was changed from evaluating the last
arg (size) last to evaluating it first.  This has semantic implications
when the order of arguments matters.

Restore the previous order (to agree with Solaris semantics) and add
tests for both bcopy() and copyinto().

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


  Commit: 69d78b07ad579ce9fa507c6b5c64b4983b94135d
      https://github.com/oracle/dtrace-utils/commit/69d78b07ad579ce9fa507c6b5c64b4983b94135d
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/copyoutstr/err.D_PROTO_LEN.copyoutstrbadarg.d
    A test/unittest/funcs/copyoutstr/err.D_PROTO_LEN.copyoutstrbadarg.r
    A test/unittest/funcs/copyoutstr/err.D_PROTO_LEN.copyoutstrtoofew.d
    A test/unittest/funcs/copyoutstr/err.D_PROTO_LEN.copyoutstrtoofew.r
    A test/unittest/funcs/copyoutstr/err.copyoutstrbadaddr.aarch64.x
    A test/unittest/funcs/copyoutstr/err.copyoutstrbadaddr.sh
    A test/unittest/funcs/copyoutstr/tst.copyoutstr.r
    A test/unittest/funcs/copyoutstr/tst.copyoutstr.sh
    R test/unittest/funcs/err.D_PROTO_LEN.copyoutstrbadarg.d
    R test/unittest/funcs/err.D_PROTO_LEN.copyoutstrbadarg.r
    R test/unittest/funcs/err.D_PROTO_LEN.copyoutstrtoofew.d
    R test/unittest/funcs/err.D_PROTO_LEN.copyoutstrtoofew.r
    R test/unittest/funcs/err.copyoutstrbadaddr.aarch64.x
    R test/unittest/funcs/err.copyoutstrbadaddr.sh
    M test/unittest/speculation/err.D_ACT_SPEC.SpeculateWithCopyOutStr.d

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

Move tests to their own copyoutstr/ subdirectory to mimic other copy*
tests.

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


  Commit: 990ec8c9cb80f79213a2f8bb2d50df873e80bdc7
      https://github.com/oracle/dtrace-utils/commit/990ec8c9cb80f79213a2f8bb2d50df873e80bdc7
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    A test/unittest/options/err.version.d
    A test/unittest/options/err.version.r
    A test/unittest/options/tst.version.r
    A test/unittest/options/tst.version.sh

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

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


  Commit: 372c882bfc7283edd2ebf7cf48f7d71b87499671
      https://github.com/oracle/dtrace-utils/commit/372c882bfc7283edd2ebf7cf48f7d71b87499671
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

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

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

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


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

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

  Log Message:
  -----------
  Add DTRACEFLT_BADINDEX fault

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Reviewed-by: Elena Zannoni <elena.zannoni at oracle.com>


  Commit: df55d9d159f48236ce17fe9e77a9e5b0cfca3e99
      https://github.com/oracle/dtrace-utils/commit/df55d9d159f48236ce17fe9e77a9e5b0cfca3e99
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    M test/unittest/arrays/tst.declared-bounds.d
    M test/unittest/arrays/tst.declared-bounds.r
    A test/unittest/arrays/tst.declared-bounds.runtime_in.d
    A test/unittest/arrays/tst.declared-bounds.runtime_in.r
    A test/unittest/arrays/tst.declared-bounds.runtime_out.d
    A test/unittest/arrays/tst.declared-bounds.runtime_out.r

  Log Message:
  -----------
  Add run-time checks on bounds for scalar-array access

If a scalar (nonassociated, linearly indexed) array is accessed with
a constant index, the parser checks that the access is in-bounds.
With other index types, however, the value is not known until runtime.
Since the index value is not being checked at runtime, the BPF verifier
does not allow the code to be loaded, lest an invalid address is
dereferenced.

Add a runtime check when we try to add an offset to a scalar array
address.

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


  Commit: f4ce2fc24054255ee96dd7bdba039e8983f80b7a
      https://github.com/oracle/dtrace-utils/commit/f4ce2fc24054255ee96dd7bdba039e8983f80b7a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    R test/unittest/pid/tst.args1.aarch64.x
    R test/unittest/usdt/tst.args-alt.aarch64.x

  Log Message:
  -----------
  test: remove .x files due to aarch64 kernel fixes for arg8 and arg9

The .x files, apparently needed due to kernel bugs, are no longer
needed with updated kernels.

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


  Commit: a00ee1ec924785bc9c1bee353f2147139abbc000
      https://github.com/oracle/dtrace-utils/commit/a00ee1ec924785bc9c1bee353f2147139abbc000
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Fix strchr() tstring free

A node's register and tstring have to be managed independently.  E.g.,
in this case, str's register value is moved to another register, and
so str->dn_reg can be freed.  Meanwhile, the associated tstring is still
in use and cannot be freed until later.

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


  Commit: 66bc283625d3796732683f05c0d63f72ae7d9b32
      https://github.com/oracle/dtrace-utils/commit/66bc283625d3796732683f05c0d63f72ae7d9b32
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-25 (Sat, 25 Feb 2023)

  Changed paths:
    M test/unittest/dtrace-util/tst.ListProbesName.sh

  Log Message:
  -----------
  test: extend ListProbesname timeout

Extend the timeout on this test to give more breathing room to
slower systems running more recent kernels with more probes.

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


  Commit: c8585886338589e9d9db08017a8fd1724db6ab7c
      https://github.com/oracle/dtrace-utils/commit/c8585886338589e9d9db08017a8fd1724db6ab7c
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-02-26 (Sun, 26 Feb 2023)

  Changed paths:
    M test/unittest/speculation/tst.SingleCPU.d
    M test/unittest/speculation/tst.SingleCPU.r

  Log Message:
  -----------
  test: fix speculation/tst.SingleCPU.d

This test is meant to verify that simultaneously-active speculations get
drained and committed/discarded appropriately without losing any of
them.  Unfortunately, it never sets nspec, which is 1 by default, so it
actually runs out of speculations almost immediately: we need at least
16 for this test, which is not so coincidentally the maximum this
implementation supports right now.  Boosting that reveals another
problem: we print out the speculation ID, which is not in any sense a
guaranteed value, so we get lots of test failures: what we *actually*
care about is that the n value printed is suitable (indicating that the
first speculation in any block of (64 / 4) was committed and the rest
were discarded, and who cares what its ID is).

We also knock the switchrate down again because if we knock it up any
higher the discards (which are processed in userspace) don't get
processed fast enough to keep up, and we run out.  We consume 16
speculations in 6.4ms, so set the switchrate to 3ms to give us a bit of
headroom.  (This will still be racy on highly-loaded test systems where
the polls just don't happen fast enough because of system load: if that
happens, we can tag the test suitably in future.)

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


  Commit: b1553e437ddc4e0aed64e1a9c38be4cef0490b35
      https://github.com/oracle/dtrace-utils/commit/b1553e437ddc4e0aed64e1a9c38be4cef0490b35
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-26 (Sun, 26 Feb 2023)

  Changed paths:
    M test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.d
    M test/unittest/funcs/strjoin/tst.strjoin_nonDPTR.r
    M test/unittest/funcs/strtok/tst.strtok_nonDPTR.d
    M test/unittest/funcs/strtok/tst.strtok_nonDPTR.r
    M test/unittest/funcs/substr/tst.substr_nonDPTR.d
    M test/unittest/funcs/substr/tst.substr_nonDPTR.r
    M test/unittest/funcs/tst.basename_nonDPTR.d
    M test/unittest/funcs/tst.basename_nonDPTR.r
    M test/unittest/funcs/tst.dirname_nonDPTR.d
    M test/unittest/funcs/tst.dirname_nonDPTR.r
    M test/unittest/funcs/tst.index_nonDPTR.d
    M test/unittest/funcs/tst.inet_ntoa_nonDPTR.d
    M test/unittest/funcs/tst.inet_ntoa_nonDPTR.r
    M test/unittest/funcs/tst.rindex_nonDPTR.d
    M test/unittest/funcs/tst.strchr_nonDPTR.d
    M test/unittest/funcs/tst.strchr_nonDPTR.r

  Log Message:
  -----------
  test: Use kernel pointer for nonDPTR tests

The nonDPTR tests need to use non-DTrace pointers to be meaningful.
They were using pointers in user space, but technically speaking such
pointers should first be copied (e.g., with copyin or copyinstr) first.
But that makes them DTrace pointers, bypassing the whole point!

Use a kernel pointer like `linux_banner.  Use short strsize so that .r
results files will check consistent "Linux version " strings.

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


  Commit: 76f1b578f6e88109dd6a503a6042dd9aca2b624c
      https://github.com/oracle/dtrace-utils/commit/76f1b578f6e88109dd6a503a6042dd9aca2b624c
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-27 (Mon, 27 Feb 2023)

  Changed paths:
    M libdtrace/arm64/regs.d
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/i386/regs.d
    R test/demo/builtin/uregs.sparc64.aarch64.x
    R test/demo/builtin/uregs.sparc64.d
    R test/demo/builtin/uregs.sparc64.x86_64.x
    R test/demo/builtin/uregs.x86_64.aarch64.x
    R test/demo/builtin/uregs.x86_64.d
    R test/demo/builtin/uregs.x86_64.sparc64.x
    A test/unittest/arrays/err.D_PROTO_ARG.uregs_variable.d
    A test/unittest/arrays/err.D_PROTO_ARG.uregs_variable.r
    A test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.d
    A test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.r
    A test/unittest/arrays/err.D_UNKNOWN.uregs_badkernelversion.x
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.aarch64.d
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.aarch64.r
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.aarch64.x
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.x86_64.d
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.x86_64.r
    A test/unittest/arrays/err.D_UNKNOWN.uregs_toobig.x86_64.x
    A test/unittest/arrays/tst.uregsarray-check.sh
    A test/unittest/arrays/tst.uregsarray-check.x
    A test/unittest/arrays/tst.uregsarray-constants.aarch64.d
    A test/unittest/arrays/tst.uregsarray-constants.aarch64.r
    A test/unittest/arrays/tst.uregsarray-constants.aarch64.x
    A test/unittest/arrays/tst.uregsarray-constants.x86_64.d
    A test/unittest/arrays/tst.uregsarray-constants.x86_64.r
    A test/unittest/arrays/tst.uregsarray-constants.x86_64.x
    M test/unittest/arrays/tst.uregsarray.arm64.d
    M test/unittest/arrays/tst.uregsarray.arm64.x
    M test/unittest/arrays/tst.uregsarray.d
    A test/unittest/arrays/tst.uregsarray.x
    M test/unittest/arrays/tst.uregsarray.x86_64.d
    M test/unittest/arrays/tst.uregsarray.x86_64.x
    M test/unittest/disasm/tst.ann-bvar.r
    M test/unittest/disasm/tst.ann-bvar.sh
    A test/unittest/disasm/tst.vartab-bvar-uregs0.r
    A test/unittest/disasm/tst.vartab-bvar-uregs0.sh
    A test/unittest/disasm/tst.vartab-bvar-uregs0.x
    M test/unittest/disasm/tst.vartab-bvar.r
    M test/unittest/disasm/tst.vartab-bvar.sh
    R test/unittest/variables/bvar/tst.uregs.d

  Log Message:
  -----------
  Add support for uregs[]

The uregs[] essentially access (struct pt_regs) for the current task.
Therefore, we use the combination of BPF helper functions
bpf_task_pt_regs(bpf_get_current_task_btf()) to access pt_regs.

Note that older kernels might not support these helper functions.
So dt_bpf_init_helpers() checks, and if the needed functions are
missing an error results.

One place to put uregs[] support is in bpf/get_bvar.c.  On the other
hand, that means that the build system needs a gcc-bpf-unknown-none
that knows about these functions.  So, just generate the code ourselves
to call the two helper functions;  this is not much more difficult
than calling dt_get_bvar().

Further note that the documented symbolic indices to uregs[] seem
incorrect.  For x86, R_UESP is documented but not defined, and there
are many more indices that are defined but not documented.  For ARM,
the documented indices bear little resemblance to the defined (and
sensible!) values.

The support for symbolic indices to uregs[] on x86 mimics that found
in the legacy DTrace port to Linux -- that is, dtrace_getreg() from
kernel code arch/x86/dtrace/dtrace_isa_x86_64.c .  The logic is
convoluted and possibly incorrect.  Some uregs[] indices do not read
from (struct pt_regs) but from task->thread.*, complicating the
implementation.  This matter warrants further attention, but for now
mimicking the legacy port seems sufficient.

For the time being, there is no annotating disassembly with "uregs".
This can be added back in a future patch once other dust has settled.

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


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

  Changed paths:
    M NEWS
    M dtrace.spec

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

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


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

  Changed paths:
    M libdtrace/dt_parser.c

  Log Message:
  -----------
  parser: ensure 'args' is not marked DPTR

Since args[] is not actually an array it should not be marked DPTR.
It is not a pointer at all to any memory but rather a syntactic
construct to be able to reference (possibly translated) typed probe
arguments.  It can only be used as an indexed expression (args[idx])
and is rendered in code as either a builtin variable (arg0 .. arg9)
lookup or as a dynamic expression.

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


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

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

  Log Message:
  -----------
  htab: support lookups for buckets with multiple entries

Probes are represented by a quadruple naming scheme.  For easy lookup,
hashtables are kept based on each naming component.  When performing
lookups based on one of those hashtables, the head element was always
returned which is obviously wrong.

This patch introduced dt_htab_find() which provides for lookups using
a template entry and a secondary comparison function that is used to
evaluate the different entries in the bucket that match the template.

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


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

  Changed paths:
    M libdtrace/dt_probe.c

  Log Message:
  -----------
  fix probe lookups mixing static and glob components

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


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

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: fix support for REF-types in dt_cg_store_val()

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


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

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

  Log Message:
  -----------
  cg: support save/restore of probe arguments

With the upcoming introduction of dependent probes (probes that use
another underlying probe as trigger), we need to be able to save the
probe arguments for the underlying probe so that the arguments can be
modified in preparation for execution of the clauses of the dependent
probe.  After all such clauses have been executed, the probe arguments
need to be restored in case there is another dependent probe (with
possibly different arguments).

Dependent probes can only be one layer deep so we only eveyr need one
copy of the arguments.

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


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

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

  Log Message:
  -----------
  Implement dt_bpf_raw_tracepoint_open()

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


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

  Changed paths:
    M libdtrace/dt_provider.h
    M libdtrace/dt_provider_tp.c

  Log Message:
  -----------
  provider: Add support for attaching to raw tracepoints

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


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

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

  Log Message:
  -----------
  bpf: make dt_bpf_prog_load() available to other source files

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


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

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_rawtp.c
    M libdtrace/dt_provider.h

  Log Message:
  -----------
  provider: Implement a rawtp provider

BPF allows attaching to raw forms of tracepoints, which allows access
to the raw arguments.  (Regular tracepoints often expose translated
arguments based on the raw arguments that were passed in the tracepoint
call.)

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


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

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

  Log Message:
  -----------
  Change condition to bypass trampoline generation

Originally, all providers were backed by system level probes and needed
a trampoline to be generated to convert from a BPF context to the DTrace
context DTrace expects.  With the introduction of pid probes, we gained
a provider that did not use a trampoline because it is implemented by
adding clauses to an underlying probe (using the same DTrace context as
the underlying probe).

But in a more generic sense (and soon to be used for SDT providers), we
eed to be able to support providers that do not generate programs that
are directly attached to system level probes while still needing to be
able to generate a trampoline.  So, the existance of a trampoline hook
is not sufficient.

Fortunately, all providers specify a BPF prgoram type that indicates the
system level probe type the program need to be generated for.  For
providers that do not generate actual programs, we can therefore specify
BPF_PROG_TYPE_UNSPEC as program type, and test for that to determine
whether the trampoline function is to be called at program load time.

Future patches will introduce a code path where a trampoline function is
called for a non-program load case.

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


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

  Changed paths:
    M libdtrace/dt_dlibs.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_prov_uprobe.c

  Log Message:
  -----------
  dlib: Add dt_dlib_add_probe_var()

This new function defines a BPF symbol (variable) with the fully
qualified probe name as name, and the probe ID as value.

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


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

  Changed paths:
    M libdtrace/dt_dlibs.c

  Log Message:
  -----------
  dlib: Ensure dt_dlib_add_sym_id() does not add duplicates

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


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

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

  Log Message:
  -----------
  cg: Pass exit label to trampoline

Some trampolines will need to be able to gemerate code for some form of
pre-conditions.  It therefore needs to know a jump label that will be
positioned right after the trampoline being generated.

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


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

  Changed paths:
    M libdtrace/dt_cc.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_probe.c
    M libdtrace/dt_probe.h

  Log Message:
  -----------
  cg: Implement dependent probes

Some providers may wish to implement probes on top of other probes.
This patch provides the concept of dependent probes: probes that use
other probes as their firing mechanism.  This is accomplished by
generating a custom trampoline that converts the DTrace context of
the underlying probe into a DTrace context for the dependent probe
and then adding the clauses for the dependent probe to the underlying
probe.

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


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

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_proc.c
    M libdtrace/dt_provider.h
    M test/demo/proc/lwptime.d
    M test/demo/proc/progtime.d
    M test/demo/proc/sig.d
    M test/demo/proc/whoexec.d
    M test/unittest/builtinvar/tst.errno2.d
    M test/unittest/dtrace-util/tst.ProcGrab.sh
    M test/unittest/dtrace-util/tst.ProcInvoke.sh
    M test/unittest/pid/tst.fork.d
    M test/unittest/pid/tst.vfork.d
    M test/unittest/proc/tst.create.sh
    M test/unittest/proc/tst.discard.sh
    M test/unittest/proc/tst.exec.sh
    M test/unittest/proc/tst.execfail.ENOENT.sh
    M test/unittest/proc/tst.execfail.sh
    M test/unittest/proc/tst.exitcore.sh
    M test/unittest/proc/tst.exitexit.sh
    M test/unittest/proc/tst.startexit.sh
    M test/unittest/regression/exit_panic.d

  Log Message:
  -----------
  Implement the proc provider

The following probes (and their arguments) are currently supported:

proc:::exec
proc:::exec-failure
proc:::exec-success
proc:::exit
proc:::lwp-exit
proc:::create
proc:::lwp-create
proc:::start
proc:::lwp-start
proc:::signal-discard
proc:::signal-handle
proc:::signal-send

Various tests now pass and therefore no longer need @@xfail.

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


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

  Changed paths:
    M NEWS
    M dtrace.spec

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

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


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

  Changed paths:
    M test/unittest/proc/tst.exitcore.sh

  Log Message:
  -----------
  test: ensure tst.exitcore.sh works on all systems

Some systems have a very strict separation between reading from kernel
vs userspace addresses.  The test has been updated to always use
copyin() and copyinstr() when accessing userspace addresses.

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


  Commit: de86f0d39f51242e6548dc5f74fb3957af630b4b
      https://github.com/oracle/dtrace-utils/commit/de86f0d39f51242e6548dc5f74fb3957af630b4b
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-27 (Mon, 27 Feb 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  Use highest bit to decide if PC is user space or kernel

Currently, we decide if a PC is user space or kernel based on whether
the BPF helper function probe_read_kernel() can read the address.
On systems where this BPF helper function does not exist, there is a
back-up mechanism that simply checks the highest bit of the PC.

Apparently, on some systems, the helper function can read addresses
even in user space.  That is, the mechanism that uses the helper function
is not reliable.

So, just use the "back-up mechanism" all the time.

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


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

  Changed paths:
    M libdtrace/dt_prov_cpc.c

  Log Message:
  -----------
  cpc: fix trampoline signature

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_probe.c
    M libdtrace/dt_prov_proc.c
    M libdtrace/dt_provider.h
    M libdtrace/dt_provider_tp.c

  Log Message:
  -----------
  cg, sdt: copy userspace string arguments to kernelspace

When an SDT probe argument is provided by a userspace string, it must be
copied to kernelspace because SDT probe pointer arguments are expected
to be kernel addresses.

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


  Commit: 7346a437a46318bf1a3f2e5edc8a0096828bdb38
      https://github.com/oracle/dtrace-utils/commit/7346a437a46318bf1a3f2e5edc8a0096828bdb38
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-28 (Tue, 28 Feb 2023)

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

  Log Message:
  -----------
  test: Loosen some tolerances on tests

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


  Commit: 19c2e3130b305ea70660c40aff2943a93fe925ba
      https://github.com/oracle/dtrace-utils/commit/19c2e3130b305ea70660c40aff2943a93fe925ba
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-02-28 (Tue, 28 Feb 2023)

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

  Log Message:
  -----------
  test: Make clearlquantize less susceptible to timer variations

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


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

  Changed paths:
    M test/unittest/cpc/tst.args_kernel.sh
    M test/unittest/cpc/tst.args_user.sh
    M test/unittest/cpc/tst.mode_kernel.sh
    M test/unittest/cpc/tst.mode_user.sh
    M test/unittest/profile-n/tst.args_kernel.sh
    M test/unittest/profile-n/tst.args_user.sh

  Log Message:
  -----------
  test: Mark some tests as unstable

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/ba7fd1aa6a12...f543fa6706c0



More information about the DTrace-devel mailing list