On Wed, Feb 05, 2025 at 07:30:14PM +0000, Juntong Deng wrote:
...
+static int scx_kfunc_ids_other_rqlocked_filter(const struct bpf_prog *prog, u32 kfunc_id)
+{
+ u32 moff = prog->aux->attach_st_ops_member_off;
+
+ if (moff == offsetof(struct sched_ext_ops, runnable) ||
+ moff == offsetof(struct sched_ext_ops, dequeue) ||
+ moff == offsetof(struct sched_ext_ops, stopping) ||
+ moff == offsetof(struct sched_ext_ops, quiescent) ||
+ moff == offsetof(struct sched_ext_ops, yield) ||
+ moff == offsetof(struct sched_ext_ops, cpu_acquire) ||
+ moff == offsetof(struct sched_ext_ops, running) ||
+ moff == offsetof(struct sched_ext_ops, core_sched_before) ||
+ moff == offsetof(struct sched_ext_ops, set_cpumask) ||
+ moff == offsetof(struct sched_ext_ops, update_idle) ||
+ moff == offsetof(struct sched_ext_ops, tick) ||
+ moff == offsetof(struct sched_ext_ops, enable) ||
+ moff == offsetof(struct sched_ext_ops, set_weight) ||
+ moff == offsetof(struct sched_ext_ops, disable) ||
+ moff == offsetof(struct sched_ext_ops, exit_task) ||
+ moff == offsetof(struct sched_ext_ops, dump_task) ||
+ moff == offsetof(struct sched_ext_ops, dump_cpu))
+ return 0;
+
+ return -EACCES;
Actually, do we need this filter at all?
I think the other filters in your patch set should be sufficient to
establish the correct permissions for all kfuncs, as none of them need to
be called from any rq-locked operations. Or am I missing something?
-Andrea