Re: [PATCH bpf-next 5/6] bpf: Improve tracing recursion prevention mechanism

From: Steven Rostedt
Date: Mon Apr 24 2023 - 17:40:57 EST


On Wed, 19 Apr 2023 15:46:34 -0700
Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> wrote:

> No. Just one prog at entry into any of the kernel functions
> and another prog at entry of funcs that 1st bpf prog called indirectly.
> Like one prog is tracing networking events while another
> is focusing on mm. They should not conflict.

You mean that you have:

function start:
__bpf_prog_enter_recur()
bpf_program1()
__bpf_prog_enter_recur()
bpf_program2();
__bpf_prog_exit_recur()
__bpf_prog_exit_recur()

rest of function

That is, a bpf program can be called within another bpf pogram between
the prog_enter and prog_exit(), that is in the same context (normal,
softirq, irq, etc)?

The protection is on the trampoline where the bpf program is called.
Not sure how ftrace can stop BPF or BPF stop ftrace, unless bpf is
tracing a ftrace callback, or ftrace is tracing a bpf function.

-- Steve