From: Francis Deslauriers Date: Wed, 17 Mar 2021 14:40:56 +0000 (-0400) Subject: Fix: kretprobe: null ptr deref on session destroy X-Git-Tag: v2.13.0-rc1~35 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=484ec2179e14ae9272a7ad3d1820c837136fd144;p=lttng-modules.git Fix: kretprobe: null ptr deref on session destroy The `filter_bytecode_runtime_head` list is currently not initialized for the return event of the kretprobe. This caused a kernel null ptr dereference when destroying a session. It can reproduced with the following commands: lttng create lttng enable-event -k --function=lttng_test_filter_event_write my_event lttng start lttng stop lttng destroy Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: I1162ce8b10dd7237a26331531f048346b984eee7 --- diff --git a/src/lttng-events.c b/src/lttng-events.c index 2bec7284..d819c9e2 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -949,6 +949,8 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan, event_return->enabled = 0; event_return->registered = 1; event_return->instrumentation = itype; + INIT_LIST_HEAD(&event_return->filter_bytecode_runtime_head); + INIT_LIST_HEAD(&event_return->enablers_ref_head); /* * Populate lttng_event structure before kretprobe registration. */