Fix: racy notifier captures update vs traversal
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 19 Mar 2021 15:27:50 +0000 (11:27 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 22 Mar 2021 17:20:16 +0000 (13:20 -0400)
commitc3eddb2e2effc01eee7bc778c21431bf45a8ffdc
treedf2b6818ac081d8bc406cc37f7204f9718800f2f
parent484ec2179e14ae9272a7ad3d1820c837136fd144
Fix: racy notifier captures update vs traversal

For captures, a new struct lttng_kernel_notification_ctx is introduced,
which is to be used as additional "context" to the notification_send()
callback. This allows passing the "eval_capture" state from the probe
to the notification callback, and fixes a bug where a sequence of:

- create notification enabler,
- enable notification enabler,
- add capture to enabler,

where a tracepoint runs concurrently with add capture happens to do a
first capture list_empty check which skips the stack preparation,
whereas the second capture list_empty check within the notification
callback finds a capture entry, and thus attempts to use an
uninitialized stack. The notification callback is also modified to use
an RCU-aware list traversal.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib7ab673fb05b4824d0c7ba2e163dc1e88b465ee9
include/lttng/event-notifier-notification.h
include/lttng/events.h
include/lttng/tracepoint-event-impl.h
src/lttng-event-notifier-notification.c
src/lttng-events.c
src/probes/lttng-kprobes.c
src/probes/lttng-uprobes.c
This page took 0.025638 seconds and 4 git commands to generate.