* [PATCH v1] sched_ext: initialize kit->cursor.flags
@ 2024-12-22 15:43 Henry Huang
2024-12-22 15:43 ` Henry Huang
0 siblings, 1 reply; 3+ messages in thread
From: Henry Huang @ 2024-12-22 15:43 UTC (permalink / raw)
To: tj, void
Cc: 谈鉴锋, Yan Yan(cailing), linux-kernel,
Henry Huang
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
Henry Huang (1):
sched_ext: initialize kit->cursor.flags
kernel/sched/ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1] sched_ext: initialize kit->cursor.flags
2024-12-22 15:43 [PATCH v1] sched_ext: initialize kit->cursor.flags Henry Huang
@ 2024-12-22 15:43 ` Henry Huang
2024-12-24 20:56 ` Tejun Heo
0 siblings, 1 reply; 3+ messages in thread
From: Henry Huang @ 2024-12-22 15:43 UTC (permalink / raw)
To: tj, void
Cc: 谈鉴锋, Yan Yan(cailing), linux-kernel,
Henry Huang
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 <henry.hj@antgroup.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] sched_ext: initialize kit->cursor.flags
2024-12-22 15:43 ` Henry Huang
@ 2024-12-24 20:56 ` Tejun Heo
0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2024-12-24 20:56 UTC (permalink / raw)
To: Henry Huang
Cc: void, 谈鉴锋, Yan Yan(cailing), linux-kernel
On Sun, Dec 22, 2024 at 11:43:16PM +0800, Henry Huang wrote:
> 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 <henry.hj@antgroup.com>
Applied to sched_ext/for-6.13-fixes w/ Fixes tag and stable cc added.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-24 20:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-22 15:43 [PATCH v1] sched_ext: initialize kit->cursor.flags Henry Huang
2024-12-22 15:43 ` Henry Huang
2024-12-24 20:56 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox