linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mm: Question: pte SMP data race in do_anomyous_page()?
@ 2023-05-25 10:06 Karim Manaouil
  2023-05-25 12:55 ` David Hildenbrand
  2023-05-25 13:53 ` Matthew Wilcox
  0 siblings, 2 replies; 7+ messages in thread
From: Karim Manaouil @ 2023-05-25 10:06 UTC (permalink / raw)
  To: npiggin; +Cc: david, akpm, mike.kravetz, linux-mm, kmanaouilinux

Hi,

In do_anonymous_page(), a new page is allocated and zeroed, and the 
corresponding page struct is initialised (setting flags PageUptodate,
PageSwapBacked, etc. and initialising the various counters).

Then, set_pte_at() is called directly without calling smp_wmb() to make
the updates above visible on other CPUs.

This could race with a page table walker. The walker can read the new pte
and try to access the page struct or the page content before the changes
above were made visible.

The reason I thought about this is because of the comment in
pmd_install(), which describes exactly the same situation, so I
wondered why the same thing is not considered in do_anonymous_page().

I might probably be missing something, but I would love to hear your
comments.

Cheers
Karim




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-31 13:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 10:06 mm: Question: pte SMP data race in do_anomyous_page()? Karim Manaouil
2023-05-25 12:55 ` David Hildenbrand
     [not found]   ` <ZHB2wyNtHn6qRWZB@ed.ac.uk>
2023-05-26  9:12     ` David Hildenbrand
2023-05-31  4:55       ` Alistair Popple
2023-05-31  7:27         ` David Hildenbrand
2023-05-31 12:54           ` Alistair Popple
2023-05-25 13:53 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox