Re: [syzbot] [kernel?] KASAN: slab-use-after-free Read in reweight_entity

From: Dmitry Safonov
Date: Tue Oct 17 2023 - 16:18:44 EST


On 10/17/23 20:07, Peter Zijlstra wrote:
> On Tue, Oct 17, 2023 at 07:58:56PM +0100, Dmitry Safonov wrote:
>> FWIW,
>> Managed to locally reproduce it twice on 58720809f527 (tag: v6.6-rc6)
>> Linux 6.6-rc6 + TCP-AO patches on the top.
>> (but can't reproduce reliably at will)
>>
>> [dima@Mindolluin linux-tcp-ao]$ ./scripts/faddr2line vmlinux
>> reweight_entity+0x3b0/0x490
>> reweight_entity+0x3b0/0x490:
>
> Could you please try:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=sched/urgent&id=a3b75dce9d9ae4510ea75b655567f50622f48706

I've run a hundred times the test that previously hit it twice, no
reproductions.

> ---
> Subject: sched/eevdf: Fix heap corruption more
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Date: Tue Oct 17 16:59:47 CEST 2023
>
> Because someone is a flaming idiot... :/
>
> Fixes: 8dafa9d0eb1a ("sched/eevdf: Fix min_deadline heap integrity")
> Reported-by: 0599jiangyc@xxxxxxxxx
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=218020
> ---
> kernel/sched/fair.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3699,7 +3699,8 @@ static void reweight_entity(struct cfs_r
> */
> deadline = div_s64(deadline * old_weight, weight);
> se->deadline = se->vruntime + deadline;
> - min_deadline_cb_propagate(&se->run_node, NULL);
> + if (se != cfs_rq->curr)
> + min_deadline_cb_propagate(&se->run_node, NULL);
> }
>
> #ifdef CONFIG_SMP

Thanks,
Dmitry