From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 712512E54D1 for ; Mon, 8 Dec 2025 10:10:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765188612; cv=none; b=mHcLl5sLc5KoUFnS+ed5EjykEYffApKFJ/sURZRe6AIm3nWujwoXbUPK8VnTwYU4WLmxjEEbwsdJG53xK15SyvJ4BpWvzYGsMwbCWfxdx3njTY2rjNTAfZbeVo6I16rvyE/gnJDdPGfP6VDjGWeDIi5Fx5W2zheoCRHzyOmYk/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765188612; c=relaxed/simple; bh=qvAJQgCQy08eM3x14SffjGgY2A3LbBFXHuxiVJj+yho=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=W/C8HXK1oY5RpVcLCv/ZyJXaLgdf+41hInz/mJHj8JM2kFnzDx1W3FxGstLM1HVqjaH8fuFaJDIP+1g3w/i0aGwCSho4hWaXMeCndNoF+SpAnPahybT7kUNve/ZcODX4x2AhK0Q+OMn+2RPYtmFFXt3uQHM/lS3FOIzhCgznJ8U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=yVpMsBSM; arc=none smtp.client-ip=209.85.128.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jpiecuch.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="yVpMsBSM" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-4779da35d27so47148075e9.3 for ; Mon, 08 Dec 2025 02:10:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1765188609; x=1765793409; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=qvAJQgCQy08eM3x14SffjGgY2A3LbBFXHuxiVJj+yho=; b=yVpMsBSMZFZ8Jf/zJ2BRXAc8pltfINzFgfZI5F+yLdBjbbSknWv0cUTHGphq2QAyd+ vMZM4gGdyJeGi3cIvizW3DAyF+xK7c0/DAaTogpwJM9gsBBvjIFnYFD8B9zyj5wZ4kN4 /TeF4bVotmD443+sVFqR3mlsExiLQ4PVaeZ54u7NhPBmP+wPJVc/bt9HAneRoWSWfQgh MuRtsd7M278Yv/CntNfgJOVCqL4iZ0qd9nkfvXQfoXkzbRYXUm8l1cKHzyEVEen3NcHN RoK+a2Owsb2yfIDfkvnGtBLiyqG0ylQ6yIh4bYugTjkSp2Fipgf5sJI+KGsJJ2/5hRUu qacw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765188609; x=1765793409; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qvAJQgCQy08eM3x14SffjGgY2A3LbBFXHuxiVJj+yho=; b=iSlU+bByw/mxjEUWMhWswwgF3DunS2IGMUzlLp1Qs+ysUONEPkucq7NQNaxaX6naPO d2EXwGn7MIespSHp3xxyH8KfLaNPQLw5fEkkJShmYtlbuALs1TiV2MB+S78NaJp50w25 B2YWF5QRMc6nw9POafJuiVTpvfj+7ebLWBYv5yItE84+/VOPzTH8BzTp8No82wo1mdml 5XRkngL37MwWyDSuMfHrHQn2P+Dr+vntv6xY2tWlSyXCZU01g29F2EOKakcLktvtruBv lkVJ/OilPkNluKcfJTrqSFrtng0gAQLyuD8Ia09UkBepX70PDxm3ekZx1DhJqN+G/J+j uFxg== X-Forwarded-Encrypted: i=1; AJvYcCVZTeKu024h+DLpny8JB+a1Nai6KOtqm42t290o4e9xHFfcNo6AQ1Wze1NrkFojROXHHNEfw3NM7yQFSB4=@vger.kernel.org X-Gm-Message-State: AOJu0YywF1tRj2/Zs/UMARyMPAek8uHlkZJjHQxEMgH/rObqo0XYoBRD 9agrMFEyNOIMPHfTsqjVq1MPsqm35HVz8NQb3y+h+UpJDPy4kWB90PHVA9IzVCDl+VQ9iVriNTL OLctBkqhh0NOBJg== X-Google-Smtp-Source: AGHT+IFKl8n8hUOJ+IkmunqAnw6BgbwqfonOA/p4zto3138weU4XEGITtP+TMgG8BB1qmLKOKhNfIjJ+ykKxHA== X-Received: from wmbgx3.prod.google.com ([2002:a05:600c:8583:b0:477:9c68:bd6]) (user=jpiecuch job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:1381:b0:477:a246:8398 with SMTP id 5b1f17b1804b1-47939df15eemr74710005e9.2.1765188608623; Mon, 08 Dec 2025 02:10:08 -0800 (PST) Date: Mon, 08 Dec 2025 10:10:07 +0000 In-Reply-To: <20251206022218.1541878-1-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251206022218.1541878-1-jstultz@google.com> X-Mailer: aerc 0.20.1 Message-ID: Subject: Re: [RFC][PATCH] sched/ext: Avoid null ptr traversal when ->put_prev_task() is called with NULL next From: Kuba Piecuch To: John Stultz , LKML Cc: Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , K Prateek Nayak , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , Tejun Heo , David Vernet , Andrea Righi , Changwoo Min , , Content-Type: text/plain; charset="UTF-8" Hello John, On Sat Dec 6, 2025 at 2:22 AM UTC, John Stultz wrote: > I can't say I understand why this doesn't trip usually without > proxy-exec. And in newer kernels there are way fewer > put_prev_task(), and I can't easily reproduce the issue now > even with proxy-exec. That's probably because put_prev_task_scx() with next == NULL is always preceded by a dequeue, clearing SCX_TASK_QUEUED from p->scx.flags, so we don't reach the problematic sched_class_above() check because it only happens when the flag is set. > But we still have one put_prev_task() call left in core.c that > seems like it could trip this, so I wanted to send this out for > consideration. I'm assuming you're referring to the one in sched_change_begin(). It looks like it's impossible for an outside observer holding a CPU's rq lock to observe a task that is running on that CPU and isn't queued, i.e. 'running' implies 'queued' (I'm new to the scheduler so I may be wrong here). That would explain why dequeue_task() is always called before put_prev_task(). Does proxy execution break that assumption? Best, Kuba