[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+bXk3qTekjVZ7NU0TpCh4zNg1GNFL-zdW++f2=t_BT8Q@mail.gmail.com>
Date: Thu, 27 Feb 2025 18:34:37 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: Juntong Deng <juntong.deng@...look.com>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, John Fastabend <john.fastabend@...il.com>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>, Eddy Z <eddyz87@...il.com>,
Song Liu <song@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Kumar Kartikeya Dwivedi <memxor@...il.com>, David Vernet <void@...ifault.com>, Andrea Righi <arighi@...dia.com>,
Changwoo Min <changwoo@...lia.com>, bpf <bpf@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH sched_ext/for-6.15 v3 3/5] sched_ext: Add
scx_kfunc_ids_ops_context_sensitive for unified filtering of
context-sensitive SCX kfuncs
On Thu, Feb 27, 2025 at 1:32 PM Tejun Heo <tj@...nel.org> wrote:
>
> Hello,
>
> On Thu, Feb 27, 2025 at 09:23:20PM +0000, Juntong Deng wrote:
> > > > + if (prog->type == BPF_PROG_TYPE_STRUCT_OPS &&
> > > > + prog->aux->st_ops != &bpf_sched_ext_ops)
> > > > + return 0;
> > >
> > > Why can't other struct_ops progs call scx_kfunc_ids_unlocked kfuncs?
> > >
> >
> > Return 0 means allowed. So kfuncs in scx_kfunc_ids_unlocked can be
> > called by other struct_ops programs.
>
> Hmm... would that mean a non-sched_ext bpf prog would be able to call e.g.
> scx_bpf_dsq_insert()?
Not as far as I can tell.
scx_kfunc_ids_unlocked[] doesn't include scx_bpf_dsq_insert.
It's part of scx_kfunc_ids_enqueue_dispatch[].
So this bit in patch 3 enables it:
+ if ((flags & SCX_OPS_KF_ENQUEUE) &&
+ btf_id_set8_contains(&scx_kfunc_ids_enqueue_dispatch, kfunc_id))
and in patch 2:
+ [SCX_OP_IDX(enqueue)] = SCX_OPS_KF_ENQUEUE,
So scx_bpf_dsq_insert() kfunc can only be called out
of enqueue() sched-ext hook.
So the restriction is still the same. afaict.
Powered by blists - more mailing lists