mbox series

[00/10] libtraceevent: Makefile updates fixes and unit tests

Message ID 20211216213956.13934-1-rostedt@goodmis.org (mailing list archive)
Headers show
Series libtraceevent: Makefile updates fixes and unit tests | expand

Message

Steven Rostedt Dec. 16, 2021, 9:39 p.m. UTC
The libtraceevent Makefiles are a result of its several foster homes.
It started at trace-cmd and then went into the kernel, and now lives in
its own repository. The Makefiles were brought over from the previous
homes and modified and tweaked to get them to work. This added a bunch
of unnecessary logic that is not needed for just this library.

The Makefiles were rewritten to be more consistent with libtracefs and
with trace-cmd, which greatly simplified them.

A unit test was added to start testing event parsing and reading to lay
the ground work for more unit tests that will help keep libtraceevent
from having more regressions (like one that slipped in).

The processing of the old dynamic string format (which had just he
offset where the length of the string was simply determined by the size
of the string at the offset) stopped working. It actually worked by
shear luck, but changes to add the rel_loc parsing took away all that
luck. It had to be refactored to be more specific in knowing that the
format is of the old size.

Deprecate tep_print_field() as it does not give the user to pass the in
the size of the data to parse, and since it could be from untrusted
sources, that would make it a security issue.

Add tep_print_field_content() that requires a size also passed in.

Use the size more to verify that only the data gets looked at and does
not rely on the data to stay within bounds.

*** NOTE *** there needs to be an audit of all the code to add checks to
make sure all access are within the data. Even though the size is now
passed in, there are many cases where what is parsed is going to be
within those limits.


Steven Rostedt (VMware) (10):
  libtraceevent: Fix installing of man pages in remote directory
  libtraceevent: Rewrite Makefiles to be like libtracefs
  libtraceevent: Have make tags and TAGS honor O= build directory
  libtraceevent: Move installed headers into their own directory
  libtraceevent: Add unit test framework for library commands
  libtraceveent: Add testing of old dynamic string event layout
  libraceevent: Add unit test to test print_fmt with dynamic strings
  libtraceevent: Account for old dynamic string formats and honor size
  libtraceevent: Replace tep_print_field() with
    tep_print_field_content()
  libtraceevent: Have print_field_raw() handle old data layout

 Documentation/Makefile                      |  16 +-
 Documentation/libtraceevent-field_print.txt |  10 +-
 Documentation/libtraceevent.txt             |   2 +-
 Makefile                                    | 215 +++++++++++---------
 build/Build.include                         | 103 ----------
 build/Makefile.build                        | 162 ---------------
 {src => include/traceevent}/event-parse.h   |   8 +-
 {src => include/traceevent}/event-utils.h   |   0
 {src => include/traceevent}/kbuffer.h       |   0
 {src => include/traceevent}/trace-seq.h     |   0
 plugins/Makefile                            |  63 ++----
 scripts/Makefile.include                    | 135 ------------
 scripts/features.mk                         |  37 ++++
 scripts/utils.mk                            | 174 ++++++++++++++++
 src/Makefile                                |  51 ++++-
 src/event-parse.c                           |  96 ++++++---
 utest/Makefile                              |  38 ++++
 utest/README                                |  17 ++
 utest/trace-utest.c                         |  86 ++++++++
 utest/trace-utest.h                         |  14 ++
 utest/traceevent-utest.c                    | 172 ++++++++++++++++
 21 files changed, 807 insertions(+), 592 deletions(-)
 delete mode 100644 build/Build.include
 delete mode 100644 build/Makefile.build
 rename {src => include/traceevent}/event-parse.h (99%)
 rename {src => include/traceevent}/event-utils.h (100%)
 rename {src => include/traceevent}/kbuffer.h (100%)
 rename {src => include/traceevent}/trace-seq.h (100%)
 delete mode 100644 scripts/Makefile.include
 create mode 100644 scripts/features.mk
 create mode 100644 scripts/utils.mk
 create mode 100644 utest/Makefile
 create mode 100644 utest/README
 create mode 100644 utest/trace-utest.c
 create mode 100644 utest/trace-utest.h
 create mode 100644 utest/traceevent-utest.c