scx_bpf_dsq_reenq() is declared with KF_IMPLICIT_ARGS in the kernel BTF,
which means the BPF verifier automatically injects the
struct bpf_prog_aux *aux parameter. The BPF-side weak symbol declaration
must NOT include the implicit parameter.
The previous declaration included an explicit aux__prog parameter, which
caused BPF programs calling scx_bpf_dsq_reenq() through the compat macro
to fail verification on kernels where the kfunc is available.
Fix the declaration to match the calling convention expected by the
verifier (2 parameters: dsq_id and reenq_flags).
Fixes: c50dcf533149 ("selftests/sched_ext: Add tests for SCX_ENQ_IMMED and scx_bpf_dsq_reenq()")
Signed-off-by: zhidao su <suzhidao@xiaomi.com>
---
tools/sched_ext/include/scx/compat.bpf.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
index 654b566bd94a..6fbacc909b8b 100644
--- a/tools/sched_ext/include/scx/compat.bpf.h
+++ b/tools/sched_ext/include/scx/compat.bpf.h
@@ -405,7 +405,7 @@ static inline void scx_bpf_reenqueue_local(void)
* v6.20: New scx_bpf_dsq_reenq() that allows re-enqueues on more DSQs. This
* will eventually deprecate scx_bpf_reenqueue_local().
*/
-void scx_bpf_dsq_reenq___compat(u64 dsq_id, u64 reenq_flags, const struct bpf_prog_aux *aux__prog) __ksym __weak;
+void scx_bpf_dsq_reenq___compat(u64 dsq_id, u64 reenq_flags) __ksym __weak;
static inline bool __COMPAT_has_generic_reenq(void)
{
@@ -415,7 +415,7 @@ static inline bool __COMPAT_has_generic_reenq(void)
static inline void scx_bpf_dsq_reenq(u64 dsq_id, u64 reenq_flags)
{
if (bpf_ksym_exists(scx_bpf_dsq_reenq___compat))
- scx_bpf_dsq_reenq___compat(dsq_id, reenq_flags, NULL);
+ scx_bpf_dsq_reenq___compat(dsq_id, reenq_flags);
else if (dsq_id == SCX_DSQ_LOCAL && reenq_flags == 0)
scx_bpf_reenqueue_local();
else
--
2.43.0