const char *event,
                                               const char *symbol,
                                               struct tracepoint *tpoint,
+                                              struct module *mod,
                                               int maxactive,
                                               int nargs, bool is_return)
 {
                tf->fp.entry_handler = fentry_dispatcher;
 
        tf->tpoint = tpoint;
+       tf->mod = mod;
        tf->fp.nr_maxactive = maxactive;
 
        ret = trace_probe_init(&tf->tp, event, group, false, nargs);
 struct __find_tracepoint_cb_data {
        const char *tp_name;
        struct tracepoint *tpoint;
+       struct module *mod;
 };
 
+static void __find_tracepoint_module_cb(struct tracepoint *tp, struct module *mod, void *priv)
+{
+       struct __find_tracepoint_cb_data *data = priv;
+
+       if (!data->tpoint && !strcmp(data->tp_name, tp->name)) {
+               data->tpoint = tp;
+               data->mod = mod;
+               if (!try_module_get(data->mod)) {
+                       data->tpoint = NULL;
+                       data->mod = NULL;
+               }
+       }
+}
+
 static void __find_tracepoint_cb(struct tracepoint *tp, void *priv)
 {
        struct __find_tracepoint_cb_data *data = priv;
                data->tpoint = tp;
 }
 
-static struct tracepoint *find_tracepoint(const char *tp_name)
+/*
+ * Find a tracepoint from kernel and module. If the tracepoint is in a module,
+ * this increments the module refcount to prevent unloading until the
+ * trace_fprobe is registered to the list. After registering the trace_fprobe
+ * on the trace_fprobe list, the module refcount is decremented because
+ * tracepoint_probe_module_cb will handle it.
+ */
+static struct tracepoint *find_tracepoint(const char *tp_name,
+                                         struct module **tp_mod)
 {
        struct __find_tracepoint_cb_data data = {
                .tp_name = tp_name,
+               .mod = NULL,
        };
 
        for_each_kernel_tracepoint(__find_tracepoint_cb, &data);
 
+       if (!data.tpoint && IS_ENABLED(CONFIG_MODULES)) {
+               for_each_module_tracepoint(__find_tracepoint_module_cb, &data);
+               *tp_mod = data.mod;
+       }
+
        return data.tpoint;
 }
 
        char abuf[MAX_BTF_ARGS_LEN];
        char *dbuf = NULL;
        bool is_tracepoint = false;
+       struct module *tp_mod = NULL;
        struct tracepoint *tpoint = NULL;
        struct traceprobe_parse_context ctx = {
                .flags = TPARG_FL_KERNEL | TPARG_FL_FPROBE,
 
        if (is_tracepoint) {
                ctx.flags |= TPARG_FL_TPOINT;
-               tpoint = find_tracepoint(symbol);
+               tpoint = find_tracepoint(symbol, &tp_mod);
                if (!tpoint) {
                        trace_probe_log_set_index(1);
                        trace_probe_log_err(0, NO_TRACEPOINT);
                goto out;
 
        /* setup a probe */
-       tf = alloc_trace_fprobe(group, event, symbol, tpoint, maxactive,
-                               argc, is_return);
+       tf = alloc_trace_fprobe(group, event, symbol, tpoint, tp_mod,
+                               maxactive, argc, is_return);
        if (IS_ERR(tf)) {
                ret = PTR_ERR(tf);
                /* This must return -ENOMEM, else there is a bug */
                goto out;       /* We know tf is not allocated */
        }
 
-       if (is_tracepoint)
-               tf->mod = __module_text_address(
-                               (unsigned long)tf->tpoint->probestub);
-
        /* parse arguments */
        for (i = 0; i < argc && i < MAX_TRACE_ARGS; i++) {
                trace_probe_log_set_index(i + 2);
        }
 
 out:
+       if (tp_mod)
+               module_put(tp_mod);
        traceprobe_finish_parse(&ctx);
        trace_probe_log_clear();
        kfree(new_argv);