All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>
Cc: bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org, x86@kernel.org,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	Quentin Monnet <qmo@kernel.org>,
	Alan Maguire <almagui@kernel.org>
Subject: [PATCH RFC bpf-next 07/31] bpf: Add support to attach inlined functions with kprobe multi link
Date: Wed,  2 Dec 2026 13:30:11 +0100	[thread overview]
Message-ID: <20261202123035.10335-8-jolsa@kernel.org> (raw)
In-Reply-To: <20261202123035.10335-1-jolsa@kernel.org>

The kprobe multi link attaches functions through fprobe, so it gets
only to the out-of-line copy of the function. The inlined instances
are not traced, and a function that is inlined in all its callers
can't be attached at all.

Adding BPF_F_KPROBE_MULTI_INLINE flag that makes the link attach also
the inlined instances of the functions provided in the syms array.

The instances are resolved by function name from the vmlinux inline
BTF (inline.text LOCSEC). Each of them gets its own kprobe and the
kprobes are enabled all at once with enable_kprobes. Instances of two
functions can share the same address, the program is executed for
both.

Each function needs to have either entry or at least one inlined
instance, otherwise the attach fails with -ESRCH.

Instances that kprobes refuse (jump label or static call site, bug
table entry, NOKPROBE_SYMBOL or noinstr caller) are skipped, and so
are instances inlined in functions without ftrace location (notrace),
which are likely not safe to probe. With all the attachable functions
in vmlinux that's 748 instances out of 20688. The attach fails if
a function has no entry and all its instances are skipped.

The program attached to inlined instance gets pt_regs of the probed
instruction, so the function arguments are not available in the
argument registers. The bpf_get_func_ip helper returns the address
of the inlined instance.

The flag can't be combined with BPF_F_KPROBE_MULTI_RETURN flag, session
program, the addrs array or program that uses bpf_override_return.

The number of inlined instances is limited to MAX_KPROBE_MULTI_CNT,
the attach fails with -E2BIG above that.

The support is x86_64 only for now, selected with the new
HAVE_KPROBE_MULTI_INLINE config option. The attach with the flag fails
with -EOPNOTSUPP on other architectures, on kernel without inline BTF
and without CONFIG_KPROBES.

The support for cookies and for inlined instances in modules is added
in following changes.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 arch/Kconfig                   |   6 +
 arch/x86/Kconfig               |   1 +
 include/uapi/linux/bpf.h       |   8 +-
 kernel/trace/bpf_trace.c       | 379 +++++++++++++++++++++++++++++++--
 tools/include/uapi/linux/bpf.h |   8 +-
 5 files changed, 384 insertions(+), 18 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 350144df6863..1824719263db 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -308,6 +308,12 @@ config HAVE_OPTPROBES
 config HAVE_KPROBES_ON_FTRACE
 	bool
 
+config HAVE_KPROBE_MULTI_INLINE
+	bool
+	help
+	  The architecture supports kprobe multi link attach to inlined
+	  functions (BPF_F_KPROBE_MULTI_INLINE).
+
 config ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
 	bool
 	help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 23889c2261e4..992756c0672d 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -262,6 +262,7 @@ config X86
 	select HAVE_KERNEL_ZSTD
 	select HAVE_KPROBES
 	select HAVE_KPROBES_ON_FTRACE
+	select HAVE_KPROBE_MULTI_INLINE		if X86_64
 	select HAVE_FUNCTION_ERROR_INJECTION
 	select HAVE_KRETPROBES
 	select HAVE_RETHOOK
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 28904c6f0787..96e6a629f0c0 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -1365,10 +1365,14 @@ enum bpf_perf_event_type {
 #define BPF_F_TEST_REG_INVARIANTS	(1U << 7)
 
 /* link_create.kprobe_multi.flags used in LINK_CREATE command for
- * BPF_TRACE_KPROBE_MULTI attach type to create return probe.
+ * BPF_TRACE_KPROBE_MULTI attach type.
  */
 enum {
-	BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
+	/* Create return probe. */
+	BPF_F_KPROBE_MULTI_RETURN = (1U << 0),
+
+	/* Attach also to inlined function instances, skip those that fail. */
+	BPF_F_KPROBE_MULTI_INLINE = (1U << 1),
 };
 
 /* link_create.uprobe_multi.flags used in LINK_CREATE command for
diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index c546e1d41be0..89388a140b48 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -30,6 +30,7 @@
 #include <uapi/linux/bpf.h>
 #include <uapi/linux/btf.h>
 
+#include <asm/sections.h>
 #include <asm/tlb.h>
 
 #include "trace_probe.h"
@@ -2365,6 +2366,27 @@ struct bpf_session_run_ctx {
 };
 
 #ifdef CONFIG_FPROBE
+struct bpf_kprobe_multi_link;
+
+struct inline_site {
+	struct kprobe kp;
+	struct bpf_kprobe_multi_link *link;
+	u32 sym_idx;
+	bool has_entry;
+	bool traceable;
+};
+
+/*
+ * @sites has @sites_cnt inlined instances found for the link, the ones
+ * that got registered are stored in @kps (@cnt), the rest was skipped.
+ */
+struct inline_sites {
+	struct inline_site *sites;
+	struct kprobe **kps;
+	u32 sites_cnt;
+	u32 cnt;
+};
+
 struct bpf_kprobe_multi_link {
 	struct bpf_link link;
 	struct fprobe fp;
@@ -2373,6 +2395,7 @@ struct bpf_kprobe_multi_link {
 	u32 cnt;
 	u32 mods_cnt;
 	struct module **mods;
+	struct inline_sites inlines;
 };
 
 struct bpf_kprobe_multi_run_ctx {
@@ -2463,7 +2486,9 @@ static void bpf_kprobe_multi_link_release(struct bpf_link *link)
 
 	kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link);
 	/* Don't wait for RCU GP here. */
-	unregister_fprobe_async(&kmulti_link->fp);
+	if (kmulti_link->cnt)
+		unregister_fprobe_async(&kmulti_link->fp);
+	unregister_kprobes(kmulti_link->inlines.kps, kmulti_link->inlines.cnt);
 	kprobe_multi_put_modules(kmulti_link->mods, kmulti_link->mods_cnt);
 }
 
@@ -2472,6 +2497,8 @@ static void bpf_kprobe_multi_link_dealloc(struct bpf_link *link)
 	struct bpf_kprobe_multi_link *kmulti_link;
 
 	kmulti_link = container_of(link, struct bpf_kprobe_multi_link, link);
+	kvfree(kmulti_link->inlines.sites);
+	kvfree(kmulti_link->inlines.kps);
 	kvfree(kmulti_link->addrs);
 	kvfree(kmulti_link->cookies);
 	kfree(kmulti_link->mods);
@@ -2626,7 +2653,7 @@ static u64 bpf_kprobe_multi_entry_ip(struct bpf_run_ctx *ctx)
 static __always_inline int
 kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link,
 			   unsigned long entry_ip, struct ftrace_regs *fregs,
-			   bool is_return, void *data)
+			   struct pt_regs *regs, bool is_return, void *data)
 {
 	struct bpf_kprobe_multi_run_ctx run_ctx = {
 		.session_ctx = {
@@ -2637,13 +2664,12 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link,
 		.entry_ip = entry_ip,
 	};
 	struct bpf_run_ctx *old_run_ctx;
-	struct pt_regs *regs;
 	int err;
 
 	/*
-	 * graph tracer framework ensures we won't migrate, so there is no need
-	 * to use migrate_disable for bpf_prog_run again. The check here just for
-	 * __this_cpu_inc_return.
+	 * Both fprobe and kprobe handlers ensure we won't migrate, so there
+	 * is no need to use migrate_disable for bpf_prog_run again. The check
+	 * here just for __this_cpu_inc_return.
 	 */
 	cant_sleep();
 
@@ -2654,11 +2680,14 @@ kprobe_multi_link_prog_run(struct bpf_kprobe_multi_link *link,
 	}
 
 	rcu_read_lock();
-	regs = ftrace_partial_regs(fregs, bpf_kprobe_multi_pt_regs_ptr());
+	/* The caller provides either ftrace_regs or pt_regs. */
+	if (fregs)
+		regs = ftrace_partial_regs(fregs, bpf_kprobe_multi_pt_regs_ptr());
 	old_run_ctx = bpf_set_run_ctx(&run_ctx.session_ctx.run_ctx);
 	err = bpf_prog_run(link->link.prog, regs);
 	bpf_reset_run_ctx(old_run_ctx);
-	ftrace_partial_regs_update(fregs, bpf_kprobe_multi_pt_regs_ptr());
+	if (fregs)
+		ftrace_partial_regs_update(fregs, bpf_kprobe_multi_pt_regs_ptr());
 	rcu_read_unlock();
 
  out:
@@ -2676,7 +2705,7 @@ kprobe_multi_link_handler(struct fprobe *fp, unsigned long fentry_ip,
 
 	link = container_of(fp, struct bpf_kprobe_multi_link, fp);
 	err = kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip),
-					 fregs, false, data);
+					 fregs, NULL, false, data);
 	return is_kprobe_session(link->link.prog) ? err : 0;
 }
 
@@ -2689,9 +2718,21 @@ kprobe_multi_link_exit_handler(struct fprobe *fp, unsigned long fentry_ip,
 
 	link = container_of(fp, struct bpf_kprobe_multi_link, fp);
 	kprobe_multi_link_prog_run(link, ftrace_get_entry_ip(fentry_ip),
-				   fregs, true, data);
+				   fregs, NULL, true, data);
 }
 
+static int
+kprobe_multi_inline_handler(struct kprobe *kp, struct pt_regs *regs)
+{
+	struct inline_site *site;
+
+	site = container_of(kp, struct inline_site, kp);
+	kprobe_multi_link_prog_run(site->link, (unsigned long)kp->addr,
+				   NULL, regs, false, NULL);
+	return 0;
+}
+NOKPROBE_SYMBOL(kprobe_multi_inline_handler);
+
 static int symbols_cmp_r(const void *a, const void *b, const void *priv)
 {
 	const char **str_a = (const char **) a;
@@ -2700,6 +2741,11 @@ static int symbols_cmp_r(const void *a, const void *b, const void *priv)
 	return strcmp(*str_a, *str_b);
 }
 
+static int symbols_cmp(const void *a, const void *b)
+{
+	return symbols_cmp_r(a, b, NULL);
+}
+
 struct multi_symbols_sort {
 	const char **funcs;
 	u64 *cookies;
@@ -2809,8 +2855,262 @@ static int addrs_check_error_injection_list(unsigned long *addrs, u32 cnt)
 	return 0;
 }
 
+static int inline_sym_idx(const struct btf *btf, const struct btf_loc *loc,
+			  const char **syms, u32 cnt)
+{
+	const struct btf_type *t = btf_type_by_id(btf, loc->func);
+	const char *name, **sym;
+
+	if (!t)
+		return -1;
+	name = btf_name_by_offset(btf, t->name_off);
+	if (!name)
+		return -1;
+	sym = bsearch(&name, syms, cnt, sizeof(*syms), symbols_cmp);
+	return sym ? sym - syms : -1;
+}
+
+static int inlines_cmp(const void *a, const void *b)
+{
+	const struct inline_site *site_a = a, *site_b = b;
+
+	if (site_a->sym_idx != site_b->sym_idx)
+		return site_a->sym_idx < site_b->sym_idx ? -1 : 1;
+	if (site_a->kp.addr != site_b->kp.addr)
+		return site_a->kp.addr < site_b->kp.addr ? -1 : 1;
+	return 0;
+}
+
+struct inline_lookup {
+	/* Input: functions to look for, @syms is alphabetically sorted. */
+	const char **syms;
+	unsigned long *addrs;
+	u32 syms_cnt;
+
+	/* Output */
+	struct inline_sites *inlines;
+	u32 addrs_cnt;
+
+	/* Lookup state */
+	struct inline_site *sites;
+	u32 cnt;
+	u32 cap;
+};
+
+static int inline_lookup_add(struct inline_lookup *lookup, unsigned long addr, u32 sym_idx)
+{
+	struct inline_site *sites;
+	u32 cap;
+
+	if (lookup->cnt == MAX_KPROBE_MULTI_CNT)
+		return -E2BIG;
+
+	if (lookup->cnt == lookup->cap) {
+		cap = max(16, lookup->cap * 2);
+		sites = kvrealloc(lookup->sites, array_size(cap, sizeof(*sites)), GFP_KERNEL);
+		if (!sites)
+			return -ENOMEM;
+		lookup->sites = sites;
+		lookup->cap = cap;
+	}
+
+	lookup->sites[lookup->cnt++] = (struct inline_site) {
+		.kp.addr = (kprobe_opcode_t *)addr,
+		.sym_idx = sym_idx,
+	};
+	return 0;
+}
+
+/*
+ * Add inlined instances of the functions we look for from @locsec,
+ * the offsets of its locations are relative to @base address.
+ */
+static int inline_lookup_locsec(struct inline_lookup *lookup, const struct btf *btf,
+				const struct btf_type *locsec, unsigned long base)
+{
+	struct btf_loc *loc;
+	int idx, err;
+	u32 i;
+
+	for_each_loc(i, locsec, loc) {
+		idx = inline_sym_idx(btf, loc, lookup->syms, lookup->syms_cnt);
+		if (idx < 0)
+			continue;
+		err = inline_lookup_add(lookup, base + loc->offset, idx);
+		if (err)
+			return err;
+	}
+	return 0;
+}
+
+/*
+ * Sort instances by symbol name and address, so instances of each
+ * symbol are next to each other, and get rid of duplicates.
+ */
+static void inline_lookup_sort(struct inline_lookup *lookup)
+{
+	struct inline_site *sites = lookup->sites;
+	u32 i, j;
+
+	sort(sites, lookup->cnt, sizeof(*sites), inlines_cmp, NULL);
+
+	for (i = 0, j = 0; i < lookup->cnt; i++) {
+		if (i && !inlines_cmp(&sites[i], &sites[i - 1]))
+			continue;
+		if (i != j)
+			sites[j] = sites[i];
+		j++;
+	}
+	lookup->cnt = j;
+}
+
+/*
+ * The inlined instance is attached inside the function it's inlined in,
+ * make sure that function is traceable (not notrace) and safe to probe.
+ */
+static bool inline_site_traceable(unsigned long addr)
+{
+	unsigned long size, offset;
+
+	if (!kallsyms_lookup_size_offset(addr, &size, &offset))
+		return false;
+	addr -= offset;
+	return ftrace_location_range(addr, addr + size - 1);
+}
+
+/*
+ * Find inlined instances for functions in @lookup->syms. Each function
+ * must have an entry address or at least one inlined instance, functions
+ * without an entry address are dropped from @lookup->addrs.
+ */
+static int inline_lookup_symbols(struct inline_lookup *lookup)
+{
+	struct inline_sites *inlines = lookup->inlines;
+	unsigned long *addrs = lookup->addrs;
+	u32 i, j, k, n, cnt = lookup->syms_cnt;
+	struct inline_site *sites;
+	struct btf *btf;
+	int err;
+	s32 id;
+
+	btf = bpf_get_btf_vmlinux_inline();
+	if (IS_ERR_OR_NULL(btf))
+		return -EOPNOTSUPP;
+
+	/* The offsets of inline.text locations are relative to .text section. */
+	id = btf_find_by_name_kind(btf, "inline.text", BTF_KIND_LOCSEC);
+	if (id < 0)
+		return -EOPNOTSUPP;
+
+	err = inline_lookup_locsec(lookup, btf, btf_type_by_id(btf, id), (unsigned long)_stext);
+	if (err)
+		goto error;
+
+	inline_lookup_sort(lookup);
+
+	sites = lookup->sites;
+	n = lookup->cnt;
+
+	for (i = 0; i < n; i++) {
+		sites[i].kp.pre_handler = kprobe_multi_inline_handler;
+		/* Registered disabled and enabled all at once. */
+		sites[i].kp.flags = KPROBE_FLAG_DISABLED;
+		sites[i].has_entry = !!addrs[sites[i].sym_idx];
+		sites[i].traceable = inline_site_traceable((unsigned long)sites[i].kp.addr);
+	}
+
+	/*
+	 * Each symbol needs to have either entry or inlined instance,
+	 * keep only symbols with entry in @addrs array.
+	 * The instances are sorted by symbol name, so we walk them together.
+	 */
+	for (i = 0, j = 0, k = 0; i < cnt; i++) {
+		while (k < n && sites[k].sym_idx < i)
+			k++;
+		if (!addrs[i]) {
+			if (k < n && sites[k].sym_idx == i)
+				continue;
+			err = -ESRCH;
+			goto error;
+		}
+		addrs[j] = addrs[i];
+		j++;
+	}
+
+	inlines->sites = sites;
+	inlines->sites_cnt = n;
+	lookup->addrs_cnt = j;
+	return 0;
+
+error:
+	kvfree(lookup->sites);
+	return err;
+}
+
+/*
+ * Register inlined instances of the @link and skip the ones that fail.
+ * Fail if function has no entry and none of its instances registered.
+ */
+static int inline_sites_register(struct bpf_kprobe_multi_link *link)
+{
+	struct inline_sites *inlines = &link->inlines;
+	struct inline_site *site, *first = NULL;
+	int err, first_err = 0;
+	bool attached = false;
+	u32 i, cnt = 0;
+
+	inlines->kps = kvmalloc_array(inlines->sites_cnt, sizeof(*inlines->kps), GFP_KERNEL);
+	if (!inlines->kps)
+		return -ENOMEM;
+
+	for (i = 0; i < inlines->sites_cnt; i++) {
+		site = &inlines->sites[i];
+		site->link = link;
+
+		/* First inlined instance of the function. */
+		if (!i || site->sym_idx != first->sym_idx) {
+			first = site;
+			first_err = 0;
+			attached = site->has_entry;
+		}
+
+		err = site->traceable ? register_kprobe(&site->kp) : -EINVAL;
+		if (err == -ENOMEM)
+			goto error;
+		if (err) {
+			first_err = first_err ?: err;
+		} else {
+			inlines->kps[cnt++] = &site->kp;
+			attached = true;
+		}
+
+		/* Last inlined instance of the function. */
+		if (i + 1 < inlines->sites_cnt && site[1].sym_idx == site->sym_idx)
+			continue;
+		if (!attached) {
+			err = first_err;
+			goto error;
+		}
+	}
+
+	/* Arm all the registered instances with single sync. */
+	if (cnt) {
+		err = enable_kprobes(inlines->kps, cnt);
+		if (err)
+			goto error;
+	}
+
+	inlines->cnt = cnt;
+	return 0;
+
+error:
+	unregister_kprobes(inlines->kps, cnt);
+	return err;
+}
+
 int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *prog)
 {
+	struct inline_sites inlines = {};
 	struct bpf_kprobe_multi_link *link = NULL;
 	struct bpf_link_primer link_primer;
 	void __user *ucookies;
@@ -2840,7 +3140,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 		return -EINVAL;
 
 	flags = attr->link_create.kprobe_multi.flags;
-	if (flags & ~BPF_F_KPROBE_MULTI_RETURN)
+	if (flags & ~(BPF_F_KPROBE_MULTI_RETURN | BPF_F_KPROBE_MULTI_INLINE))
 		return -EINVAL;
 
 	uaddrs = u64_to_user_ptr(attr->link_create.kprobe_multi.addrs);
@@ -2848,6 +3148,24 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 	if (!!uaddrs == !!usyms)
 		return -EINVAL;
 
+	if (flags & BPF_F_KPROBE_MULTI_INLINE) {
+		/*
+		 * Inlined instances are resolved from function names and
+		 * have just entry probe, so there's no return probe, session
+		 * or override support.
+		 */
+		if (flags & BPF_F_KPROBE_MULTI_RETURN)
+			return -EINVAL;
+		if (is_kprobe_session(prog) || prog->kprobe_override)
+			return -EINVAL;
+		if (uaddrs)
+			return -EINVAL;
+		if (!IS_ENABLED(CONFIG_KPROBES))
+			return -EOPNOTSUPP;
+		if (!IS_ENABLED(CONFIG_HAVE_KPROBE_MULTI_INLINE))
+			return -EOPNOTSUPP;
+	}
+
 	cnt = attr->link_create.kprobe_multi.cnt;
 	if (!cnt)
 		return -EINVAL;
@@ -2894,6 +3212,26 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 		       symbols_swap_r, &data);
 
 		err = ftrace_lookup_symbols(us.syms, cnt, addrs);
+
+		/*
+		 * With inline flag it's ok if the function is not found,
+		 * as long as it has inlined instance. Unresolved functions
+		 * have zero in addrs.
+		 */
+		if ((flags & BPF_F_KPROBE_MULTI_INLINE) && (!err || err == -ESRCH)) {
+			struct inline_lookup lookup = {
+				.inlines  = &inlines,
+				.syms     = us.syms,
+				.syms_cnt = cnt,
+				.addrs    = addrs,
+			};
+
+			err = inline_lookup_symbols(&lookup);
+			/* The cnt is changed to number of functions with entry. */
+			if (!err)
+				cnt = lookup.addrs_cnt;
+		}
+
 		free_user_syms(&us);
 		if (err)
 			goto error;
@@ -2928,6 +3266,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 	link->cookies = cookies;
 	link->cnt = cnt;
 	link->link.flags = flags;
+	link->inlines = inlines;
 
 	if (cookies) {
 		/*
@@ -2947,12 +3286,23 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 		goto error_cleanup;
 	link->mods_cnt = err;
 
-	err = register_fprobe_ips(&link->fp, addrs, cnt);
-	if (err)
-		goto error_modules;
+	if (inlines.sites_cnt) {
+		err = inline_sites_register(link);
+		if (err)
+			goto error_modules;
+	}
+
+	/* All the functions might have just inlined instances. */
+	if (cnt) {
+		err = register_fprobe_ips(&link->fp, addrs, cnt);
+		if (err)
+			goto error_inlines;
+	}
 
 	return bpf_link_settle(&link_primer);
 
+error_inlines:
+	unregister_kprobes(link->inlines.kps, link->inlines.cnt);
 error_modules:
 	kprobe_multi_put_modules(link->mods, link->mods_cnt);
 error_cleanup:
@@ -2963,6 +3313,7 @@ int bpf_kprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 	kfree(link);
 	kvfree(addrs);
 	kvfree(cookies);
+	kvfree(inlines.sites);
 	return err;
 }
 #else /* !CONFIG_FPROBE */
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 28904c6f0787..96e6a629f0c0 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -1365,10 +1365,14 @@ enum bpf_perf_event_type {
 #define BPF_F_TEST_REG_INVARIANTS	(1U << 7)
 
 /* link_create.kprobe_multi.flags used in LINK_CREATE command for
- * BPF_TRACE_KPROBE_MULTI attach type to create return probe.
+ * BPF_TRACE_KPROBE_MULTI attach type.
  */
 enum {
-	BPF_F_KPROBE_MULTI_RETURN = (1U << 0)
+	/* Create return probe. */
+	BPF_F_KPROBE_MULTI_RETURN = (1U << 0),
+
+	/* Attach also to inlined function instances, skip those that fail. */
+	BPF_F_KPROBE_MULTI_INLINE = (1U << 1),
 };
 
 /* link_create.uprobe_multi.flags used in LINK_CREATE command for
-- 
2.56.1


  parent reply	other threads:[~2026-12-02 12:31 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:30 [PATCH RFC bpf-next 00/31] bpf: Attach kprobe multi link to inlined functions Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 01/31] x86/ptrace: Add regs_get_dwarf_register function Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 02/31] kprobes: Make the kprobe hash table size configurable Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 03/31] kprobes: Add enable_kprobes to enable multiple kprobes at once Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 04/31] module: Add module_sect_addr function Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 05/31] bpf: Add bpf_get_btf_vmlinux_inline function Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 06/31] bpf: Use goto labels for error path in bpf_kprobe_multi_link_attach Jiri Olsa
2026-12-02 12:30 ` Jiri Olsa [this message]
2026-12-02 12:30 ` [PATCH RFC bpf-next 08/31] bpf: Add cookie support for kprobe multi inlined functions Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 09/31] bpf: Add link info " Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 10/31] bpf: Add fdinfo " Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 11/31] bpf: Add btf_for_each_module_inline function Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 12/31] bpf: Change get_modules_for_addrs to use struct modules_array Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 13/31] tbpf: Add support to attach inlined functions in modules with kprobe multi link Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 14/31] bpf: Add BPF_F_KPROBE_MULTI_INLINE_STRICT flag for " Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 15/31] bpf: Add get_func_arg[_cnt] support for kprobe multi functions Jiri Olsa
2026-12-02 13:06   ` sashiko-bot
2026-12-02 12:30 ` [PATCH RFC bpf-next 16/31] bpf: Add get_func_arg[_cnt] support for kprobe multi inlined functions Jiri Olsa
2026-12-02 12:55   ` sashiko-bot
2026-12-02 12:30 ` [PATCH RFC bpf-next 17/31] bpf: Add log messages for kprobe multi inline attach Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 18/31] bpf: Add inlined functions for kprobe multi inline tests Jiri Olsa
2026-12-02 12:51   ` sashiko-bot
2026-12-02 12:30 ` [PATCH RFC bpf-next 19/31] libbpf: Add inline options to bpf_kprobe_multi_opts Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 20/31] libbpf: Print kernel log for failed kprobe multi attach Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 21/31] bpftool: Display inlined functions for kprobe multi link Jiri Olsa
2026-12-02 13:00   ` sashiko-bot
2026-12-02 12:30 ` [PATCH RFC bpf-next 22/31] selftests/bpf: Add inlined functions to bpf_testmod Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 23/31] selftests/bpf: Add kprobe multi inline attach test Jiri Olsa
2026-12-02 12:50   ` sashiko-bot
2026-12-02 12:30 ` [PATCH RFC bpf-next 24/31] selftests/bpf: Add kprobe multi inline mixed test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 25/31] selftests/bpf: Add kprobe multi inline skip test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 26/31] selftests/bpf: Add kprobe multi inline fails test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 27/31] selftests/bpf: Add kprobe multi inline module test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 28/31] selftests/bpf: Add kprobe multi inline strict test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 29/31] selftests/bpf: Add kprobe multi inline args test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 30/31] selftests/bpf: Add kprobe multi inline bench attach test Jiri Olsa
2026-12-02 12:30 ` [PATCH RFC bpf-next 31/31] selftests/bpf: Add kprobe multi inline link info test Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202123035.10335-8-jolsa@kernel.org \
    --to=jolsa@kernel.org \
    --cc=almagui@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=qmo@kernel.org \
    --cc=song@kernel.org \
    --cc=x86@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.