netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amery Hung <ameryhung@gmail.com>
To: bpf@vger.kernel.org
Cc: netdev@vger.kernel.org, alexei.starovoitov@gmail.com,
	andrii@kernel.org, daniel@iogearbox.net, tj@kernel.org,
	memxor@gmail.com, martin.lau@kernel.org,
	linux-lists@etsalapatis.com, ameryhung@gmail.com,
	kernel-team@meta.com
Subject: [PATCH bpf-next v7 1/4] bpf: Allow syscall bpf programs to call non-recur helpers
Date: Wed, 30 Jul 2025 11:58:52 -0700	[thread overview]
Message-ID: <20250730185903.3574598-2-ameryhung@gmail.com> (raw)
In-Reply-To: <20250730185903.3574598-1-ameryhung@gmail.com>

Allow syscall programs to call non-recur helpers too since syscall bpf
programs runs in process context through bpf syscall, BPF_PROG_TEST_RUN,
and cannot run recursively.

bpf_task_storage_{get,set} have "_recur" versions that call trylock
instead of taking the lock directly to avoid deadlock when called by
bpf programs that run recursively. Currently, only bpf_lsm, bpf_iter,
struct_ops without private stack are allow to call the non-recur helpers
since they cannot be recursively called in another bpf program.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
---
 include/linux/bpf_verifier.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 94defa405c85..c823f8efe3ed 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -962,6 +962,7 @@ static inline bool bpf_prog_check_recur(const struct bpf_prog *prog)
 	case BPF_PROG_TYPE_STRUCT_OPS:
 		return prog->aux->jits_use_priv_stack;
 	case BPF_PROG_TYPE_LSM:
+	case BPF_PROG_TYPE_SYSCALL:
 		return false;
 	default:
 		return true;
-- 
2.47.3


  reply	other threads:[~2025-07-30 18:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30 18:58 [PATCH bpf-next v7 0/4] Task local data Amery Hung
2025-07-30 18:58 ` Amery Hung [this message]
2025-07-31 18:26   ` [PATCH bpf-next v7 1/4] bpf: Allow syscall bpf programs to call non-recur helpers Emil Tsalapatis
2025-07-30 18:58 ` [PATCH bpf-next v7 2/4] selftests/bpf: Introduce task local data Amery Hung
2025-07-31 18:27   ` Emil Tsalapatis
2025-07-30 18:58 ` [PATCH bpf-next v7 3/4] selftests/bpf: Test basic task local data operations Amery Hung
2025-07-31 18:27   ` Emil Tsalapatis
2025-07-30 18:58 ` [PATCH bpf-next v7 4/4] selftests/bpf: Test concurrent task local data key creation Amery Hung
2025-07-31 18:27   ` Emil Tsalapatis
2025-08-02  1:15 ` [PATCH bpf-next v7 0/4] Task local data patchwork-bot+netdevbpf

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=20250730185903.3574598-2-ameryhung@gmail.com \
    --to=ameryhung@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=linux-lists@etsalapatis.com \
    --cc=martin.lau@kernel.org \
    --cc=memxor@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).