From 01a3c59661c0960ae0771de8ba18c602085ee83c Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 26 Jul 2024 15:39:58 -0400 Subject: [PATCH] Fix: event notifier: set eval_capture to false for kprobe, kretprobe and uprobe 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 Change-Id: If86b0602351fb42047b184608b28108e9de0d183 --- src/lttng-kprobes.c | 2 +- src/lttng-kretprobes.c | 2 +- src/lttng-uprobes.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lttng-kprobes.c b/src/lttng-kprobes.c index cdaf68ac..5fa2a11a 100644 --- a/src/lttng-kprobes.c +++ b/src/lttng-kprobes.c @@ -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, ¬if_ctx); break; } diff --git a/src/lttng-kretprobes.c b/src/lttng-kretprobes.c index 9cb04ad3..29a50e37 100644 --- a/src/lttng-kretprobes.c +++ b/src/lttng-kretprobes.c @@ -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, ¬if_ctx); break; } diff --git a/src/lttng-uprobes.c b/src/lttng-uprobes.c index 63a6595f..8144a49e 100644 --- a/src/lttng-uprobes.c +++ b/src/lttng-uprobes.c @@ -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, ¬if_ctx); break; } -- 2.34.1