Re: [PATCH 5.15,6.1] Fixup preempt imbalance with bpf_trace_printk

Greg KH
2024-02-23T15:44:02Z

On Sat, Feb 17, 2024 at 09:13:14AM -0300, Thadeu Lima de Souza Cascardo wrote:
> When bpf_trace_printk is called without any args in a second depth level,
> it will enable preemption without disabling it.
>
> These patch series fix this for 5.15 and 6.1. The fix was introduced in
> 6.3, so later kernels already have it. And 5.10 and earlier did not have
> the code that disabled preemption, so they are fine in that regard.
>
> This was tested by attaching a bpf program doing a non-0 arguments
> trace_printk at sys_enter and a 0 arguments snprintf at local_timer_entry.
>
> Dave Marchevsky (1):
> bpf: Merge printk and seq_printf VARARG max macros
>
> Jiri Olsa (3):
> bpf: Add struct for bin_args arg in bpf_bprintf_prepare
> bpf: Do cleanup in bpf_bprintf_cleanup only when needed
> bpf: Remove trace_printk_lock
>
> include/linux/bpf.h | 14 ++++++--
> kernel/bpf/helpers.c | 71 ++++++++++++++++++++++------------------
> kernel/bpf/verifier.c | 3 +-
> kernel/trace/bpf_trace.c | 39 ++++++++++------------
> 4 files changed, 72 insertions(+), 55 deletions(-)
>
> --
> 2.34.1
>
>

All now queued up, thanks!

greg k-h