mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Christian Loehle <christian.loehle@arm.com>,
	Jake Hillion <jakehillion@meta.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 sched_ext/for-6.18] sched_ext: Fix NULL dereference in scx_bpf_cpu_rq() warning
Date: Thu, 4 Sep 2025 10:27:59 -1000	[thread overview]
Message-ID: <aLn2T4LUePv9gAwc@slm.duckdns.org> (raw)
In-Reply-To: <20250904182348.107835-1-arighi@nvidia.com>

On Thu, Sep 04, 2025 at 08:23:48PM +0200, Andrea Righi wrote:
> When printing the deprecation warning for scx_bpf_cpu_rq(), we may hit a
> NULL pointer dereference if the kfunc is called before a BPF scheduler
> is fully attached, for example, when invoked from a BPF timer or during
> ops.init():
> 
>  [   50.752775] BUG: kernel NULL pointer dereference, address: 0000000000000331
>  ...
>  [   50.764205] RIP: 0010:scx_bpf_cpu_rq+0x30/0xa0
>  ...
>  [   50.787661] Call Trace:
>  [   50.788398]  <TASK>
>  [   50.789061]  bpf_prog_08f7fd2dcb187aaf_wakeup_timerfn+0x75/0x1a8
>  [   50.792477]  bpf_timer_cb+0x7e/0x140
>  [   50.796003]  hrtimer_run_softirq+0x91/0xe0
>  [   50.796952]  handle_softirqs+0xce/0x3c0
>  [   50.799087]  run_ksoftirqd+0x3e/0x70
>  [   50.800197]  smpboot_thread_fn+0x133/0x290
>  [   50.802320]  kthread+0x115/0x220
>  [   50.804984]  ret_from_fork+0x17a/0x1d0
>  [   50.806920]  ret_from_fork_asm+0x1a/0x30
>  [   50.807799]  </TASK>
> 
> Fix this by only printing the warning once the scheduler is fully
> registered.
> 
> Fixes: 5c48d88fe0049 ("sched_ext: deprecation warn for scx_bpf_cpu_rq()")
> Cc: Christian Loehle <christian.loehle@arm.com>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>

Applied to sched_ext/for-6.18.

Thanks.

-- 
tejun

      reply	other threads:[~2025-09-04 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 18:23 Andrea Righi
2025-09-04 20:27 ` Tejun Heo [this message]

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=aLn2T4LUePv9gAwc@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=christian.loehle@arm.com \
    --cc=jakehillion@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®