linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* preempted dup_mm misses TLB invalidate
@ 2013-07-15 18:19 Nickolas Fortino
  2013-07-17 19:27 ` Catalin Marinas
  0 siblings, 1 reply; 10+ messages in thread
From: Nickolas Fortino @ 2013-07-15 18:19 UTC (permalink / raw)
  To: linux-arm-kernel

I?ve noticed an issue in simulation where the Linux kernel is executing 
a user process when the page tables and TLBs have gotten out of sync. 
The page tables have a page marked as user read only, but the TLB has 
the page marked as user read/write.

I?ve traced the issue back to the handling of copy on write pages 
generated from the ?do_fork?, ?copy_process?, ?dup_mm?, ?dup_mmap? call 
stack. If run without interruption, ?dup_mmap? calls 
?flush_tlb_mm(oldmm)? on completion, avoiding any issues. In this case, 
however, about 4 million instructions after ?dup_mm? is called, 
?copy_pte_range? yields to another thread via __cond_resched. About 20 
million instructions later, a user process with the ASID of the source 
mm is scheduled. This process performs a store to a page modified from 
read/write to read only in the copy on write logic of ?copy_one_pte?. 
Because the TLB was not invalidated, the store hits on a TLB entry with 
read/write permissions and succeeds without a fault.

What invariant in the Linux kernel is supposed to prevent this from 
happening? Note I have not observed user visible corruption, but it 
seems very unlikely a successful store to a page marked as read only in 
the kernel is safe.

For reference, this issue was found with the Linux 3.7 kernel coming 
from the Linaro 12.12 release available at 
http://releases.linaro.org/12.12/android/vexpress

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

end of thread, other threads:[~2013-07-18  1:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 18:19 preempted dup_mm misses TLB invalidate Nickolas Fortino
2013-07-17 19:27 ` Catalin Marinas
2013-07-17 19:52   ` Stephen Warren
2013-07-17 20:01     ` Russell King - ARM Linux
2013-07-17 20:11       ` Stephen Warren
2013-07-17 20:09     ` Nickolas Fortino
2013-07-17 20:34       ` Russell King - ARM Linux
2013-07-17 21:03         ` Nickolas Fortino
2013-07-17 21:21           ` Russell King - ARM Linux
2013-07-18  1:48             ` Nickolas Fortino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).