From: Yonghong Song <yonghong.song@linux.dev>
To: Kumar Kartikeya Dwivedi <memxor@gmail.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Barret Rhoden <brho@google.com>,
David Vernet <void@manifault.com>, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH bpf-next v1 2/2] selftests/bpf: Add test for static subprog call in lock cs
Date: Sun, 4 Feb 2024 13:26:45 -0800 [thread overview]
Message-ID: <e5913c58-abbe-46bd-a439-99a61130e8fe@linux.dev> (raw)
In-Reply-To: <20240204120206.796412-3-memxor@gmail.com>
On 2/4/24 4:02 AM, Kumar Kartikeya Dwivedi wrote:
> Add selftests for static subprog calls within bpf_spin_lock critical
> section, and ensure we still reject global subprog calls. Also test the
> case where a subprog call will unlock the caller's held lock, or the
> caller will unlock a lock taken by a subprog call, ensuring correct
> transfer of lock state across frames on exit.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
LGTM with possible verifier message rewording from "function calls are
not allowed while holding a lock" to "global function calls are not
allowed ...".
Acked-by: Yonghong Song <yonghong.song@linux.dev>
> ---
> .../selftests/bpf/prog_tests/spin_lock.c | 2 +
> .../selftests/bpf/progs/test_spin_lock.c | 65 +++++++++++++++++++
> .../selftests/bpf/progs/test_spin_lock_fail.c | 44 +++++++++++++
> 3 files changed, 111 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/spin_lock.c b/tools/testing/selftests/bpf/prog_tests/spin_lock.c
> index 18d451be57c8..6a4962ca0e5e 100644
> --- a/tools/testing/selftests/bpf/prog_tests/spin_lock.c
> +++ b/tools/testing/selftests/bpf/prog_tests/spin_lock.c
> @@ -48,6 +48,8 @@ static struct {
> { "lock_id_mismatch_innermapval_kptr", "bpf_spin_unlock of different lock" },
> { "lock_id_mismatch_innermapval_global", "bpf_spin_unlock of different lock" },
> { "lock_id_mismatch_innermapval_mapval", "bpf_spin_unlock of different lock" },
> + { "lock_global_subprog_call1", "function calls are not allowed while holding a lock" },
> + { "lock_global_subprog_call2", "function calls are not allowed while holding a lock" },
> };
>
> static int match_regex(const char *pattern, const char *string)
[...]
next prev parent reply other threads:[~2024-02-04 21:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-04 12:02 [PATCH bpf-next v1 0/2] Enable static subprog calls in spin lock critical sections Kumar Kartikeya Dwivedi
2024-02-04 12:02 ` [PATCH bpf-next v1 1/2] bpf: Allow calling static subprogs while holding a bpf_spin_lock Kumar Kartikeya Dwivedi
2024-02-04 21:23 ` Yonghong Song
2024-02-04 22:09 ` Kumar Kartikeya Dwivedi
2024-02-04 21:33 ` David Vernet
2024-02-04 22:10 ` Kumar Kartikeya Dwivedi
2024-02-04 23:55 ` Yonghong Song
2024-02-04 12:02 ` [PATCH bpf-next v1 2/2] selftests/bpf: Add test for static subprog call in lock cs Kumar Kartikeya Dwivedi
2024-02-04 21:26 ` Yonghong Song [this message]
2024-02-04 21:36 ` David Vernet
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=e5913c58-abbe-46bd-a439-99a61130e8fe@linux.dev \
--to=yonghong.song@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brho@google.com \
--cc=daniel@iogearbox.net \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=tj@kernel.org \
--cc=void@manifault.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox