Sched_ext development
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@nvidia.com>
To: sashiko-reviews@lists.linux.dev
Cc: sched-ext@lists.linux.dev
Subject: Re: [PATCH v2 sched_ext/for-7.4] sched_ext: cid: Represent clusters explicitly
Date: Sat, 26 Sep 2026 23:59:45 +0200	[thread overview]
Message-ID: <arhAURU46nFUpXPc@gpd4> (raw)
In-Reply-To: <20260926213437.5FAC91F000FF@smtp.kernel.org>

On Sat, Sep 26, 2026 at 09:34:37PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Critical] bpf: scx_bpf_cid_topo UAPI break due to struct scx_cid_topo size change
> --
> 
> commit fb59a730e3e34d8a0c1fda134fb4459d8183c802
> Author: Andrea Righi <arighi@nvidia.com>
> 
> sched_ext: cid: Represent clusters explicitly
> 
> This commit adds explicit cluster representation to the sched_ext CID
> topology. It modifies the cid calculation logic and updates
> struct scx_cid_topo to include cluster_cid and cluster_idx.
> 
> Link: https://lore.kernel.org/r/20260926152306.3190774-1-arighi@nvidia.com
> 
> > diff --git a/kernel/sched/ext/types.h b/kernel/sched/ext/types.h
> > index 943d8d429a2c9..765d7b9208144 100644
> > --- a/kernel/sched/ext/types.h
> > +++ b/kernel/sched/ext/types.h
> 
> [ ... ]
> 
> > @@ -88,6 +95,8 @@ struct scx_cid_topo {
> >  	s32 node_idx;
> >  	s32 shard_cid;
> >  	s32 shard_idx;
> > +	s32 cluster_cid;
> > +	s32 cluster_idx;
> >  };
> 
> [Severity: Critical]
> Will adding cluster_cid and cluster_idx break existing BPF schedulers that
> call scx_bpf_cid_topo()?
> 
> By increasing the size of struct scx_cid_topo from 32 to 40 bytes, the
> expected argument size for the kfunc changes. Since scx_bpf_cid_topo()
> lacks a size-aware __sz parameter or compatibility wrapper:
> 
> kernel/sched/ext/cid.c:scx_bpf_cid_topo() {
>     ...
>     *out__uninit = topo[cid];
> }
> 
> Could the BPF verifier strictly reject older BPF schedulers passing a
> 32-byte allocation because out__uninit demands the current kernel's BTF size?
> 
> Furthermore, if the check were somehow bypassed, would the assignment cause
> an 8-byte out-of-bounds write into BPF stack or map memory?
> 
> Does this constitute a hard ABI break for existing userspace binaries since
> they lack a deprecation path or versioning wrapper?

For the records, as specified in the changelog of the patch, this is fixed by:
https://lore.kernel.org/r/fa6479d36b528573565ca22914451317@kernel.org.

-Andrea


  reply	other threads:[~2026-09-26 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-26 21:20 [PATCH v2 sched_ext/for-7.4] sched_ext: cid: Represent clusters explicitly Andrea Righi
2026-09-26 21:34 ` sashiko-bot
2026-09-26 21:59   ` Andrea Righi [this message]
2026-09-26 23:27 ` Tejun Heo
2026-09-27  6:12   ` Andrea Righi

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=arhAURU46nFUpXPc@gpd4 \
    --to=arighi@nvidia.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=sched-ext@lists.linux.dev \
    /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