Re: [BUG] tsacct: KCSAN data race on task flags between acct_account_cputime() and capable()

From: Marco Elver

Date: Wed Nov 11 2026 - 06:53:46 EST


On Wed, 11 Nov 2026 at 05:53, Puranam, Ananta Srikar
<srikar.puranam@xxxxxxx> wrote:
>
> Hi,
>
> I'm Ananta Srikar Puranam, a PhD student at Washington State University.
> I'm reporting this bug on behalf of my team: Dr. Swarn Priya and
> Dr. Basavesh Ammanaghatta Shivakumar (both Cc'd).
>
> KCSAN reports a data race on task_struct::flags between the timer
> interrupt's task accounting and capable(). acct_account_cputime()
> reads tsk->flags to test PF_KTHREAD, while capable() sets PF_SUPERPRIV
> in the same word with a plain read-modify-write. The read only tests
> PF_KTHREAD, which is stable for a userspace task, so the accounting
> decision is unaffected; the race is intentional but not annotated.

I'd advise you to stop reporting KCSAN reports. This is not useful.

syzbot finds 100s of data race reports, and we haven't yet enabled
KCSAN_STRICT mode.

While I appreciate the effort, the general problem is that data races
are harder to judge in terms of severity. Given current maintainer
load, now many will fix "benign" data races, where the probability of
failure is very low. I encourage you to read [1] and [2].

[1] https://lwn.net/Articles/816854/
[2] https://docs.kernel.org/dev-tools/lkmm/docs/access-marking.html

I more useful approach would be to analyze data races and understand
their severity; i.e. does the data race, under the wrong
circumstances, result in system failure (crash, corruption, etc.).
Even better would be to then generate fixes for those issues, and send
them as RFC patches. Maintainers are more likely to respond if the
analysis leads to a patch that not just fixes the data race, but also
demonstrates how it can make the system fail badly.