Re: [PATCH 13/13] samples/kprobes: Add batch probe example

From
sashiko-bot@kernel.org
Date
2026-11-11 00:49:20
Also in
bpf
Reply to
Jiri Olsa, 2026-11-09
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] samples/kprobes: missing ANNOTATE_NOCFI_SYM() on
  kprobe_many_call_function()
--

commit 0bb6f0bd88ba358a50c5bd0da72b9a9137c6b243
Author: Jiri Olsa [off-list ref]

samples/kprobes: Add batch probe example

This commit adds 50,000 generated x86 functions and a sample module that
registers kprobes on them in a batch and calls each function to verify
the probes.
quoted hunk ↗ jump to hunk
diff --git a/samples/kprobes/kprobe_many_example.c b/samples/kprobes/kprobe_many_example.c
new file mode 100644
index 0000000000000..5a58908c840c7
--- /dev/null
+++ b/samples/kprobes/kprobe_many_example.c
[ ... ]
quoted hunk ↗ jump to hunk
+/* The generated assembly functions have no CFI type metadata. */
+static noinline __nocfi void
+kprobe_many_call_function(char *functions, unsigned int index)
+{
+	void (*function)(void);
+
+	function = (void (*)(void))(functions + index * KPROBE_MANY_FUNC_SIZE);
+	function();
+}
[Severity: Low]
Does kprobe_many_call_function() need
ANNOTATE_NOCFI_SYM(kprobe_many_call_function)?

Because __nocfi omits the kCFI ud2 sequence before the indirect call,
building with CONFIG_MITIGATION_RETPOLINE=y, CONFIG_CALL_PADDING=y and
CONFIG_CFI=y causes objtool's validate_retpoline() to emit a "no-cfi
indirect call!" warning (breaking the build when CONFIG_OBJTOOL_WERROR=y
is enabled) unless the function symbol is annotated with
ANNOTATE_NOCFI_SYM().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261109194916.1089703-1-jolsa@kernel.org?part=13
Thread (34 messages) 34 messages, 6 authors, last reply 4d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help