Fix: event notifier: set eval_capture to false for kprobe, kretprobe and uprobe
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Jul 2024 19:39:58 +0000 (15:39 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 26 Jul 2024 20:05:17 +0000 (16:05 -0400)
Trying to capture fields for kprobe, kretprobe, uprobe, event
notifications will end up dereferencing NULL pointers. Prevent execution
of capture code in those cases.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If86b0602351fb42047b184608b28108e9de0d183

src/lttng-kprobes.c
src/lttng-kretprobes.c
src/lttng-uprobes.c

index cdaf68ac9d0ffdb550b1a83389589ab5fe15f734..5fa2a11a5db53c71a4ed41de8d64af2f4fd4a1d8 100644 (file)
@@ -87,7 +87,7 @@ int lttng_kprobes_event_handler_pre(struct kprobe *p, struct pt_regs *regs)
                        container_of(event, struct lttng_kernel_event_notifier, parent);
                struct lttng_kernel_notification_ctx notif_ctx;
 
-               notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
+               notif_ctx.eval_capture = false;
                event_notifier->notification_send(event_notifier, NULL, NULL, &notif_ctx);
                break;
        }
index 9cb04ad3c6664c95e220f1d23a185f5dc0208cd5..29a50e37091da7e47ac6f46a8d6fd8a85651229c 100644 (file)
@@ -116,7 +116,7 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
                        container_of(event, struct lttng_kernel_event_notifier, parent);
                struct lttng_kernel_notification_ctx notif_ctx;
 
-               notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
+               notif_ctx.eval_capture = false;
                event_notifier->notification_send(event_notifier, NULL, NULL, &notif_ctx);
                break;
        }
index 63a6595f1b66b02dc0c7d853bf9b2f202805e541..8144a49e264457e9ce226910334e29e28321a821 100644 (file)
@@ -101,7 +101,7 @@ int lttng_uprobes_event_handler_pre(struct uprobe_consumer *uc, struct pt_regs *
                        container_of(event, struct lttng_kernel_event_notifier, parent);
                struct lttng_kernel_notification_ctx notif_ctx;
 
-               notif_ctx.eval_capture = LTTNG_READ_ONCE(event_notifier->eval_capture);
+               notif_ctx.eval_capture = false;
                event_notifier->notification_send(event_notifier, NULL, NULL, &notif_ctx);
                break;
        }
This page took 0.027306 seconds and 4 git commands to generate.