[DTrace-devel] [oracle/dtrace-utils] c7d731: parser: do not bounds-check arrays of size 0 or 1

Kris Van Hees noreply at github.com
Mon Sep 25 15:12:42 UTC 2023


  Branch: refs/heads/kvh/2.0-branch-dev
  Home:   https://github.com/oracle/dtrace-utils
  Commit: c7d7314666d6c0e9d773295707370bf17b7e7f70
      https://github.com/oracle/dtrace-utils/commit/c7d7314666d6c0e9d773295707370bf17b7e7f70
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2023-09-15 (Fri, 15 Sep 2023)

  Changed paths:
    M libdtrace/dt_parser.c
    A test/unittest/arrays/tst.ctf-dynsized-bounds.d

  Log Message:
  -----------
  parser: do not bounds-check arrays of size 0 or 1

This is both a pretty useless degenerate check to carry out, and breaks when
-fstrict-flex-arrays is used (whereupon trailing old-style flexible arrays
gain bounds of 0).  It is almost certainly wrong to use trailing zero-size
arrays and -fstrict-flex-arrays in conjunction, but since C doesn't
bounds-check this is commonplace.  In particular the Linux kernel has turned
this on *before* transitioning away from such arrays, rather than
afterwards.

Fixes system translators (in particular the pr_pgid and pr_sid members of
psinfo_t) in conjunction with Linux 6.5+.

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


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

  Changed paths:
    M libdtrace/Build
    M libdtrace/dt_open.c
    A libdtrace/dt_prov_ip.c
    M libdtrace/dt_provider.h
    M libdtrace/ip.d
    M test/demo/ip/ipio.d
    M test/demo/ip/ipproto.d
    M test/unittest/funcs/tst.inet_ntoa.d
    M test/unittest/funcs/tst.inet_ntoa_nonDPTR.d
    R test/unittest/ip/test.x
    A test/unittest/ip/tst.lv-receive.r
    A test/unittest/ip/tst.lv-receive.r.p
    A test/unittest/ip/tst.lv-receive.sh
    A test/unittest/ip/tst.lv-send.r
    A test/unittest/ip/tst.lv-send.r.p
    A test/unittest/ip/tst.lv-send.sh

  Log Message:
  -----------
  Implement the ip provider

This patch also resolves the issue of ipaddr_t not being a known type
because ip.d provides a definition for it.

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


  Commit: 2b53e24c3288052d3496809258209543001f2c31
      https://github.com/oracle/dtrace-utils/commit/2b53e24c3288052d3496809258209543001f2c31
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-09-23 (Sat, 23 Sep 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: clear dnp->dn_tstring after freeing it

We were freeing the dn_tstring (if any) on a node wothout actually
setting dn_tstring to NULL to prevent any further use.

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


  Commit: 9c171e0c0d78b5cd1cc9835ed299fa49e9c2d570
      https://github.com/oracle/dtrace-utils/commit/9c171e0c0d78b5cd1cc9835ed299fa49e9c2d570
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2023-09-23 (Sat, 23 Sep 2023)

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

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

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


  Commit: 26e2d632bac611335ad462c7be8655fe9f471f82
      https://github.com/oracle/dtrace-utils/commit/26e2d632bac611335ad462c7be8655fe9f471f82
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-09-23 (Sat, 23 Sep 2023)

  Changed paths:
    M libdtrace/dt_cg.c

  Log Message:
  -----------
  cg: optional 5th arg for dt_cg_subr_arg_to_tstring() calls

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


  Commit: 6e4d2b070aff462e45b3f09603828a831694566c
      https://github.com/oracle/dtrace-utils/commit/6e4d2b070aff462e45b3f09603828a831694566c
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-09-23 (Sat, 23 Sep 2023)

  Changed paths:
    M bpf/inet_ntoa6.S
    M libdtrace/dt_cg.c
    M libdtrace/dt_open.c
    A test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg1_not_in6_addr.d
    A test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg2_not_const.d
    A test/unittest/funcs/inet_ntoa6/err.D_PROTO_ARG.inet_ntoa6.arg2_not_int.d
    A test/unittest/funcs/inet_ntoa6/err.D_PROTO_LEN.inet_ntoa6.too_few_args.d
    A test/unittest/funcs/inet_ntoa6/err.D_PROTO_LEN.inet_ntoa6.too_many_args.d
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-0.d
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-0.r
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-1.d
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-1.r
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-not-0.d
    A test/unittest/funcs/inet_ntoa6/tst.inet_ntoa6.strict-not-0.r
    M test/unittest/funcs/tst.inet_ntop_runtime_af.r

  Log Message:
  -----------
  Support two representations for embedded IPv4 addresses

DTrace's inet_ntoa6() represents mapped and embedded IPv4 addresses
using the regular IPv4 representation, whereas inet_ntop() uses a
strict IPv6 representation (:: or ::ffff: prefix followed by a regular
IPv4 address).

The implementation uses a 2nd argument to inet_ntoa6() that must be
an integer constant that indicates basic IPv4 representation (0), or
strict IPv4-in-IPv6 representation (non-0).

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


  Commit: 450e5b58a27f275908f919f3b9857d95741d7ee8
      https://github.com/oracle/dtrace-utils/commit/450e5b58a27f275908f919f3b9857d95741d7ee8
  Author: Kris Van Hees <kris.van.hees at oracle.com>
  Date:   2023-09-23 (Sat, 23 Sep 2023)

  Changed paths:
    M libdtrace/dt_cg.c
    A test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.d
    A test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null.r
    A test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.d
    A test/unittest/funcs/inet_ntoa6/err.inet_ntoa6.arg1_null_const.r
    R test/unittest/funcs/inet_ntoa6/err.inet_ntoa6badaddr.d

  Log Message:
  -----------
  cg: ensure argument NULL pointer check detects constant 0 values

The dt_cg_arg_to_tstring() function was generating code for a runtime
NULL pointer check if the passed argument was a pointer or a string.
But if the passed argument was a NULL constant, that check was never
generated because the argument was an integer in that case.

The new code determines the need for the NULL pointer check based on
the datatype of the argument (as specified in the function prototype)
instead.

Tests are included based on inet_ntoa6().

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


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

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

  Log Message:
  -----------
  Replace dt_variable_read()

The dt_variable_read() function is only used in a few placed, all of
them involving reading data from a data record.  Callers adjust the
base address using the record offset, and then pass in the data size
from the record as well.  The new dt_read_scalar() function takes a
base address and a pointer to a record descriptor which is more in
line with the nature of data record descriptors.

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


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

  Changed paths:
    M libdtrace/dt_cg.c
    M libdtrace/dt_consume.c
    M libdtrace/dt_open.c
    M libdtrace/pcap.d
    M test/unittest/pcap/tst.pcap.file.sh
    M test/unittest/pcap/tst.pcap.stdout-fork-error.sh
    M test/unittest/pcap/tst.pcap.stdout.sh
    M test/unittest/pcap/tst.pcap.tshark.sh

  Log Message:
  -----------
  Implement the pcap action

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


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

  Changed paths:
    M test/unittest/options/tst.bpflogsize-cmdline.sh
    M test/unittest/options/tst.bpflogsize-pragma.sh

  Log Message:
  -----------
  test: ensure bpflogsize tests can handle large logs

With recent kernel versions, the output from the BPF log can be too
much for the test to handle in reasonable time, and the test fails
with a timeout.  Since the test is only looking for data to match
near the end of the log, use tail to focus on just that.

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


Compare: https://github.com/oracle/dtrace-utils/compare/79719f660d12...e4bd14a1ebc8



More information about the DTrace-devel mailing list