From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out187-2.us.a.mail.aliyun.com (out187-2.us.a.mail.aliyun.com [47.90.187.2]) (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 A29BF290F for ; Sun, 22 Dec 2024 15:49:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=47.90.187.2 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734882559; cv=none; b=bq4oJ2FWsXaFN+7fHsCBCr097u2LzWkcYCwzcITrldVdDIfEiDj80KOuXMsGYXIXTPLPyCJdXwlIp6KC8PzQ3ITaFPH1ivysHgJ5cA04eNEvpvfLAnKQw3Q4mzT1SIrcnPOzRBmyzsk/HOGiqOLDQsoOECfc1F9Cmo+7IV5Vu7E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734882559; c=relaxed/simple; bh=kNt74t30iSU25Lf6m9kmk7nMn1k9NJbNl8LH/BGgRko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=W3Khnf3rZnpBb1SOMWfI1ibjISLMvZe5r1Ra8noItTi7PTtmao9u0mYyv28PHokuAEieifHURHWG2v/M6PRFFQUtv2Rfaq/qaC7mOHzwuJ42RDg0cffcX63PUd7Y32OdTwORk/KiqmtmCNjtpmc7LQSvJXAY25ZUSHb0evkJ9e4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=DwKvC3/K; arc=none smtp.client-ip=47.90.187.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="DwKvC3/K" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1734882543; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=fX7Ov2FSRG4PZFI52i1P83oHT7uza8QN6GFnDL+rOvE=; b=DwKvC3/KmFZ2j/HN7WFjLxz8lslAXUNRJAUHQ66CqL2N8P6OiOIsfMQZfUUZfkVTyU/fyei6q0ZLQXtHWEoWKRFeZjx4TmceX8KEaF3ukx46+pvss8TDIfZBkewYmi4cvePQEhHUdhjnV/2MedHDsR5/GdlWaVeAhEdgH9kUyjw= Received: from localhost(mailfrom:henry.hj@antgroup.com fp:SMTPD_---.ak6TIEJ_1734882226 cluster:ay29) by smtp.aliyun-inc.com; Sun, 22 Dec 2024 23:43:46 +0800 From: "Henry Huang" To: tj@kernel.org, void@manifault.com Cc: "=?UTF-8?B?6LCI6Ym06ZSL?=" , "=?UTF-8?B?WWFuIFlhbihjYWlsaW5nKQ==?=" , , "Henry Huang" Subject: [PATCH v1] sched_ext: initialize kit->cursor.flags Date: Sun, 22 Dec 2024 23:43:16 +0800 Message-ID: <20241222154316.67077-2-henry.hj@antgroup.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241222154316.67077-1-henry.hj@antgroup.com> References: <20241222154316.67077-1-henry.hj@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit struct bpf_iter_scx_dsq *it maybe not initialized. If we didn't call scx_bpf_dsq_move_set_vtime and scx_bpf_dsq_move_set_slice before scx_bpf_dsq_move, it would cause unexpected behaviors: 1. Assign a huge slice into p->scx.slice 2. Assign a invalid vtime into p->scx.dsq_vtime Signed-off-by: Henry Huang --- kernel/sched/ext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c index 7fff1d0..81da76a 100644 --- a/kernel/sched/ext.c +++ b/kernel/sched/ext.c @@ -7013,7 +7013,7 @@ __bpf_kfunc int bpf_iter_scx_dsq_new(struct bpf_iter_scx_dsq *it, u64 dsq_id, return -ENOENT; INIT_LIST_HEAD(&kit->cursor.node); - kit->cursor.flags |= SCX_DSQ_LNODE_ITER_CURSOR | flags; + kit->cursor.flags = SCX_DSQ_LNODE_ITER_CURSOR | flags; kit->cursor.priv = READ_ONCE(kit->dsq->seq); return 0; -- 1.8.3.1