All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
To: stable@vger.kernel.org
Cc: cascardo@igalia.com, jolsa@kernel.org, daniel@iogearbox.net, yhs@fb.com
Subject: [PATCH 5.15,6.1] Fixup preempt imbalance with bpf_trace_printk
Date: Sat, 17 Feb 2024 09:13:14 -0300	[thread overview]
Message-ID: <20240217121321.2045993-1-cascardo@igalia.com> (raw)

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


             reply	other threads:[~2024-02-17 12:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-17 12:13 Thadeu Lima de Souza Cascardo [this message]
2024-02-17 12:13 ` [PATCH 6.1 1/3] bpf: Add struct for bin_args arg in bpf_bprintf_prepare Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 6.1 2/3] bpf: Do cleanup in bpf_bprintf_cleanup only when needed Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 6.1 3/3] bpf: Remove trace_printk_lock Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 5.15 1/4] bpf: Merge printk and seq_printf VARARG max macros Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 5.15 2/4] bpf: Add struct for bin_args arg in bpf_bprintf_prepare Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 5.15 3/4] bpf: Do cleanup in bpf_bprintf_cleanup only when needed Thadeu Lima de Souza Cascardo
2024-02-17 12:13 ` [PATCH 5.15 4/4] bpf: Remove trace_printk_lock Thadeu Lima de Souza Cascardo
2024-02-23 15:43 ` [PATCH 5.15,6.1] Fixup preempt imbalance with bpf_trace_printk Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240217121321.2045993-1-cascardo@igalia.com \
    --to=cascardo@igalia.com \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.