Fix: system call filter table
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 28 Jan 2020 21:02:44 +0000 (16:02 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 8 Sep 2020 13:44:21 +0000 (09:44 -0400)
commitbadfe9f5c396efb1b00e5f2abcded2e4ac4a5bac
tree5deecb5a1aa31a994961f1c8714d787530906df7
parentb6af46d166c48c9e59600a60b5a2a7ead10f179a
Fix: system call filter table

The system call filter table has effectively been unused for a long
time due to system call name prefix mismatch. This means the overhead of
selective system call tracing was larger than it should have been because
the event payload preparation would be done for all system calls as soon
as a single system call is traced.

However, fixing this underlying issue unearths several issues that crept
unnoticed when the "enabler" concept was introduced (after the original
implementation of the system call filter table).

Here is a list of the issues which are resolved here:

- Split lttng_syscalls_unregister into an unregister and destroy
  function, thus awaiting for a grace period (and therefore quiescence
  of the users) after unregistering the system call tracepoints before
  freeing the system call filter data structures. This effectively fixes
  a use-after-free.

- The state for enabling "all" system calls vs enabling specific system
  calls (and sequences of enable-disable) was incorrect with respect to
  the "enablers" semantic. This is solved by always tracking the
  bitmap of enabled system calls, and keeping this bitmap even when
  enabling all system calls. The sc_filter is now always allocated
  before system call tracing is registered to tracepoints, which means
  it does not need to be RCU dereferenced anymore.

Padding fields in the ABI are reserved to select whether to:

- Trace either native or compat system call (or both, which is the
  behavior currently implemented),
- Trace either system call entry or exit (or both, which is the
  behavior currently implemented),
- Select the system call to trace by name (behavior currently
  implemented) or by system call number,

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/abi.h
include/lttng/events.h
src/lttng-abi.c
src/lttng-events.c
src/lttng-syscalls.c
This page took 0.025875 seconds and 4 git commands to generate.