diff options
author | Florent Revest <[email protected]> | 2021-05-11 10:10:54 +0200 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2021-05-11 14:02:33 -0700 |
commit | e2d5b2bb769fa5f500760caba76436ba3a10a895 (patch) | |
tree | 00a9235741290b2d7a4405f38b1ea2bfa4b3e45b /scripts/gdb/linux/timerlist.py | |
parent | 35e3815fa8102fab4dee75f3547472c66581125d (diff) |
bpf: Fix nested bpf_bprintf_prepare with more per-cpu buffers
The bpf_seq_printf, bpf_trace_printk and bpf_snprintf helpers share one
per-cpu buffer that they use to store temporary data (arguments to
bprintf). They "get" that buffer with try_get_fmt_tmp_buf and "put" it
by the end of their scope with bpf_bprintf_cleanup.
If one of these helpers gets called within the scope of one of these
helpers, for example: a first bpf program gets called, uses
bpf_trace_printk which calls raw_spin_lock_irqsave which is traced by
another bpf program that calls bpf_snprintf, then the second "get"
fails. Essentially, these helpers are not re-entrant. They would return
-EBUSY and print a warning message once.
This patch triples the number of bprintf buffers to allow three levels
of nesting. This is very similar to what was done for tracepoints in
"9594dc3c7e7 bpf: fix nested bpf tracepoints with per-cpu data"
Fixes: d9c9e4db186a ("bpf: Factorize bpf_trace_printk and bpf_seq_printf")
Reported-by: [email protected]
Signed-off-by: Florent Revest <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'scripts/gdb/linux/timerlist.py')
0 files changed, 0 insertions, 0 deletions