From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sched-ext: Use correct annotation for strings in kfuncs
Date: Mon, 21 Oct 2024 13:11:43 -0700 [thread overview]
Message-ID: <20241021201143.2010388-1-memxor@gmail.com> (raw)
The sched-ext kfuncs with bstr suffix need to take a string, but that
requires annotating the parameters with __str suffix, as right now the
verifier will treat this parameter as a one-byte memory region.
Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
Fixes: 07814a9439a3 ("sched_ext: Print debug dump after an error exit")
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
kernel/sched/ext.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 3cd7c50a51c5..8b8e3c907340 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -6708,7 +6708,7 @@ __bpf_kfunc_start_defs();
* Indicate that the BPF scheduler wants to exit gracefully, and initiate ops
* disabling.
*/
-__bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt,
+__bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt__str,
unsigned long long *data, u32 data__sz)
{
unsigned long flags;
@@ -6729,7 +6729,7 @@ __bpf_kfunc void scx_bpf_exit_bstr(s64 exit_code, char *fmt,
* Indicate that the BPF scheduler encountered a fatal error and initiate ops
* disabling.
*/
-__bpf_kfunc void scx_bpf_error_bstr(char *fmt, unsigned long long *data,
+__bpf_kfunc void scx_bpf_error_bstr(char *fmt__str, unsigned long long *data,
u32 data__sz)
{
unsigned long flags;
@@ -6753,7 +6753,7 @@ __bpf_kfunc void scx_bpf_error_bstr(char *fmt, unsigned long long *data,
* The extra dump may be multiple lines. A single line may be split over
* multiple calls. The last line is automatically terminated.
*/
-__bpf_kfunc void scx_bpf_dump_bstr(char *fmt, unsigned long long *data,
+__bpf_kfunc void scx_bpf_dump_bstr(char *fmt__str, unsigned long long *data,
u32 data__sz)
{
struct scx_dump_data *dd = &scx_dump_data;
--
2.43.5
next reply other threads:[~2024-10-21 20:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 20:11 Kumar Kartikeya Dwivedi [this message]
2024-10-21 20:13 ` [PATCH] sched-ext: Use correct annotation for strings in kfuncs Tejun Heo
2024-10-23 19:06 ` Tejun Heo
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=20241021201143.2010388-1-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=linux-kernel@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