Fix: unchecked buffer size for communication header
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 14 Nov 2020 02:39:36 +0000 (21:39 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 18 Nov 2020 16:53:37 +0000 (11:53 -0500)
commit3e6e0df2f8f9f23d252c2508b6d741916dfcc4b3
treecc03458409966d20e177260bcf12bd6d27d781c1
parent8a82be4c62d09a7ef4792c0eed7c7903dfac8424
Fix: unchecked buffer size for communication header

A number of object de-serialization functions rely on a
fixed-size communication header to create an object from
a payload.

A large number of those functions assume that the initial
header fits in the provided buffer or payload view. Also,
the functions that do validate that the header fits do so
in different ways:
  - checking the view's size,
  - creating a new fixed-size view and checking the 'data' pointer.

To harmonize all of those checks, the following utils are added:
  - lttng_buffer_view_is_valid()
  - lttng_payload_view_is_valid()

These functions should be used whenever a fixed-size view is
created (not passing -1 as the length parameter).

The checks are added and/or harmonized to:
  - create a new 'header' view,
  - validate it with the corresponding *_is_valid() function,
  - initialize the header pointer using the header view.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I763946feac714ecef4fc5bd427dab2d3fe5dc1a4
29 files changed:
src/bin/lttng-relayd/cmd-2-11.c
src/bin/lttng-relayd/main.c
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c
src/common/actions/action.c
src/common/actions/group.c
src/common/actions/snapshot-session.c
src/common/buffer-usage.c
src/common/buffer-view.c
src/common/buffer-view.h
src/common/condition.c
src/common/evaluation.c
src/common/event-rule/event-rule.c
src/common/event-rule/kprobe.c
src/common/event-rule/syscall.c
src/common/event-rule/tracepoint.c
src/common/event-rule/uprobe.c
src/common/kernel-probe.c
src/common/location.c
src/common/notification.c
src/common/payload-view.c
src/common/payload-view.h
src/common/session-consumed-size.c
src/common/session-descriptor.c
src/common/session-rotation.c
src/common/tracker.c
src/common/trigger.c
src/common/userspace-probe.c
src/lib/lttng-ctl/lttng-ctl.c
This page took 0.028503 seconds and 4 git commands to generate.