Re: [PATCH] debugobjects: Fix potential data race in debug_objects_maxchain

From: Thomas Gleixner
Date: Fri May 24 2024 - 15:26:27 EST


On Thu, May 09 2024 at 04:06, Breno Leitao wrote:
> - if (cnt > debug_objects_maxchain)
> - debug_objects_maxchain = cnt;
> + if (cnt > READ_ONCE(debug_objects_maxchain))
> + WRITE_ONCE(debug_objects_maxchain, cnt);

The data race is actually harmless as this is just used for debugfs
statistics.

I'm pretty sure that the rest of these debug variables are racy as
well. Can we please annotate all of them without waiting for KCSAN to
detect them one by one?

Thanks,

tglx