mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Alexander Potapenko <glider@google.com>,
	Dmitry Vyukov <dvyukov@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	Andrey Konovalov <andreyknvl@google.com>,
	Clark Williams <williams@redhat.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Marco Elver <elver@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>
Subject: Re: [PATCH v6] kcov: fix data corruption and race conditions on PREEMPT_RT by moving saved remote state to task_struct
Date: Fri, 10 Jul 2026 16:24:16 +0200	[thread overview]
Message-ID: <20260710142416.YnGT-pdK@linutronix.de> (raw)
In-Reply-To: <ebbe596a-a828-4fd7-bb8e-062f04d2bd6c@I-love.SAKURA.ne.jp>

On 2026-07-10 20:32:27 [+0900], Tetsuo Handa wrote:
> syzbot is reporting KCOV state corruption on PREEMPT_RT kernels, for the
> temporary storage used for saving/restoring remote KCOV state is currently
> allocated as the per-CPU area.
> 
> On PREEMPT_RT kernels, softirq handlers run as preemptible task threads
> (e.g., ksoftirqd). If a softirq context preempts a task running a remote
> KCOV session, it safely saves the task's state into the per-CPU area.
> However, if that softirq thread is subsequently preempted by a higher-
> priority softirq thread on the same CPU, the second softirq will overwrite
> the same per-CPU area, permanently destroying the original task's KCOV
> state.
> 
> Fix this data corruption by moving the temporary storage from the per-CPU
> area to the per-thread area. Since each softirq thread now owns its own
> task context, nested softirq preemption no longer causes data overwrites.
> 
> Note that while the temporary storage is now on a per-thread basis, the
> per-CPU kcov_percpu_data.lock must be retained, for we need to ensure that
> kcov_remote_start() and kcov_remote_stop() operate atomically without
> racing against asynchronous interrupts that manipulate the current task's
> KCOV state.
> 
> Reported-by: syzbot+3f51ad7ac3ae57a6fdcc@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=3f51ad7ac3ae57a6fdcc
> Reported-by: syzbot+47cf95ca1f9dcca872c8@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=47cf95ca1f9dcca872c8
> Reported-by: syzbot+8a173e13208949931dc7@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=8a173e13208949931dc7
> Reported-by: syzbot+90984d3713722683112e@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=90984d3713722683112e
> Analyzed-by: AI Mode in Google Search (no mail address)
> Fixes: 5ff3b30ab57d ("kcov: collect coverage from interrupts")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

No complains from my side. Thank you.

Sebastian

  parent reply	other threads:[~2026-07-10 14:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-04 15:30 [PATCH (draft)] kcov: fix potential kcov_mode corruption under CONFIG_PREEMPT_RT Tetsuo Handa
2026-05-04 15:39 ` Tetsuo Handa
2026-05-05  8:15 ` [PATCH] " Tetsuo Handa
2026-05-06 11:55   ` [PATCH v2] kcov: fix state corruption under CONFIG_PREEMPT_RT by eliminating per-cpu data Tetsuo Handa
2026-05-09  8:09     ` [PATCH v3] kcov: move kcov_remote_data to task_struct for RT and remove local_lock Tetsuo Handa
2026-05-15  7:10       ` Dmitry Vyukov
2026-05-20 10:33         ` Tetsuo Handa
2026-05-20 15:12       ` Sebastian Andrzej Siewior
2026-05-21  8:38       ` Sebastian Andrzej Siewior
2026-05-21 15:28         ` Tetsuo Handa
2026-05-21 18:14           ` Sebastian Andrzej Siewior
2026-05-22  2:39             ` Tetsuo Handa
2026-05-22 11:10               ` [PATCH v4] kcov: move kcov_remote_data to task_struct " Tetsuo Handa
2026-05-22 13:27                 ` Sebastian Andrzej Siewior
2026-05-29  6:35                 ` Tetsuo Handa
2026-06-27  9:58                   ` [PATCH v5] kcov: fix data corruption and race conditions on PREEMPT_RT by moving saved remote state to task_struct Tetsuo Handa
2026-07-07 13:36                     ` Tetsuo Handa
2026-07-07 15:00                       ` Alexander Potapenko
2026-07-07 22:07                         ` Tetsuo Handa
2026-07-08 15:28                     ` Alexander Potapenko
2026-07-09 13:35                       ` Tetsuo Handa
2026-07-10 10:43                         ` Alexander Potapenko
2026-07-10 11:32                           ` [PATCH v6] " Tetsuo Handa
2026-07-10 12:16                             ` Alexander Potapenko
2026-07-15 23:01                               ` [PATCH v7] kcov: fix data corruption and race conditions on PREEMPT_RT Tetsuo Handa
2026-07-16  9:12                                 ` Alexander Potapenko
2026-07-10 14:24                             ` Sebastian Andrzej Siewior [this message]
2026-05-21 13:06       ` [PATCH v3] kcov: move kcov_remote_data to task_struct for RT and remove local_lock Alexander Potapenko
2026-05-21 14:39         ` Tetsuo Handa

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=20260710142416.YnGT-pdK@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=andreyknvl@google.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=roman.gushchin@linux.dev \
    --cc=stern@rowland.harvard.edu \
    --cc=williams@redhat.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