All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Wanwu Li <liwanwu@kylinos.cn>
Cc: Andrea Righi <arighi@nvidia.com>,
	David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched_ext: Reject NMI calls to lock-taking kfuncs
Date: Tue, 01 Sep 2026 20:44:57 -1000	[thread overview]
Message-ID: <49faaba5039a29f38ab6f254da6fb8dc@kernel.org> (raw)
In-Reply-To: <20260902023124.1422942-1-liwanwu@kylinos.cn>

Hello,

On Wed, Sep 02, 2026 at 10:31:24AM +0800, Wanwu Li wrote:
> -	if (sch)
> -		destroy_dsq(sch, dsq_id);
> +	if (!sch)
> +		return;

unlikely(!sch) like the other kfuncs.

> @@ -9756,6 +9755,9 @@ __bpf_kfunc struct task_struct *bpf_iter_scx_dsq_next(struct bpf_iter_scx_dsq *i
>  	if (!kit->dsq)
>  		return NULL;
>
> +	if (!scx_kf_allowed_ctx(kit->dsq->sched))
> +		return NULL;

new(), next() and destroy() always run in the same context, so reject in
bpf_iter_scx_dsq_new() and drop the checks from next() and destroy(). With
kit->dsq left NULL, both are no-ops.

> +static __always_inline bool __scx_kf_allowed_ctx(struct scx_sched *sch,
> +						 const char *who)

No need to wrap.

Thanks.

-- 
tejun

  reply	other threads:[~2026-09-02  6:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01  9:56 [PATCH] sched_ext: Reject NMI calls to lock-taking kfuncs Wanwu Li
2026-09-01 19:51 ` Andrea Righi
2026-09-01 20:13   ` Tejun Heo
2026-09-01 20:28     ` Andrea Righi
2026-09-01 21:16 ` Tejun Heo
2026-09-02  2:31   ` [PATCH v2] " Wanwu Li
2026-09-02  6:44     ` Tejun Heo [this message]
2026-09-02  9:36       ` [PATCH v3] " Wanwu Li
2026-09-02  9:51         ` sashiko-bot
2026-09-02 23:05         ` Tejun Heo
2026-09-03  1:46           ` liwanwu
2026-09-02 13:48       ` [PATCH v2] " liwanwu
2026-09-02 21:51         ` Tejun Heo

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=49faaba5039a29f38ab6f254da6fb8dc@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=emil@etsalapatis.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwanwu@kylinos.cn \
    --cc=sched-ext@lists.linux.dev \
    --cc=void@manifault.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.