Race between flush_cache_page and flush_tlb_page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

In try_to_unmap_one(), flush_cache_page() [1] is called before
flush_tlb_page() [2].

The following scenario can happen:

cpu0:                                            cpu1:
flush_cache_page()
                                                     User writes to page
ptep_clear_flush()

Since the two operations on cpu0 are not atomic, a write from the user
can happen
right after flush_cache_page() is called, but before flushing the tlb.
Thus there is a risk
the last updates from the user on cpu1 won't be flushed to memory.

I understand that not all CPUs need flush_cache_page, but for those
that require it,
how is correctness guaranteed in this case?

[1] https://elixir.bootlin.com/linux/latest/source/mm/rmap.c#L1572
[2] https://elixir.bootlin.com/linux/latest/source/mm/rmap.c#L1587

Cheers
Karim

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux