Thread (21 messages) 21 messages, 3 authors, 2026-01-10

Re: [PATCH bpf-next v8 04/11] bpf: support fsession for bpf_session_is_return

From: Menglong Dong <hidden>
Date: 2026-01-10 04:04:23
Also in: bpf, lkml

On Sat, Jan 10, 2026 at 11:38 AM Menglong Dong [off-list ref] wrote:
On 2026/1/10 10:40, Alexei Starovoitov wrote:
quoted
On Wed, Jan 7, 2026 at 6:25 PM Menglong Dong [off-list ref] wrote:
quoted
+       } else if (func_id == special_kfunc_list[KF_bpf_session_is_return]) {
+               if (prog->expected_attach_type == BPF_TRACE_FSESSION)
+                       addr = (unsigned long)bpf_fsession_is_return;
...
quoted
+bool bpf_fsession_is_return(void *ctx)
+{
+       /* This helper call is inlined by verifier. */
+       return !!(((u64 *)ctx)[-1] & (1 << BPF_TRAMP_M_IS_RETURN));
+}
+
Why do this specialization and introduce a global function
that will never be called, since it will be inlined anyway?
Ah, the specialization and the definition of the global function
is not unnecessary. I thought that it's kinda fallback solution
      ^
typo: is not necessary
that we define the function even if it is inlined by the verifier.
quoted
Remove the first hunk and make the 2nd a comment instead of a real function?
Agree. So it will be:

+static bool bpf_fsession_is_return(void *ctx)
+{
+       /* This helper call is implemented and inlined by the verifier, and the logic is:
+         *   return !!(((u64 *)ctx)[-1] & (1 << BPF_TRAMP_M_IS_RETURN));
+         */
+        return false;
+}
quoted

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help