On Wed, Oct 23, 2024 at 04:07:49PM -0700, Alexei Starovoitov wrote: > On Wed, Oct 23, 2024 at 2:00 PM Tejun Heo <tj@xxxxxxxxxx> wrote: > > > > Hello, > > > > On Tue, Oct 22, 2024 at 01:19:58PM -0700, Alexei Starovoitov wrote: > > > > The __nullable argument tagging request was originally from sched_ext but I also > > > > don't see its usage in-tree for now. > > > > > > ok. Let's sync up with Tejun whether they have plans to use it. > > > > Yeah, in sched_ext_ops.dispatch(s32 cpu, struct task_struct *prev), @prev > > can be NULL and right now if a BPF scheduler derefs without checking for > > NULL, it can trigger kernel crash, I think, so it needs __nullable tagging. > > I see. The following should do it: > diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c > index 3cd7c50a51c5..82bef41d7eae 100644 > --- a/kernel/sched/ext.c > +++ b/kernel/sched/ext.c > @@ -5492,7 +5492,7 @@ static int bpf_scx_validate(void *kdata) > static s32 select_cpu_stub(struct task_struct *p, s32 prev_cpu, u64 > wake_flags) { return -EINVAL; } > static void enqueue_stub(struct task_struct *p, u64 enq_flags) {} > static void dequeue_stub(struct task_struct *p, u64 enq_flags) {} > -static void dispatch_stub(s32 prev_cpu, struct task_struct *p) {} > +static void dispatch_stub(s32 prev_cpu, struct task_struct *p__nullable) {} This is a lot neater than the existing workaround: http://lkml.kernel.org/r/Zxma-ZFPKYZDqCGu@xxxxxxxxxxxxxxx Thanks! -- tejun