[DTrace-devel] [oracle/dtrace-utils] 5185de: libproc: further armouring against invalid DL_NNS ...

Nick Alcock noreply at github.com
Wed Feb 3 12:01:55 PST 2021


  Branch: refs/heads/1.2-branch
  Home:   https://github.com/oracle/dtrace-utils
  Commit: 5185de65dbbda65b3059d466c14cbe7507dec3eb
      https://github.com/oracle/dtrace-utils/commit/5185de65dbbda65b3059d466c14cbe7507dec3eb
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

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

  Log Message:
  -----------
  libproc: further armouring against invalid DL_NNS values

We know that you can't have no namespaces, but namespaces in glibc are a
small static resource, and we know we know its maximum (because if that
maximum changes, it changes the offsets of stuff in rtld_global that we
need so we *have* to adapt).

So export the maximum number of namespaces to libproc and check it: if
there are more namespaces than that, we know we aren't looking at the
namespace count, or glibc has bumped its DL_NNS value and we must
adapt.  (This is a bitness-independent value.)

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


  Commit: 2c9db50f3697d3542467ab140d4bcdbbede47429
      https://github.com/oracle/dtrace-utils/commit/2c9db50f3697d3542467ab140d4bcdbbede47429
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libdtrace/dt_module.c
    M test/unittest/aggs/tst.aggmod_full2.sh
    M test/unittest/consumer/tst.merge_ranges_bug25767469.c
    M test/unittest/consumer/tst.symbols.c

  Log Message:
  -----------
  dtrace: handle .init.scratch section in /proc/kallmodsyms

The introduction of the .init.scratch section in Linux 5.2-rc6 via e1bfa87
("x86/mm: Create a workarea in the kernel for SME early encryption") led to
the consistent failure of
- test/unittest/aggs/tst.aggmod_full2.sh
- test/unittest/consumer/tst.merge_ranges_bug25767469.c
- test/unittest/consumer/tst.symbols.c
This init section, related to the kernel, appears in /proc/kall[mod]syms
after the end of kernel addresses, causing problems for DTrace's ways of
reading /proc/kallmodsyms.

Until the kernel is fixed not to write this init section to
/proc/kall[mod]syms, add fixes to DTrace userspace code wherever, including
in tests, it reads /proc/kallmodsyms.

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


  Commit: b9793bfc7e630b0ef5528c73190b38ec8fec1a59
      https://github.com/oracle/dtrace-utils/commit/b9793bfc7e630b0ef5528c73190b38ec8fec1a59
  Author: David P. Mc Lean <david.mclean at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libdtrace/dt_printf.c
    A test/unittest/printf/tst.wide-bug30404549.r
    A test/unittest/printf/tst.wide-bug30404549.sh
    A test/unittest/printf/tst.wide.r
    A test/unittest/printf/tst.wide.sh

  Log Message:
  -----------
  dtrace: correct snprintf maximum lengths in libdtrace/dt_printf.c

dt_printf_format() and dtrace_printf_format() had improperly specified
values for the maximum size argument of snprintf.

dt_printf_format() has two instances of snprintf where the destination
pointer was not at the beginning of the buffer space, while the maximum
size argument specified the total size of the buffer rather than the
remaining length.  This has not been a practical problem because the
output string has always been much shorter than the remaining length of the
buffer.

Tests that failed without the correction of this commit are:
    test/unittest/aggs/tst.keysort.d
    test/unittest/multiaggs/tst.many.d
    test/unittest/multiaggs/tst.sort.d
    test/unittest/multiaggs/tst.sortpos.d
    test/unittest/multiaggs/tst.tuplecompat.d
    test/unittest/multiaggs/tst.zero.d
    test/unittest/multiaggs/tst.zero2.d
    test/unittest/printa/tst.dynwidth.d
    test/unittest/printa/tst.stack.d
    test/unittest/printf/tst.flags.d
    test/unittest/printf/tst.widths.d
    test/unittest/printf/tst.widths1.d
    test/unittest/printf/tst.wp.d
    test/unittest/rates/tst.aggrate.d
    test/unittest/rates/tst.switchrate.d
    test/demo/intro/trussrw.d
    test/demo/struct/rwinfo.d

The error seen while running on Ubuntu 19.04 was:
"*** buffer overflow detected ***: dtrace terminated"

In each case a core dump file was generated.

Similarly, the maximum length argument was seen to be incorrect for snprintf
in the function dtrace_printf_format().  Correct these issues.

Orabug: 30404549
Signed-off-by: David  Mc Lean <david.mclean at oracle.com>
Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>


  Commit: f3a6e9589fd3e86ea678c598d1026204e5587b7a
      https://github.com/oracle/dtrace-utils/commit/f3a6e9589fd3e86ea678c598d1026204e5587b7a
  Author: Eugene Loh <eugene.loh at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M test/unittest/aggs/tst.aggmod_full.sh

  Log Message:
  -----------
  dtrace: handle .init.scratch section in /proc/kallmodsyms

The earlier patch overlooked intermittent failures in
test/unittest/aggs/tst.aggmod_full.sh

Apply similar fixes to this test as was made in the earlier patch.

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


  Commit: c0683b75f7fa5ef87b751f9c7d727a36697a3b31
      https://github.com/oracle/dtrace-utils/commit/c0683b75f7fa5ef87b751f9c7d727a36697a3b31
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libdtrace/d-kern.m4
    M libdtrace/procfs.d.in

  Log Message:
  -----------
  dlibs: make expand_for_kernel work if invoked more than once

The expand_for_kernel macro had an extremely embarrassing bug:
because it always defined a macro with the same name, and because M4
defines all macros before doing any expansions, calling
define_for_kernel twice always duplicated the expansion of the first
in the second invocation, no matter what the second invocation was.

This is unlikely to be what anyone wants.

Fixed by introducing a name (required to be unique, though we do not
validate this) and using that name to inflect the name of the macro
we define in expand_for_kernel.

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


  Commit: 7e7069c96a6e655579b0450ac8b1a2e06f37149f
      https://github.com/oracle/dtrace-utils/commit/7e7069c96a6e655579b0450ac8b1a2e06f37149f
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libdtrace/procfs.d.in

  Log Message:
  -----------
  dlibs, procfs: handle kernel 5.6.0's removal of time_t

Kernel 5.6.0 has finally ditched the in-kernel time_t in favour of
time64_t.  Recreate it on such kernels for the sake of script stability.

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


  Commit: 07972b65f984d2d685e4e7cb245fa6783c6fb76d
      https://github.com/oracle/dtrace-utils/commit/07972b65f984d2d685e4e7cb245fa6783c6fb76d
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libproc/arm64/isadep.c

  Log Message:
  -----------
  libproc, arm64: add missing header

struct user_pt_regs is kept in <asm/ptrace.h> and might not be
included by <sys/ptrace.h> on some glibc versions.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: 7ce719c7da62b3b2daab0e99ab9a6b4b642ae3d6
      https://github.com/oracle/dtrace-utils/commit/7ce719c7da62b3b2daab0e99ab9a6b4b642ae3d6
  Author: David Mc Lean <david.mclean at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M libdtrace/dt_module.c
    M test/unittest/aggs/tst.aggmod_full.sh
    M test/unittest/aggs/tst.aggmod_full2.sh
    M test/unittest/consumer/tst.symbols.c

  Log Message:
  -----------
  tests: filter-out spurious references to bpf module symbols from kallmodsyms

We see references to symbols assigned to a "bpf" module in
/proc/kallmodsyms.  We filter these references out in a few tests and in
libdtrace/dt_module.c.

The tests which were failing before the changes here include:
test/unittest/aggs/tst.aggmod_full.sh
test/unittest/aggs/tst.aggmod_full2.sh
test/unittest/consumer/tst.merge_ranges_bug25767469.c
test/unittest/consumer/tst.symbols.c

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


  Commit: 340ce31875082c4fa9aad940eae7fae3c22ecf75
      https://github.com/oracle/dtrace-utils/commit/340ce31875082c4fa9aad940eae7fae3c22ecf75
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M dtrace-utils.spec

  Log Message:
  -----------
  spec: do not require yum

We haven't needed it since commit 85c7a6748599cf in 2017.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>


  Commit: d5efbae2a3eba0ca2485a09a8b13aaf65e9ea288
      https://github.com/oracle/dtrace-utils/commit/d5efbae2a3eba0ca2485a09a8b13aaf65e9ea288
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2020-11-25 (Wed, 25 Nov 2020)

  Changed paths:
    M GNUmakefile
    M NEWS
    M dtrace-utils.spec

  Log Message:
  -----------
  Specfile and NEWS changes for 1.2.2


  Commit: 10fff08f4824bcf92570f51d9de7aac71893f25e
      https://github.com/oracle/dtrace-utils/commit/10fff08f4824bcf92570f51d9de7aac71893f25e
  Author: Nick Alcock <nick.alcock at oracle.com>
  Date:   2021-02-03 (Wed, 03 Feb 2021)

  Changed paths:
    M README.md

  Log Message:
  -----------
  License clarifications.


Compare: https://github.com/oracle/dtrace-utils/compare/d04e34bffc71...10fff08f4824



More information about the DTrace-devel mailing list