--- /dev/null
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * src/wrapper/kprobes.h
+ *
+ * Copyright (C) 2021 Michael Jeanson <mjeanson@efficios.com>
+ */
+
+#ifndef _LTTNG_WRAPPER_KPROBES_H
+#define _LTTNG_WRAPPER_KPROBES_H
+
+#include <linux/kprobes.h>
+#include <linux/version.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
+
+static inline
+struct kretprobe *lttng_get_kretprobe(struct kretprobe_instance *ri)
+{
+ return get_kretprobe(ri);
+}
+
+#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) */
+
+static inline
+struct kretprobe *lttng_get_kretprobe(struct kretprobe_instance *ri)
+{
+ return ri->rp;
+}
+
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0) */
+
+#endif /* _LTTNG_WRAPPER_KPROBES_H */
*/
#include <linux/module.h>
-#include <linux/kprobes.h>
+#include <wrapper/kprobes.h>
#include <linux/slab.h>
#include <linux/kref.h>
#include <lttng/events.h>
enum lttng_kretprobe_type type)
{
struct lttng_krp *lttng_krp =
- container_of(krpi->rp, struct lttng_krp, krp);
+ container_of(lttng_get_kretprobe(krpi), struct lttng_krp, krp);
struct lttng_event *event =
lttng_krp->event[type];
struct lttng_probe_ctx lttng_probe_ctx = {
if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
return 0;
- payload.ip = (unsigned long) krpi->rp->kp.addr;
+ payload.ip = (unsigned long) lttng_get_kretprobe(krpi)->kp.addr;
payload.parent_ip = (unsigned long) krpi->ret_addr;
lib_ring_buffer_ctx_init(&ctx, chan->chan, <tng_probe_ctx, sizeof(payload),