From 1158b2706e58c2f94e6bd746e0504b989320c0a1 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 9 Jan 2024 10:33:13 -0500 Subject: [PATCH] Fix: prio context NULL pointer exception A missing call to wrapper_task_prio_init() causes the function pointer for task_prio to stay NULL, which triggers a OOPS when trying to use the prio context. Signed-off-by: Mathieu Desnoyers Change-Id: I417e84cb8a07db624e682c7ec2c033fbc2a7b8e7 --- include/lttng/events-internal.h | 1 + src/lttng-context-prio.c | 1 + src/lttng-events.c | 3 +++ 3 files changed, 5 insertions(+) diff --git a/include/lttng/events-internal.h b/include/lttng/events-internal.h index a727230f..181b7b45 100644 --- a/include/lttng/events-internal.h +++ b/include/lttng/events-internal.h @@ -649,6 +649,7 @@ int lttng_add_pid_to_ctx(struct lttng_kernel_ctx **ctx); int lttng_add_cpu_id_to_ctx(struct lttng_kernel_ctx **ctx); int lttng_add_procname_to_ctx(struct lttng_kernel_ctx **ctx); int lttng_add_prio_to_ctx(struct lttng_kernel_ctx **ctx); +int wrapper_task_prio_init(void); int lttng_add_nice_to_ctx(struct lttng_kernel_ctx **ctx); int lttng_add_vpid_to_ctx(struct lttng_kernel_ctx **ctx); int lttng_add_tid_to_ctx(struct lttng_kernel_ctx **ctx); diff --git a/src/lttng-context-prio.c b/src/lttng-context-prio.c index a3034e4e..aac10a63 100644 --- a/src/lttng-context-prio.c +++ b/src/lttng-context-prio.c @@ -29,6 +29,7 @@ int wrapper_task_prio_init(void) } return 0; } +EXPORT_SYMBOL_GPL(wrapper_task_prio_init); /* * Canary function to check for 'task_prio()' at compile time. diff --git a/src/lttng-events.c b/src/lttng-events.c index a0bd2322..08884410 100644 --- a/src/lttng-events.c +++ b/src/lttng-events.c @@ -4148,6 +4148,9 @@ static int __init lttng_events_init(void) int ret; ret = wrapper_get_pfnblock_flags_mask_init(); + if (ret) + return ret; + ret = wrapper_task_prio_init(); if (ret) return ret; ret = lttng_probes_init(); -- 2.34.1