linux/arch/arm64/mm
Catalin Marinas 6d332747fa arm64: Fix potential race with hardware DBM in ptep_set_access_flags()
In a system with DBM (dirty bit management) capable agents there is a
possible race between a CPU executing ptep_set_access_flags() (maybe
non-DBM capable) and a hardware update of the dirty state (clearing of
PTE_RDONLY). The scenario:

a) the pte is writable (PTE_WRITE set), clean (PTE_RDONLY set) and old
   (PTE_AF clear)
b) ptep_set_access_flags() is called as a result of a read access and it
   needs to set the pte to writable, clean and young (PTE_AF set)
c) a DBM-capable agent, as a result of a different write access, is
   marking the entry as young (setting PTE_AF) and dirty (clearing
   PTE_RDONLY)

The current ptep_set_access_flags() implementation would set the
PTE_RDONLY bit in the resulting value overriding the DBM update and
losing the dirty state.

This patch fixes such race by setting PTE_RDONLY to the most permissive
(lowest value) of the current entry and the new one.

Fixes: 66dbd6e61a ("arm64: Implement ptep_set_access_flags() for hardware AF/DBM")
Cc: Will Deacon <will.deacon@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Steve Capper <steve.capper@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2017-08-04 13:26:11 +01:00
..
cache.S
context.c
copypage.c
dma-mapping.c dma-coherent: introduce interface for default DMA pool 2017-07-20 16:09:10 +02:00
dump.c
extable.c
fault.c arm64: Fix potential race with hardware DBM in ptep_set_access_flags() 2017-08-04 13:26:11 +01:00
flush.c
hugetlbpage.c
init.c
ioremap.c
kasan_init.c arm64/kasan: don't allocate extra shadow memory 2017-07-10 16:32:33 -07:00
Makefile
mmap.c arm64/mmap: properly account for stack randomization in mmap_base 2017-07-12 16:26:03 -07:00
mmu.c arm64: mmu: Place guard page after mapping of kernel image 2017-07-28 10:32:14 +01:00
numa.c arm64/numa: Drop duplicate message 2017-07-20 17:03:53 +01:00
pageattr.c
pgd.c
physaddr.c
proc.S
ptdump_debugfs.c