From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A5152749CF for ; Fri, 27 Feb 2026 18:31:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772217072; cv=none; b=M/NXhB0o+G8gqiptvPnXo1d/KobDHEcDNb2Z73H4IKMKTdNoI4isyVdP1C+DvwrrOgEnUvDHy06QOkp6GfbIq+aOj+n/9eZ1CvgGP5RxRWst7Nck+psAkox18Itox/vVw97gltJhnh7DaVTVvvQmPX5R3nAPF4szVc1JdN5JP1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772217072; c=relaxed/simple; bh=/t2QTgY2pDvn5MI2iFt+fkH4zTPm2j4elg2kXbTW8rA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VLY/N9OoqISp8r8EN6+7KEOfBfnx1A2qxZVDFYihaMdcpVJox1JwGXpjZmyxSH4q9qQQm/0gOFvlr0FasEIhax3ezKVbUL1CbpbNDHIOD3rWVtTte22TG44EFw/3svpSeUQyaeWMHTBRAGAMBi9bff2pq1iPYRNxBvVXDnLifqA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SlsTclal; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SlsTclal" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0EB6C116C6; Fri, 27 Feb 2026 18:31:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772217071; bh=/t2QTgY2pDvn5MI2iFt+fkH4zTPm2j4elg2kXbTW8rA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SlsTclalGVJpSx36MdKoMQDWzmJFX9M9xv2e+GxDsJ2R2h5eSW8fXaGt7Py5Js2Hj hFGXqTk3f7aDHP/ej757MOwTKc1KfXV/EFZzbe49+kKjmsfVY4Qc8l5CWQ1asaH8rW 4Qf59Qe93ObTvjm7YC+TOG7FVhjNkrsH0GYble5gzp2YIEVLecG/cvt6gD5ub1/UEb buCS9Rnvfp8ogLfnsjUj3x4MEVYda3Ev4Kx0uBdV9eBKSiZedp33YF0Lo/7gR+R39C aFfHa9qaPeDNkunwbBU2bLLetysDj/5dqcIM0wyEdVRft8+cc2yPFK+zmOU2Hw9a/x or6gAHr5fbc8A== Date: Fri, 27 Feb 2026 08:31:10 -1000 From: Tejun Heo To: David Carlier Cc: David Vernet , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] sched_ext: Use rcu_dereference() for scx_root in dump paths Message-ID: References: <20260226052640.7191-1-devnexen@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260226052640.7191-1-devnexen@gmail.com> Hello, On Thu, Feb 26, 2026 at 05:26:39AM +0000, David Carlier wrote: > scx_dump_task() and scx_dump_state() read scx_root directly without > rcu_dereference() or NULL check. If the BPF scheduler is torn down > concurrently, scx_root can become NULL between the read and the > dereference in SCX_HAS_OP(), causing a NULL pointer dereference. scx_dump_state() is called from scx_error_irq_workfn() and sysrq_handle_sched_ext_dump(). SCX can't turn off before dump is complete in the former case. In the latter, scx_enabled() gates the call and it's in the irq context. When scx_enabled() turns off, there's synchronize_rcu() call afterwards before anything happens to scx_root. ie. It cannot go away in flight. This is the same synchronization that protect other in-flight sched ops. Thanks. -- tejun