From: Peter Zijlstra <peterz@infradead.org>
To: Marco Elver <elver@google.com>
Cc: paulmck@kernel.org, Alexander Potapenko <glider@google.com>,
syzbot <syzbot+0ec1e96c2cdf5c0e512a@syzkaller.appspotmail.com>,
audit@vger.kernel.org, eparis@redhat.com,
linux-kernel@vger.kernel.org, paul@paul-moore.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [kernel?] KCSAN: assert: race in dequeue_entities
Date: Tue, 22 Oct 2024 21:12:44 +0200 [thread overview]
Message-ID: <20241022191244.GB9657@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <ZxerZIxg8kAMCvYc@elver.google.com>
On Tue, Oct 22, 2024 at 03:40:52PM +0200, Marco Elver wrote:
> Which gives us:
>
> | ==================================================================
> | BUG: KCSAN: assert: race in dequeue_entities / ttwu_do_activate
> |
> | write (marked) to 0xffff9e100329c628 of 4 bytes by interrupt on cpu 0:
> | activate_task kernel/sched/core.c:2064 [inline]
>
> This is this one:
>
> void activate_task(struct rq *rq, struct task_struct *p, int flags)
> {
> if (task_on_rq_migrating(p))
> flags |= ENQUEUE_MIGRATED;
> if (flags & ENQUEUE_MIGRATED)
> sched_mm_cid_migrate_to(rq, p);
>
> enqueue_task(rq, p, flags);
>
> WRITE_ONCE(p->on_rq, TASK_ON_RQ_QUEUED);
> ASSERT_EXCLUSIVE_WRITER(p->on_rq);
> }
>
> | ttwu_do_activate+0x153/0x3e0 kernel/sched/core.c:3671
> | ttwu_queue kernel/sched/core.c:3944 [inline]
> | try_to_wake_up+0x60f/0xaf0 kernel/sched/core.c:4270
> | assert no writes to 0xffff9e100329c628 of 4 bytes by task 10571 on cpu 3:
> | __block_task kernel/sched/sched.h:2770 [inline]
>
> And that's:
>
> static inline void __block_task(struct rq *rq, struct task_struct *p)
> {
> WRITE_ONCE(p->on_rq, 0);
> ASSERT_EXCLUSIVE_WRITER(p->on_rq);
> if (p->sched_contributes_to_load)
> rq->nr_uninterruptible++;
>
> | dequeue_entities+0xd83/0xe70 kernel/sched/fair.c:7177
> | pick_next_entity kernel/sched/fair.c:5627 [inline]
> | pick_task_fair kernel/sched/fair.c:8856 [inline]
> | pick_next_task_fair+0xaf/0x710 kernel/sched/fair.c:8876
> | __pick_next_task kernel/sched/core.c:5955 [inline]
> | pick_next_task kernel/sched/core.c:6477 [inline]
> | __schedule+0x47a/0x1130 kernel/sched/core.c:6629
> | __schedule_loop kernel/sched/core.c:6752 [inline]
> | schedule+0x7b/0x130 kernel/sched/core.c:6767
So KCSAn is trying to tell me these two paths run concurrently on the
same 'p' ?!? That would be a horrible bug -- both these call chains
should be holding rq->__lock (for task_rq(p)).
next prev parent reply other threads:[~2024-10-22 19:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 14:57 [syzbot] [kernel?] KCSAN: assert: race in dequeue_entities syzbot
2024-10-22 8:06 ` Alexander Potapenko
2024-10-22 11:31 ` Peter Zijlstra
2024-10-22 13:40 ` Marco Elver
2024-10-22 14:31 ` Paul E. McKenney
2024-10-23 14:13 ` Paul E. McKenney
2024-10-22 19:12 ` Peter Zijlstra [this message]
2024-10-22 19:57 ` Marco Elver
2024-10-23 8:54 ` Marco Elver
2024-10-23 9:03 ` Marco Elver
2024-10-23 9:36 ` Peter Zijlstra
2024-10-23 13:18 ` Marco Elver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241022191244.GB9657@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=audit@vger.kernel.org \
--cc=elver@google.com \
--cc=eparis@redhat.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=paulmck@kernel.org \
--cc=syzbot+0ec1e96c2cdf5c0e512a@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox