[DTrace-devel] [oracle/dtrace-utils] 351d46: Ensure proper probe compilation context is set for...

Kris Van Hees noreply at github.com
Thu Sep 9 20:12:07 PDT 2021


  Branch: refs/heads/dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 351d461b77a760cb5cf4710c899e1809f8f1e648
      https://github.com/oracle/dtrace-utils/commit/351d461b77a760cb5cf4710c899e1809f8f1e648
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-07-06 (Tue, 06 Jul 2021)

  Changed paths:
    M libdtrace/dt_cc.c
    M libdtrace/dt_impl.h
    M libdtrace/dt_pid.c

  Log Message:
  -----------
  Ensure proper probe compilation context is set for trampolines

Trampolines are generated per-probe, well after the clauses have been
compiled.  The code generation for the trampolines was not setting the
proper probe context which could lead to obscure issues like not having
the proper probe argument information when the trampoline is generated.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_cg.h
    M libdtrace/dt_dctx.h
    M libdtrace/dt_prov_dtrace.c
    M libdtrace/dt_prov_fbt.c
    M libdtrace/dt_prov_pid.c
    M libdtrace/dt_prov_profile.c
    M libdtrace/dt_prov_sdt.c
    M libdtrace/dt_prov_syscall.c

  Log Message:
  -----------
  Provide and use standard functions to clear or copy CPU registers

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


  Commit: 4eea2e3dcb6a0d9f5ee18751eea11b699ece8a5e
      https://github.com/oracle/dtrace-utils/commit/4eea2e3dcb6a0d9f5ee18751eea11b699ece8a5e
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-07-13 (Tue, 13 Jul 2021)

  Changed paths:
    M libdtrace/dt_prov_sdt.c
    R test/unittest/sdt/tst.arg-arity.d
    R test/unittest/sdt/tst.arg-arity.r
    R test/unittest/sdt/tst.args-sdt.d
    R test/unittest/sdt/tst.args-sdt.r
    A test/unittest/sdt/tst.args.d
    A test/unittest/sdt/tst.args.r

  Log Message:
  -----------
  Implement argument retrieval for SDT probes

The arguments for tracepoints are presented in the BPF context as a
sequence of 64-bit values.  They are preceded by a double word (64-bit
value) that is not accessible from BPF programs.

The tst.args.d test case verifies that we can retrieve argument data
for a tracepoint.  It is quite complex because we end up having to
decode the argument data because of the component datatypes.  This
adds to the value of the test because it verifies that the argument
data is presented in the correct way.

Both tst.arg-arity.d and tst.args-sdt.d are removed because they are
specific to the previous implementation of DTrace on Linux, and depend
on a deprecated kernel-level probe that existed for the sole purpose of
being able to use these tetss.

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


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

  Changed paths:
    M include/dtrace/options_defines.h
    M libdtrace/dt_bpf.c
    M libdtrace/dt_options.c
    A test/unittest/misc/tst.bpflog-cmdline.sh
    A test/unittest/misc/tst.bpflog-pragma.sh

  Log Message:
  -----------
  Introduce 'bpflog' runtime option to request BPF verifier log

The default behaviour is not to print the BPF verifier log unless a BPF
program fails to load.  It is sometimes desirable to obtain the BPF
verifier log for successful prgoram loads to assist in debugging other
issues with BPF programs.  Specifying -xbpflog on the command line or
setting this option using a pragma will force printing of the BPF
verifier log for all program loads.

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


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

  Changed paths:
    A include/bpf-lib.h

  Log Message:
  -----------
  Provide set_upper_bound() and set_lower_bound() macro for C-to-BPF

The BPF verifier obtains (and needs) information about upper and lower
bounds for values based on conditional clauses.  The BPF GCC cross
compiler generates conditionals in a variety of forms.  The BPF verifier
sypports only a limited set of conditionals, so we need to be able to
enforce a specific form.  More specifically, the BPF verifier requires
the bound (a constant value) to be stored in the src register while the
value to be validated is in the dst register.

This patch provides macros that expand to inline assembler instructions
that enforce the expected register convention.

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


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

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

  Log Message:
  -----------
  Provide the maximum string length as BPF symbol STRSZ

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


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

  Changed paths:
    M bpf/Build
    R bpf/memcpy.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c

  Log Message:
  -----------
  Replace dt_memcpy() with bpf_probe_read()

The dt_memcpy() functionality can be provided by the bpf_probe_read()
helper.  Thanks to Eugene Loh for pointing this out.

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


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

  Changed paths:
    M libdtrace/dt_parser.c

  Log Message:
  -----------
  Fix type alignment handling for enums

The type alignment handling code used to determine the alignment size
for a given datatype was treating enums as if they were integers, but
that is incorrect.  It should (just like integers and pointers) have
its alignment set to match its size, but it should avoid the explicit
void-checking that is done for integers.

Without this patch, libdtrace linked with newer versions of libctf
will see a test failure in unittest/sizeof/tst.SizeofDataTypes.d for
datatype 'new_enum'.

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


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

  Changed paths:
    M libdtrace/dt_consume.c
    M test/unittest/error/tst.clause_scope-begin-ended.d

  Log Message:
  -----------
  Fix ERROR-in-BEGIN probe handling

The handling of ERROR probe invocations during the BEGIN probe execution
was flawed.  It failed to continue processing BEGIN clauses once an
ERROR invocation took place, and it didn't provide (as required) for
processing the CPU probe data buffer twice.

The continuation of processing has been corrected by ensuring that the
correct DTrace workstatus is reported from the probe callback functions.
The double buffer processing is now supported by passing a flag to
dt_consume_cpu() to indicate whether the tail of the ring buffer ought
to be updated or not.

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


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

  Changed paths:
    M Makefunctions

  Log Message:
  -----------
  Add support for building .S files into .o objects

With the introduction of assembler source files (.S) for BPF code, to be
compiled into object files (.o), the obj-name macro in Makefunctions
needs to be extended to account for .S source files.

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


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

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

  Log Message:
  -----------
  Introduce dctx->mem as a pointer to the generic scratch memory

Since there are multiple language features that need scratch memory,
it is more convenient for code generation to be able to refer to the
scratch memory by means of a base pointer.  The generic scratch
memory is allocated as part of the 'mem' BPF map.

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


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

  Changed paths:
    M bpf/get_bvar.c
    M libdtrace/dt_bpf.h
    M libdtrace/dt_cc.c
    M libdtrace/dt_dlibs.c
    M test/unittest/stack/tst.stack_fbt.x

  Log Message:
  -----------
  Make stack trace use dctx->mem to store stack trace data

The stack trace implementation was using an offset into the dctx->buf
memory space to store the stack trace data.  Now that we have a generic
scratch memory area that can be referenced as dctx->mem, the stack
trace implementation has been adjusted to make use of that.

This patch also contains a tiny fix to the tst.stack_fbt.x script to
use /bin/bash because it depends on bash specific features.

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


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

  Changed paths:
    M bpf/Build
    M bpf/get_bvar.c
    A bpf/strlen.c
    R bpf/strnlen.c
    R bpf/varint.c
    M libdtrace/Build
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_printf.c
    M libdtrace/dt_string.c
    M libdtrace/dt_string.h
    M libdtrace/dt_strtab.c
    M libdtrace/dt_subr.c
    R libdtrace/dt_varint.c
    R libdtrace/dt_varint.h
    R test/internals/tst.varint.sh
    M test/utils/Build
    R test/utils/tst.varint.c

  Log Message:
  -----------
  Transition from variable-length string size to 2-byte string size

The use of variable-length integers to store string sizes has turned
out to be prohibitively complex for the BPF verifier to handle.  In
order to provide string manipulation functions we have decided to
transition away from variable-length string size prefix.

This patch provides a transition to 2-byte string sizes stored ahead
of the actual string data.  A future patch will provide a more
permanent solution.

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


  Commit: 188c082aa0552a1805c3d7dd3062b45270b89a67
      https://github.com/oracle/dtrace-utils/commit/188c082aa0552a1805c3d7dd3062b45270b89a67
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2021-09-05 (Sun, 05 Sep 2021)

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

  Log Message:
  -----------
  Introduce temporary string space for string manipulation functions

String functions that have a string as return value need to store that
string in a temporary location so it can be used in following code.
We need at most 4 temporary strings to support nesting string functions
in an expression.

Functions must request a temporary string slot and have it associated
with their return value using a statement like:

    dt_cg_tstring_alloc(pcb, dnp);

The address of the string location should be obtained using:

    BPF_LOAD(BPF_DW, dnp->dn_reg, BPF_REG_FP, DT_STK_DCTX)
    BPF_LOAD(BPF_DW, dnp->dn_reg, dnp->dn_reg, DCTX_MEM)
    BPF_ALU64_IMM(BPF_ADD, dnp->dn_reg, dnp->dn_tstring->dn_value)

Functions that may be receiving a temporary string as argument (which
is any function or action that accept string arguments) must free the
temporary string once it is no longer needed.  This should be done
using code like:

    if (dnp->dn_tstring)
        dt_cg_tstring_free(pcb, dnp);

In order to support the use of temporary strings for arbitrary use (not
associated with a specific node), the following two functions are
provided as well:

    offset = dt_cg_tstring_xalloc(pcb);
    dt_cg_tstring_xfree(pcb, offset);

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


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

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

  Log Message:
  -----------
  Fix size of string data in the trace output buffer

The size of string data items in the trace output buffer was not taking
into account that we use a 2-byte length prefix and it also did not
include the terminating NUL byte.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_ident.c
    A test/unittest/codegen/tst.str_store_var.d
    A test/unittest/codegen/tst.str_store_var.r
    A test/unittest/variables/gvar/tst.str-size.d
    A test/unittest/variables/gvar/tst.str-size.r
    A test/unittest/variables/lvar/tst.str-size.d
    A test/unittest/variables/lvar/tst.str-size.r

  Log Message:
  -----------
  Fix data size for value copy in dt_cg_store_var()

The size of the data to be copied in dt_cg_store_var() was determined
wrongly.  For strings constants we were copying the size of the string
constant even if that might be larger than the maximum string size.

The offsets for lvars and gvars was also not taking into account the
length prefix to be stored for each string value.

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


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

  Changed paths:
    M bpf/Build
    A bpf/strjoin.S
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    A test/unittest/codegen/tst.dfunc_reg_leak.d
    A test/unittest/codegen/tst.dfunc_reg_leak.r
    A test/unittest/codegen/tst.tstring_leak.d
    A test/unittest/codegen/tst.tstring_leak.r
    A test/unittest/codegen/tst.tstring_leak2.d
    A test/unittest/codegen/tst.tstring_leak2.r
    M test/unittest/dif/strjoin.d
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size-2.d
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size-2.r
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size-3.d
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size-3.r
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size.d
    A test/unittest/funcs/strjoin/tst.strjoin-capped-size.r
    A test/unittest/funcs/strjoin/tst.strjoin-nested.d
    A test/unittest/funcs/strjoin/tst.strjoin-nested.r
    A test/unittest/funcs/strjoin/tst.strjoin.d
    A test/unittest/funcs/strjoin/tst.strjoin.r
    R test/unittest/funcs/tst.strjoin.d
    R test/unittest/funcs/tst.strjoin.r

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

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


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

  Changed paths:
    M bpf/Build
    A bpf/substr.S
    M libdtrace/dt_bpf.c
    M libdtrace/dt_cg.c
    M libdtrace/dt_dlibs.c
    R test/unittest/dif/substr2arg.d
    R test/unittest/dif/substr3arg.d
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_scalar_arg2.d
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_scalar_arg2.r
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_scalar_arg3.d
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_scalar_arg3.r
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_string_arg1.d
    A test/unittest/funcs/substr/err.D_PROTO_ARG.substr_non_string_arg1.r
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_missing_arg.d
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_missing_arg.r
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_too_few_args.d
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_too_few_args.r
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_too_many_args.d
    A test/unittest/funcs/substr/err.D_PROTO_LEN.substr_too_many_args.r
    A test/unittest/funcs/substr/err.substr_null_arg1.d
    A test/unittest/funcs/substr/err.substr_null_arg1.r
    A test/unittest/funcs/substr/substr2arg.d
    A test/unittest/funcs/substr/substr2arg.r
    A test/unittest/funcs/substr/substr3arg.d
    A test/unittest/funcs/substr/substr3arg.r
    A test/unittest/funcs/substr/tst.substr-large-idx.d
    A test/unittest/funcs/substr/tst.substr-large-idx.r
    A test/unittest/funcs/substr/tst.substr-multi-const-cnt-neg.d
    A test/unittest/funcs/substr/tst.substr-multi-const-cnt-neg.r
    A test/unittest/funcs/substr/tst.substr-multi-const-cnt-pos.d
    A test/unittest/funcs/substr/tst.substr-multi-const-cnt-pos.r
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-neg.r
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-pos.d
    A test/unittest/funcs/substr/tst.substr-multi-const-idx-pos.r
    A test/unittest/funcs/substr/tst.substr-multi-var-cnt-neg.d
    A test/unittest/funcs/substr/tst.substr-multi-var-cnt-neg.r
    A test/unittest/funcs/substr/tst.substr-multi-var-cnt-pos.d
    A test/unittest/funcs/substr/tst.substr-multi-var-cnt-pos.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-neg.r
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-pos.d
    A test/unittest/funcs/substr/tst.substr-multi-var-idx-pos.r
    A test/unittest/funcs/substr/tst.substr-strjoin.d
    A test/unittest/funcs/substr/tst.substr-strjoin.r
    A test/unittest/funcs/substr/tst.substr.d
    A test/unittest/funcs/substr/tst.substr.r
    A test/unittest/funcs/substr/tst.substrminate.d
    A test/unittest/funcs/substr/tst.substrminate.r
    R test/unittest/funcs/tst.substr.d
    R test/unittest/funcs/tst.substr.r
    R test/unittest/funcs/tst.substrminate.d
    R test/unittest/funcs/tst.substrminate.r

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

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


Compare: https://github.com/oracle/dtrace-utils/compare/53b33a89ef7e...455befe87594



More information about the DTrace-devel mailing list