Re: data-race in pcpu_alloc / pcpu_nr_pages

From: Steven Rostedt
Date: Thu Aug 18 2022 - 19:28:48 EST


On Thu, 18 Aug 2022 18:29:00 -0400
Abhishek Shah <abhishek.shah@xxxxxxxxxxxx> wrote:

> Hi all,
>
> We found a race involving the *pcpu_nr_populated *variable. We discovered
> that the racing variable is used in meminfo_proc_show
> <https://elixir.bootlin.com/linux/v5.18-rc5/source/fs/proc/meminfo.c#L123>,
> but we were not sure if there were other security-relevant implications of
> this race. Please let us know what you think.

So you see that the number displayed in meminfo can be written to while
it's being read? As it's a long value, it is likely to be accurate (the
value before or after the update). pcpu_nr_pages() is only used to display
the number of pages in meminfo.

I don't see any problem here.

-- Steve